/[gentoo-x86]/net-firewall/ipsec-tools/files/racoon.init.d-r1
Gentoo

Contents of /net-firewall/ipsec-tools/files/racoon.init.d-r1

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sun Sep 16 17:54:50 2012 UTC (22 months, 2 weeks ago) by blueness
Branch: MAIN
Improve init.d script, bug #435174

(Portage version: 2.1.11.9/cvs/Linux x86_64)

1 #!/sbin/runscript
2 # Copyright 1999-2012 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 depend() {
6 before netmount
7 use net
8 }
9
10 checkconfig() {
11 if [ ! -e ${SETKEY_CONF} ] ; then
12 eerror "You need to configure setkey before starting racoon."
13 return 1
14 fi
15 if [ ! -e ${RACOON_CONF} ] ; then
16 eerror "You need a configuration file to start racoon."
17 return 1
18 fi
19 if [ ! -z ${RACOON_PSK_FILE} ] ; then
20 if [ ! -f ${RACOON_PSK_FILE} ] ; then
21 eerror "PSK file not found as specified."
22 eerror "Set RACOON_PSK_FILE in /etc/conf.d/racoon."
23 return 1
24 fi
25 case "`ls -Lldn ${RACOON_PSK_FILE}`" in
26 -r--------*)
27 ;;
28 *)
29 eerror "Your defined PSK file should be mode 400 for security!"
30 return 1
31 ;;
32 esac
33 fi
34 }
35
36 command=/usr/sbin/racoon
37 command_args="-f ${RACOON_CONF} ${RACOON_OPTS}"
38 pidfile=/var/run/racoon.pid
39
40 start_pre() {
41 checkconfig || return 1
42 einfo "Loading ipsec policies from ${SETKEY_CONF}."
43 /usr/sbin/setkey -f ${SETKEY_CONF}
44 if [ $? -eq 1 ] ; then
45 eerror "Error while loading ipsec policies"
46 fi
47 }
48
49 stop_post() {
50 if [ -n "${RACOON_RESET_TABLES}" ]; then
51 ebegin "Flushing policy entries"
52 /usr/sbin/setkey -F
53 /usr/sbin/setkey -FP
54 eend $?
55 fi
56 }

  ViewVC Help
Powered by ViewVC 1.1.20