Make sure that firewall operates in stateful mode

Work task: Make sure that firewall operates in stateful mode using iptables

Workaround:

iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT

Letakkan rule dibagian paling atas, karena iptables akan membaca rule secara berurutan, setelah rule-rule iptables diatas, selanjutnya tinggal allow service-service yang ingin digunakan, misalnya:

# Allow remote ssh and http access
iptables -A INPUT -p tcp --dport 22 -j ACCEPT # ssh
iptables -A INPUT -p tcp --dport 80 -j ACCEPT # http

# Allow DNS lookups to be initiated from this server
iptables -A OUTPUT -p udp --dport 53 -j ACCEPT # dns
iptables -A OUTPUT -p tcp --dport 53 -j ACCEPT # dns

Komentar

Postingan populer dari blog ini

Cara memahami dan menghafal model OSI dengan analogi

Pembahasan IT Network Systems Administration Module A DNS (Forward Zone, Reverse Zone, CNAME, MX, Split View)

Table of Contents