Red Hat Bugzilla – Bug 1210563
BUG: ip[6]tables init script does not handle the security table correctly in set_policy()
Last modified: 2018-06-19 01:09:05 EDT
Created attachment 1012952 [details] Patch for /etc/init.d/{iptables,ip6tables} Description of problem: When the security table is being used (e.g. secmark) the iptables and ip6tables init scripts fail in set_policy() due to not recognizing the security table. In order to preserve the separation between the host-based firewall rules and SELinux based secmark labeling the init scripts should be made *aware* of the security table so the scripts do not fail, but the should not take any action against the security table in set_policy() . Version-Release number of selected component (if applicable): iptables-1.4.7-16.el6.x86_64 iptables-ipv6-1.4.7-16.el6.x86_64 How reproducible: Every time. Steps to Reproduce: 1. service iptables start 2. /sbin/iptables -t security -A FORWARD -p icmp -j LOG 3. service iptables stop Actual results: # service iptables start iptables: Applying firewall rules: [ OK ] # /sbin/iptables -t security -A FORWARD -p icmp -j LOG # service iptables stop iptables: Setting chains to policy ACCEPT: security filter [FAILED] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] Expected results: # service iptables start iptables: Applying firewall rules: [ OK ] # /sbin/iptables -t security -A FORWARD -p icmp -j LOG # service iptables stop iptables: Setting chains to policy ACCEPT: security filter [ OK ] iptables: Flushing firewall rules: [ OK ] iptables: Unloading modules: [ OK ] Additional info: The same problem applies to both the IPv4 and IPv6 init scripts.
Created attachment 1012954 [details] Patch for /etc/init.d/{iptables,ip6tables} Ooops, fix a minor typo in the patch for ip6tables.
Hi Paul, (In reply to Paul Moore from comment #0) > Description of problem: > When the security table is being used (e.g. secmark) the iptables and > ip6tables init scripts fail in set_policy() due to not recognizing the > security table. In order to preserve the separation between the host-based > firewall rules and SELinux based secmark labeling the init scripts should be > made *aware* of the security table so the scripts do not fail, but the > should not take any action against the security table in set_policy() . I agree this is a bug in iptables.init, but I wonder about one aspect: Why should the init script ignore the security table? Assuming that a user may add custom rules to it as well, I'd handle it just like the other tables, setting policies of builtin chains to ACCEPT if iptables is stopped. What are your reasons against that? Thanks, Phil
The general idea is when it comes to the SELinux iptables/netfilter rules is that they should be immune to iptables flush, and similar, commands. The reasoning is that many sysadmins are trained to do certain things which could compromise a SELinux system using an iptables/netfilter configuration to label traffic using secmark.
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2018:1859