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