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