Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1459673

Summary: iptables init script doesn't support /etc/sysctl.d/
Product: Red Hat Enterprise Linux 6 Reporter: Davide F Bragalone <dbragalo>
Component: iptablesAssignee: Phil Sutter <psutter>
Status: CLOSED ERRATA QA Contact: Tomas Dolezal <todoleza>
Severity: high Docs Contact: Ioanna Gkioka <igkioka>
Priority: high    
Version: 6.9CC: atragler, carlospec, cww, igkioka, iptables-maint-list, psutter, sjr, todoleza
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: iptables-1.4.7-19.el6 Doc Type: Enhancement
Doc Text:
The _iptables-services_ package now support `/etc/sysctl.d` With this update, the init scripts of the `iptables` or `ip6tables` services now recognize the configuration files in the `/etc/sysctl.d` directory as well as the `/etc/sysctl.conf` file itself. As a result, the user-provided sysctl settings stored in `/etc/sysctl.d/` are now correctly taken into account when the `iptables` service is restarted.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-06-19 05:08:46 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1374441, 1461138, 1506394    

Description Davide F Bragalone 2017-06-07 18:48:39 UTC
Description of problem:

The init script for iptables /etc/init.d/iptables doesn't support /etc/sysctl.d .

load_sysctl() {
    # load matched sysctl values
    if [ -n "$IPTABLES_SYSCTL_LOAD_LIST" ]; then
        echo -n $"Loading sysctl settings: "
        ret=0
        for item in $IPTABLES_SYSCTL_LOAD_LIST; do
            fgrep $item /etc/sysctl.conf | sysctl -p - >/dev/null    <=========
            let ret+=$?;
        done
        [ $ret -eq 0 ] && success || failure
        echo
    fi
    return $ret
}

That means that if you edit a kernel parameter related to iptables via /etc/sysctl.d/foo.conf , this won't be applied on iptables restart.


Version-Release number of selected component (if applicable):
kernel 2.6.32-696.3.1.el6.x86_64
iptables-1.4.7-16.el6.x86_64

How reproducible:
100%

Steps to Reproduce:
1. edit parameter net.nf_conntrack_max via /etc/sysctl.d/iptables.conf 
2. restart iptables
3. verify if /proc/sys/net/nf_conntrack_max has been modified

Actual results:
never updated

Expected results:
always updated

Comment 2 Davide F Bragalone 2017-06-07 19:01:18 UTC
I've forgot this in the bugzilla's description:

initscripts-9.03.58-1.el6_9.1.x86_64

Comment 4 Lukáš Nykrýn 2017-06-08 08:20:25 UTC
The mentioned code is inside a initscript provided by the iputils package.

Comment 5 Carlos Peón 2017-06-08 11:22:00 UTC
(In reply to Lukáš Nykrýn from comment #4)
> The mentioned code is inside a initscript provided by the iputils package.

I think it's provided by iptables package.

Comment 6 Carlos Peón 2017-06-08 11:25:58 UTC
This patch work for us:

--- iptables.old        2017-06-08 13:18:26.680973312 +0200
+++ iptables    2017-06-08 13:18:39.896022411 +0200
@@ -187,7 +187,7 @@
         echo -n $"Loading sysctl settings: "
         ret=0
         for item in $IPTABLES_SYSCTL_LOAD_LIST; do
-            fgrep $item /etc/sysctl.conf | sysctl -p - >/dev/null
+            fgrep -hs $item /etc/sysctl.conf /etc/sysctl.d/*.conf | sysctl -p - >/dev/null
             let ret+=$?;
         done
         [ $ret -eq 0 ] && success || failure


The same code exists in rhel7, iptables-services package, /usr/libexec/iptables/iptables.init file.

Comment 7 Sergi Jimenez Romero 2017-06-08 15:31:31 UTC
(In reply to Carlos Peón from comment #5)
> (In reply to Lukáš Nykrýn from comment #4)
> > The mentioned code is inside a initscript provided by the iputils package.
> 
> I think it's provided by iptables package.

I confirm that:

$ rpm -qf /etc/init.d/iptables 
iptables-1.4.7-16.el6.x86_64

Comment 11 Phil Sutter 2017-10-06 11:25:21 UTC
Already fixed in RHEL7 via bz#1402021. Same solution applies here with one exception: RHEL6 doesn't ship a symlink from /etc/sysctl.d/99-sysctl.conf to /etc/sysctl.conf, so the grep command needs to explicitly search /etc/sysctl.conf as well.

Comment 24 errata-xmlrpc 2018-06-19 05:08:46 UTC
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