-
Notifications
You must be signed in to change notification settings - Fork 230
/
fwknop.init.fedora
executable file
·115 lines (101 loc) · 2.12 KB
/
fwknop.init.fedora
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
#
# fwknopd This starts and stops fwknopd.
#
# chkconfig: 345 60 10
# description: Fwknop implements an authorization scheme known as \
# Single Packet Authorization (SPA) for Linux systems \
# running iptables. This mechanism requires only a single \
# encrypted and non-replayed packet to communicate various \
# pieces of information including desired access through \
# an iptables policy.
#
# processname: /usr/sbin/fwknopd
#
### BEGIN INIT INFO
# Provides:
# Required-Start: $syslog $local_fs $network $iptables
# Required-Stop: $syslog $local_fs $network $iptables
# Should-Start:
# Should-Stop:
# Default-Start: 3 4 5
# Default-Stop: 0 1 2 6
# Short-Description: start and stop fwknopd
# Description: Fwknop implements an authorization scheme known as \
# Single Packet Authorization (SPA) for Linux systems \
# running iptables.
### END INIT INFO
PATH=/sbin:/bin:/usr/bin:/usr/sbin
# Source function library.
. /etc/init.d/functions
# Get config.
test -f /etc/sysconfig/network && . /etc/sysconfig/network
RETVAL=0
prog="fwknopd"
start() {
echo -n $"Starting $prog: "
daemon $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/fwknopd
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $prog
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/fwknopd
return $RETVAL
}
reload(){
echo -n $"Reloading configuration: "
killproc $prog -HUP
RETVAL=$?
echo
return $RETVAL
}
restart(){
stop
sleep 1
start
}
condrestart(){
if [ -e /var/lock/subsys/fwknopd ] ; then
restart
RETVAL=$?
return $RETVAL
fi
RETVAL=0
return $RETVAL
}
case "$1" in
start)
start
RETVAL=$?
;;
stop)
stop
RETVAL=$?
;;
status)
status $prog
RETVAL=$?
;;
restart)
restart
RETVAL=$?
;;
reload|force-reload)
reload
RETVAL=$?
;;
condrestart|try-restart)
condrestart
RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}"
RETVAL=2
esac
exit $RETVAL