I had not paid much attention to what is actually going on with IPtables, I simply accepted the examples I had seen and applied the rules accordingly... for some reason I realized ( I hope) what is going on with the standard IPtables config.
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
So - the first packet goes past ESTABLISHED (unaccepted) then is accepted by the NEW rule.
The next packet for that connection is then accepted as part of ESTABLISHED.
So - if a packet is not ESTABLISHED, nor on port 22... it gets rejected.
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
So - the first packet goes past ESTABLISHED (unaccepted) then is accepted by the NEW rule.
The next packet for that connection is then accepted as part of ESTABLISHED.
So - if a packet is not ESTABLISHED, nor on port 22... it gets rejected.
Comments
Post a Comment