Page Menu
Home
ClusterLabs Projects
Search
Configure Global Search
Log In
Files
F2822737
booth_path
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
786 B
Referenced Files
None
Subscribers
None
booth_path
View Options
#!/bin/sh
#
# manage iptables rules for the given port
#
[ $# -lt 1 ] && exit
action=$1
port=${2:-9929}
testip() {
local chain=$1
iptables -L $chain | grep -wq ^DROP.*$port
}
logcmd() {
logger -p local7.info "$*"
eval $*
}
case "$action" in
start)
logcmd iptables -D INPUT -p udp --dport $port -j DROP
logcmd iptables -D OUTPUT -p udp --dport $port -j DROP
logcmd iptables -D INPUT -p udp --sport $port -j DROP
logcmd iptables -D OUTPUT -p udp --sport $port -j DROP
;;
stop)
testip INPUT && {
echo "packets from/to $port already being dropped!"
exit
}
logcmd iptables -A INPUT -p udp --dport $port -j DROP
logcmd iptables -A OUTPUT -p udp --dport $port -j DROP
logcmd iptables -A INPUT -p udp --sport $port -j DROP
logcmd iptables -A OUTPUT -p udp --sport $port -j DROP
;;
esac
File Metadata
Details
Attached
Mime Type
text/x-shellscript
Expires
Sat, Jan 25, 6:31 AM (1 d, 4 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1116023
Default Alt Text
booth_path (786 B)
Attached To
Mode
rB Booth
Attached
Detach File
Event Timeline
Log In to Comment