Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- if [ "$USER" == "root" ]; then
- if [ "$1" != "" ]; then
- rule="-I INPUT -s $1 -j DROP"
- sed s/COMMIT//g /etc/iptables.firewall.rules > /tmp/blockip.tmp
- echo $rule >> /tmp/blockip.tmp
- echo "COMMIT" >> /tmp/blockip.tmp
- mv /tmp/blockip.tmp /etc/iptables.firewall.rules
- iptables-restore < /etc/iptables.firewall.rules
- echo "Rule added."
- else
- echo "No IP found."
- fi
- else
- echo "Permiso denegado."
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement