Skip to content

Instantly share code, notes, and snippets.

@t-cyrill
Created December 4, 2015 03:08
Show Gist options
  • Save t-cyrill/9c0544d509568270e8d6 to your computer and use it in GitHub Desktop.
Save t-cyrill/9c0544d509568270e8d6 to your computer and use it in GitHub Desktop.
#!/bin/bash
# more safety iptables-rule checker script
# Example
# iptables -A INPUT -p tcp --dport 22 -j REJECT
iptables-save > /tmp/iptables.up.rules.bak
( sleep 3; iptables-restore < /tmp/iptables.up.rules.bak; echo "Discard changes") &
iptables-restore < /etc/iptables.up.rules
echo "Press [y] key"
read line
case $line in
[yY]*)
kill $!
;;
*)
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment