Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- echo "* Removing current iptable rules.."
- iptables -P INPUT ACCEPT
- iptables -P OUTPUT ACCEPT
- iptables -F
- echo "* Adding new rules..."
- iptables -A INPUT -m tcp -p tcp --dport 22 -j ACCEPT -m comment --comment "Allow SSH"
- iptables -A INPUT -m tcp -p tcp --dport 80 -j ACCEPT -m comment --comment "Allow HTTP"
- iptables -A INPUT -m tcp -p tcp --dport 21 -j ACCEPT -m comment --comment "Allow FTP"
- iptables -A INPUT -p tcp --match multiport --dports 6666:6699 -j ACCEPT -m comment --comment "Allow ircd range"
- iptables -A INPUT -p udp -m udp --sport 53 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow DNS udp"
- iptables -A INPUT -p tcp -m tcp --sport 53 --dport 1024:65535 -m state --state ESTABLISHED -j ACCEPT -m comment --comment "Allow DNS tcp"
- iptables -A INPUT -p icmp --icmp-type 0 -s 0/0 -m state --state ESTABLISHED,RELATED -j ACCEPT -m comment --comment "Allow ICMP"
- iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT -m comment --comment "Allow ICMP ping"
- iptables -L
- echo
- echo "--------------------------"
- echo "If everything looks good then run this command;"
- echo -e "iptables -P INPUT DROP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement