2000-06-13 20:29:53 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2008-11-22 23:23:33 +03:00
|
|
|
# $NetBSD: ipsec,v 1.11 2008/11/22 20:23:33 tsutsui Exp $
|
2000-06-13 20:29:53 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ipsec
|
2008-11-22 23:23:33 +03:00
|
|
|
# REQUIRE: root bootconf mountcritlocal tty
|
2002-03-22 07:33:57 +03:00
|
|
|
# BEFORE: DAEMON
|
2000-06-13 20:29:53 +04:00
|
|
|
|
2004-08-13 22:08:03 +04:00
|
|
|
$_rc_subr_loaded . /etc/rc.subr
|
2000-06-13 20:29:53 +04:00
|
|
|
|
|
|
|
name="ipsec"
|
2000-09-19 17:04:38 +04:00
|
|
|
rcvar=$name
|
2000-07-17 17:10:54 +04:00
|
|
|
start_precmd="ipsec_prestart"
|
2000-06-13 20:29:53 +04:00
|
|
|
start_cmd="ipsec_start"
|
2000-09-19 17:04:38 +04:00
|
|
|
stop_precmd="test -f /etc/ipsec.conf"
|
2000-06-13 20:29:53 +04:00
|
|
|
stop_cmd="ipsec_stop"
|
|
|
|
reload_cmd="ipsec_reload"
|
|
|
|
extra_commands="reload"
|
|
|
|
|
2000-07-21 05:16:07 +04:00
|
|
|
ipsec_prestart()
|
2000-06-13 20:29:53 +04:00
|
|
|
{
|
|
|
|
if [ ! -f /etc/ipsec.conf ]; then
|
2000-07-17 17:10:54 +04:00
|
|
|
warn "/etc/ipsec.conf not readable; ipsec start aborted."
|
2007-04-06 18:20:08 +04:00
|
|
|
|
|
|
|
stop_boot
|
2000-07-17 17:10:54 +04:00
|
|
|
return 1
|
2000-06-13 20:29:53 +04:00
|
|
|
fi
|
2000-07-17 17:10:54 +04:00
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
ipsec_start()
|
|
|
|
{
|
2000-06-13 20:29:53 +04:00
|
|
|
echo "Installing ipsec manual keys/policies."
|
|
|
|
/sbin/setkey -f /etc/ipsec.conf
|
|
|
|
}
|
|
|
|
|
|
|
|
ipsec_stop()
|
|
|
|
{
|
2000-06-14 07:24:16 +04:00
|
|
|
echo "Clearing ipsec manual keys/policies."
|
2000-06-13 20:29:53 +04:00
|
|
|
|
|
|
|
# still not 100% sure if we would like to do this.
|
|
|
|
# it is very questionable to do this during shutdown session, since
|
|
|
|
# it can hang any of remaining IPv4/v6 session.
|
|
|
|
#
|
|
|
|
/sbin/setkey -F
|
|
|
|
/sbin/setkey -FP
|
|
|
|
}
|
|
|
|
|
|
|
|
ipsec_reload()
|
|
|
|
{
|
|
|
|
echo "Reloading ipsec manual keys/policies."
|
|
|
|
/sbin/setkey -F
|
|
|
|
/sbin/setkey -FP
|
|
|
|
/sbin/setkey -f /etc/ipsec.conf
|
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|