Debian Codegraph @

test/booth_path

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # manage iptables rules for the given port
4 #
5
6 [scip-shell system . . `[`. $# -lt 1 ] && exit
7 action=$1
8 port=${2:-9929}
9 testipscip-shell shell booth 1.2-3 testip().() {
10 local chain=$1
11 iptables -L $chain | grepscip-shell system . . grep. -wq ^DROP.*$port
12 }
13 logcmdscip-shell shell booth 1.2-3 logcmd().() {
14 loggerscip-shell system . . logger. -p local7.info "$*"
15 eval $*
16 }
17
18 case "$action" in
19 start)
20 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -D INPUT -p udp --dport $port -j DROP
21 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -D OUTPUT -p udp --dport $port -j DROP
22 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -D INPUT -p udp --sport $port -j DROP
23 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -D OUTPUT -p udp --sport $port -j DROP
24 ;;
25 stop)
26 testipscip-shell shell booth 1.2-3 testip(). INPUT && {
27 echoscip-shell system . . echo. "packets from/to $port already being dropped!"
28 exit
29 }
30 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -A INPUT -p udp --dport $port -j DROP
31 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -A OUTPUT -p udp --dport $port -j DROP
32 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -A INPUT -p udp --sport $port -j DROP
33 logcmdscip-shell shell booth 1.2-3 logcmd(). iptables -A OUTPUT -p udp --sport $port -j DROP
34 ;;
35 esac