-
Notifications
You must be signed in to change notification settings - Fork 0
/
apf.init
executable file
·48 lines (45 loc) · 952 Bytes
/
apf.init
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
#!/bin/bash
##
# chkconfig: 345 55 25
# description: Advanced Policy Firewall
#
# source function library
. /etc/rc.d/init.d/functions
# import variables
. /etc/apf/conf.apf
. /etc/apf/internals/internals.conf
ipt="/sbin/iptables"
inspath="/etc/apf"
prog="apf"
case "$1" in
start)
echo -n "Starting APF:"
/usr/local/sbin/apf --start >> /dev/null 2>&1
echo_success
echo
;;
stop)
echo -n "Stopping APF:"
/usr/local/sbin/apf --stop >> /dev/null 2>&1
echo_success
echo
;;
restart)
$0 stop
$0 start
;;
condrestart)
if $ipt -n -L TALLOW > /dev/null 2>&1 && \
$ipt -n -L TDENY > /dev/null 2>&1 && \
$ipt -n -L TGALLOW > /dev/null 2>&1 && \
$ipt -n -L TGDENY > /dev/null 2>&1; then
$0 stop
$0 start
else
echo "APF not running, doing nothing."
fi
;;
*)
echo "usage: $0 [start|stop|restart|condrestart]"
esac
exit 0