2001-06-16 07:16:14 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2002-06-13 22:14:37 +00:00
|
|
|
# $FreeBSD$
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
# PROVIDE: ipsec
|
2007-04-09 08:53:40 +00:00
|
|
|
# REQUIRE: FILESYSTEMS
|
2005-10-12 22:14:44 +00:00
|
|
|
# BEFORE: DAEMON mountcritremote
|
2004-10-07 13:55:26 +00:00
|
|
|
# KEYWORD: nojail
|
2001-06-16 07:16:14 +00:00
|
|
|
|
|
|
|
. /etc/rc.subr
|
|
|
|
|
|
|
|
name="ipsec"
|
2002-06-13 22:14:37 +00:00
|
|
|
rcvar=`set_rcvar`
|
2001-06-16 07:16:14 +00:00
|
|
|
start_precmd="ipsec_prestart"
|
|
|
|
start_cmd="ipsec_start"
|
2006-01-24 15:11:11 +00:00
|
|
|
stop_precmd="test -f $ipsec_file"
|
2001-06-16 07:16:14 +00:00
|
|
|
stop_cmd="ipsec_stop"
|
|
|
|
reload_cmd="ipsec_reload"
|
|
|
|
extra_commands="reload"
|
2005-10-12 21:40:41 +00:00
|
|
|
ipsec_program="/sbin/setkey"
|
2004-01-17 10:40:45 +00:00
|
|
|
# ipsec_file is set by rc.conf
|
2002-07-31 16:39:19 +00:00
|
|
|
|
2001-06-16 07:16:14 +00:00
|
|
|
ipsec_prestart()
|
|
|
|
{
|
2002-06-13 22:14:37 +00:00
|
|
|
if [ ! -f "$ipsec_file" ]; then
|
|
|
|
warn "$ipsec_file not readable; ipsec start aborted."
|
2007-05-18 12:04:41 +00:00
|
|
|
stop_boot
|
2001-06-16 07:16:14 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
return 0
|
|
|
|
}
|
|
|
|
|
|
|
|
ipsec_start()
|
|
|
|
{
|
|
|
|
echo "Installing ipsec manual keys/policies."
|
2002-07-31 16:39:19 +00:00
|
|
|
${ipsec_program} -f $ipsec_file
|
2001-06-16 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ipsec_stop()
|
|
|
|
{
|
|
|
|
echo "Clearing ipsec manual keys/policies."
|
|
|
|
|
2009-08-23 05:56:54 +00: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 the remaining IPv4/v6 sessions.
|
2001-06-16 07:16:14 +00:00
|
|
|
#
|
2002-07-31 16:39:19 +00:00
|
|
|
${ipsec_program} -F
|
|
|
|
${ipsec_program} -FP
|
2001-06-16 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
ipsec_reload()
|
|
|
|
{
|
|
|
|
echo "Reloading ipsec manual keys/policies."
|
2002-07-31 16:39:19 +00:00
|
|
|
${ipsec_program} -f "$ipsec_file"
|
2001-06-16 07:16:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
load_rc_config $name
|
|
|
|
run_rc_command "$1"
|