7 .
/etc
/conf.d
/$daemon_name.conf
10 pidof
-o %PPID
$daemon_name
13 [ -z "$NFQUEUE_NUM" ] && NFQUEUE_NUM
=666
14 [ -z "$PORT" ] && PORT
=80
16 # This is taken from launch_tcpcryptd.sh
17 linux_set_iptables
() {
18 iptables
-I INPUT \
! --in-interface lo
-p tcp
--sport $PORT -j NFQUEUE
--queue-num $NFQUEUE_NUM ||
return 1
19 iptables
-I OUTPUT \
! --out-interface lo
-p tcp
--dport $PORT -j NFQUEUE
--queue-num $NFQUEUE_NUM ||
return 1
22 linux_unset_iptables
() {
23 iptables
-D INPUT \
! --in-interface lo
-p tcp
--sport $PORT -j NFQUEUE
--queue-num $NFQUEUE_NUM
24 iptables
-D OUTPUT \
! --out-interface lo
-p tcp
--dport $PORT -j NFQUEUE
--queue-num $NFQUEUE_NUM
26 # These are for easing upgrades, since older versions didn't specify an interface
27 iptables
-D INPUT
-p tcp
--sport $PORT -j NFQUEUE
--queue-num $NFQUEUE_NUM 2>/dev
/null
28 iptables
-D OUTPUT
-p tcp
--dport $PORT -j NFQUEUE
--queue-num $NFQUEUE_NUM 2>/dev
/null
34 stat_busy
"Starting $daemon_name daemon"
37 if [ -z "$PID" ]; then
38 [ -f /var
/run
/$daemon_name.pid
] && rm -f /var
/run
/$daemon_name.pid
46 $daemon_name $OPTS -p $NFQUEUE_NUM >/dev
/null
&
52 echo $
(get_pid
) > /var
/run
/$daemon_name.pid
53 add_daemon
$daemon_name
63 stat_busy
"Stopping $daemon_name daemon"
68 [ ! -z "$PID" ] && kill $PID &> /dev
/null
74 rm -f /var
/run
/$daemon_name.pid
&> /dev
/null
75 rm_daemon
$daemon_name
87 stat_busy
"Checking $daemon_name status";
88 ck_status
$daemon_name
92 echo "usage: $0 {start|stop|restart|status}"