rendered paste body#!/bin/bash
#Clears all firewall rules
iptables -F
#Allows tcp connections
iptables -I INPUT -p tcp --dport 25 -j ACCEPT
iptables -I INPUT -p tcp --dport 2222 -j ACCEPT
iptables -I INPUT -p tcp --dport 53 -j ACCEPT
#Allows ICMP ping but limits it
iptables -I INPUT -p icmp --icmp-type echo-request -m limit --limit 3/second --limit-burst 50 -j ACCEPT
#DOS Protection
iptables -I INPUT -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s -j ACCEPT
iptables -I INPUT -p tcp --syn -m limit --limit 1/s -j ACCEPT
#Allows all outgoing traffic
iptables -I OUTPUT ACCEPT
#Drops packets from IP addresses
#iptables -I INPUT -s 192.168.1.1. -j DROP
#DROPS all packets MUST GO LAST
iptables -A INPUT -j DROP
exit 0