ansible-lockdown / RHEL8-CIS

Ansible role for Red Hat 8 CIS Baseline
https://ansible-lockdown.readthedocs.io/en/latest/
MIT License
263 stars 162 forks source link

Ensure host based firewall loopback traffic is configured to the trusted zone #361

Closed bbaassssiiee closed 6 months ago

bbaassssiiee commented 6 months ago

Describe the Issue Configure firewalld to restrict loopback traffic to the lo interface. The loopback traffic must be trusted by assigning the lo interface to the firewalld trusted zone. However, the loopback traffic must be restricted to the loopback interface as an anti-spoofing measure.

Expected Behavior

sudo firewall-cmd --permanent --zone=trusted --add-interface=lo
sudo firewall-cmd --permanent --zone=trusted --add-rich-rule='rule family=ipv4 source address="127.0.0.1" destination not address="127.0.0.1" drop'
sudo firewall-cmd --permanent --zone=trusted --add-rich-rule='rule family=ipv6 source address="::1" destination not address="::1" drop'

Actual Behavior

sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address="127.0.0.1" destination not address="127.0.0.1" drop'
sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv6 source address="::1" destination not address="::1" drop'

Control(s) Affected 3.4.2.2 Environment (please complete the following information):

Additional Notes Anything additional goes here

Possible Solution Add the rich_rule to the trusted zone

bbaassssiiee commented 6 months ago
 <interface name="lo"/>

The above is still missing... Should immediate: true be set?

/etc/firewalld/zones/trusted.xml now has:

<?xml version="1.0" encoding="utf-8"?>
<zone target="ACCEPT">
  <short>Trusted</short>
  <description>All network connections are accepted.</description>
  <rule family="ipv4">
    <source address="127.0.0.1"/>
    <destination address="127.0.0.1" invert="True"/>
    <drop/>
  </rule>
  <rule family="ipv6">
    <source address="::1"/>
    <destination address="::1" invert="True"/>
    <drop/>
  </rule>
</zone>
bbaassssiiee commented 6 months ago

Looks good now