3.5.1.4 Ensure firewall rules exist for all open ports

Information

Any ports that have been opened on non-loopback addresses need firewall rules to govern traffic.

Rationale:

Without a firewall rule configured for open ports default firewall policy will drop all packets to these ports.

NOTE: Nessus has provided the target output to assist in reviewing the benchmark to ensure target compliance.

Solution

For each port identified in the audit which does not have a firewall rule establish a proper rule for accepting inbound connections:

# iptables -A INPUT -p <protocol> --dport <port> -m state --state NEW -j ACCEPT

For example:
# ss -tunlp |awk 'NR!=1' |awk -F ' ' '{print $1":"$5}' |awk -F ':' '($2!="127.0.0.1"){print $1" "$NF}'| while read protocol port; do iptables -A INPUT -p $protocol --dport $port -m state --state NEW -j ACCEPT; done
# service iptables save

See Also

https://workbench.cisecurity.org/files/2449

Item Details

Category: CONFIGURATION MANAGEMENT, SYSTEM AND COMMUNICATIONS PROTECTION

References: 800-53|CM-7b., 800-53|SC-7(12), CSCv7|9.2, CSCv7|9.4

Plugin: Unix

Control ID: db0fbae5427c6a52f4d298edf540e1f4267a22f990b8e5e493375d01d4626bea