Skip to content

Instantly share code, notes, and snippets.

@asharpe
Forked from anonymous/gist:5282921
Last active December 15, 2015 15:38
Show Gist options
  • Save asharpe/5282936 to your computer and use it in GitHub Desktop.
Save asharpe/5282936 to your computer and use it in GitHub Desktop.
#!/bin/bash
inside_interface='wlan0'
rules() {
while IFS= read -r line; do
eval set -- $line
echo "iptables ${@}"
echo "$# $@"
#iptables ${line[@]}
done << EOF
-P FORWARD DROP
-P INPUT DROP
-P OUTPUT DROP
-N allowed-connection
-F allowed-connection
-A allowed-connection -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
-A allowed-connection -i ${inside_interface} -m limit -j LOG --log-prefix "Bad packet from ${inside_interface}:"
-F
-X
-L
EOF
}
_ARGS=( "$@" )
rules
set -- "${ARGS[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment