Tuesday, April 14, 2015

debian - UFW firewall difference between allow ip and allow port?



When using the UFW firewall app, what is the difference between allowing connections from to a port and allowing connection from an IP?




If I allow connections from an IP does that mean that IP can connect to all open ports on the machine?



If I allow connections to a certain port does that mean that any one (IP) can connect to that port?



What happens if I run 'ufw default deny incoming'. And the authorize an IP address, does it have access to all open ports?



Also what is the difference between UFW and iptables? Is UFW just a user-friendly interface to iptables?


Answer



If I allow connections from an IP does that mean that IP can connect to all open ports on the machine? Yes




If I allow connections to a certain port does that mean that any one (IP) can connect to that port? Yes, unless other restrictions are applied elsewhere



What happens if I run 'ufw default deny incoming'. And the authorize an IP address, does it have access to all open ports? The authorized IP should be allowed through.



Also what is the difference between UFW and iptables? Is UFW just a user-friendly interface to iptables? Yes absolutely.



The key with iptables is the order of the rules. If an allow rule is before a deny rule the, 1st rule, allow rule wins.



After completeing UFW do run this.





iptables -L -x -v -n




This will tell you absolutely what order the rules are in.



There is one other hierarchy. The data goes through tables from RAW to PREROUTING, to INPUT and so anything in RAW will over rider all others and so forth.


No comments:

Post a Comment