summaryrefslogtreecommitdiff
blob: 2d4bf293e6e17a4b6d1b586a8071c23b78e0ae89 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/sbin/runscript

# IPsec startup and shutdown script
# Copyright (C) 1998, 1999, 2001  Henry Spencer.
# Gentoo mods (C) 2003 Anthony de Boer
# 
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2 of the License, or (at your
# option) any later version.  See <http://www.fsf.org/copyleft/gpl.txt>.
# 
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.

depend() {
	need net logger
	after dns
}

ipsecdoit() {
# Pick up IPsec configuration (until we have done this, successfully, we
# do not know where errors should go, hence the explicit "daemon.error"s.)
# Note the "--export", which exports the variables created.
	eval `ipsec _confread --varprefix IPSEC --export --type config setup`
	if test " $IPSEC_confreadstatus" != " "
	then
		echo "$IPSEC_confreadstatus -- \`$1' aborted" |
			logger -s -p daemon.error -t ipsec_setup
		return 1
	fi
	IPSECsyslog=${IPSECsyslog-daemon.error}
	export IPSECsyslog
	umask 022
	tmp=/var/run/ipsec_setup.st
	(
		ipsec _realsetup $1
		echo "$?" >$tmp
	) 2>&1 | logger -s -p $IPSECsyslog -t ipsec_setup 2>&1
	st=`cat $tmp`
	rm -f $tmp
	return $st
}

start() {
	ebegin "Starting IPSEC ..."
	ipsecdoit start
	eend $?
}

stop() {
	ebegin "Stopping IPSEC ..."
	ipsecdoit stop
	eend $?
}