Basic IPTables rules for SSH and Webserver
set the default policy to DROP
#iptables -P INPUT DROP
#iptables -P OUTPUT ACCEPT
#iptables -P FORWARD DROP
accept anything on localhost
#iptables -A INPUT -i lo -j ACCEPT
#iptables -A OUTPUT -o lo -j ACCEPT
allow traffic once a connection has been made
#iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
accept anything on ssh port
#iptables -A INPUT -p tcp --dport 22 -j ACCEPT
accept anything on http and https port
#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#iptables -A INPUT -p tcp --dport 443 -j ACCEPT
to save
#apt-get install iptables-persistent
#iptables -P INPUT DROP
#iptables -P OUTPUT ACCEPT
#iptables -P FORWARD DROP
accept anything on localhost
#iptables -A INPUT -i lo -j ACCEPT
#iptables -A OUTPUT -o lo -j ACCEPT
allow traffic once a connection has been made
#iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
accept anything on ssh port
#iptables -A INPUT -p tcp --dport 22 -j ACCEPT
accept anything on http and https port
#iptables -A INPUT -p tcp --dport 80 -j ACCEPT
#iptables -A INPUT -p tcp --dport 443 -j ACCEPT
to save
#apt-get install iptables-persistent
Komentar