Information
Every device with networking capabilities has a loopback interface.
Loopback traffic refers to network communication where a device sends data to itself, essentially routing the traffic back to its own network interface.
Outbound traffic is data sent from a device to another device or network.
The loopback interface is the only place that loopback network traffic should be seen, all other interfaces should ignore traffic on this network as an anti-spoofing measure.
Solution
Add the appropriate rich rules by running the following commands:
# firewall-cmd --permanent --zone={ZONE_NAME} --add-rich-rule='rule family=ipv4 source address="127.0.0.1" destination not address="127.0.0.1" drop'
# firewall-cmd --permanent --zone={ZONE_NAME} --add-rich-rule='rule family=ipv6 source address="::1" destination not address="::1" drop'
Example script:
#!/usr/bin/env bash
{
while IFS= read -r l_zone; do
firewall-cmd --permanent --zone="$l_zone" --add-rich-rule='rule family=ipv4 source address="127.0.0.1" destination not address="127.0.0.1" drop'
firewall-cmd --permanent --zone="$l_zone" --add-rich-rule='rule family=ipv6 source address="::1" destination not address="::1" drop'
done < <(firewall-cmd --get-zone-of-interface=lo | xargs)
}
Run the following command to load the updated firewalld rules:
# firewall-cmd --reload