2000-06-13 20:29:53 +04:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-03-22 07:33:57 +03:00
|
|
|
# $NetBSD: ipsec,v 1.7 2002/03/22 04:33:58 thorpej Exp $
|
2000-06-13 20:29:53 +04:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ipsec
|
|
|
|
# REQUIRE: root beforenetlkm mountcritlocal tty
|
2002-03-22 07:33:57 +03:00
|
|
|
# BEFORE: DAEMON
|
2000-06-13 20:29:53 +04:00
|
|
|
|
|
|
|
# it does not really require beforenetlkm.
|
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
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."
|
2000-07-21 05:16:07 +04:00
|
|
|
#
|
|
|
|
# If booting directly to multiuser, send SIGTERM to
|
|
|
|
# the parent (/etc/rc) to abort the boot
|
|
|
|
#
|
|
|
|
if [ "$autoboot" = yes ]; then
|
|
|
|
echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
|
|
|
|
kill -TERM $$
|
|
|
|
exit 1
|
|
|
|
fi
|
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"
|