Monday, 29 June 2015

Basic Linux iptables configuration

#iptables –F
#service iptables save
#service iptables restart
#chkconfig iptables on
DDOS or similar attack prevent
#iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
syn-flood attack prevent
#iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP

XMAS attack prevent
#iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP

localhost interface:
#iptables -I INPUT 1 -i lo -p all -j ACCEPT

Web server traffic:
#iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
#iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

SMTP servers:
#iptables -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
#iptables -A INPUT -p tcp -m tcp --dport 465 -j ACCEPT

Read email
#iptables -A INPUT -p tcp -m tcp --dport 110 -j ACCEPT
#iptables -A INPUT -p tcp -m tcp --dport 995 -j ACCEPT

MAP mail protocol:
#iptables -A INPUT -p tcp -m tcp --dport 143 -j ACCEPT
#iptables -A INPUT -p tcp -m tcp --dport 993 -j ACCEPT

Limiting SSH access
#iptables -A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
#iptables -A INPUT -p tcp -s YOUR_IP_ADDRESS -m tcp --dport 22 -j ACCEPT


## delete or comment out port 22 line ##
## -A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
## open port 2022
#iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 2022 -j ACCEPT

No comments:

Post a Comment