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 1551078

Summary: "firewall-cmd --add-interface" is adding an interface permanently to a zone even if "--permanent" is not mentioned
Product: Red Hat Enterprise Linux 7 Reporter: Venkatesh Kavtikwar <vkavtikw>
Component: firewalldAssignee: Eric Garver <egarver>
Status: CLOSED ERRATA QA Contact: Jiri Peska <jpeska>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: ajohn, jmaxwell, jpeska, sababu, todoleza, vkavtikw
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: firewalld-0.6.3-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 12:03:14 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: 1637204    
Bug Blocks: 1654714    

Description Venkatesh Kavtikwar 2018-03-02 17:10:41 UTC
Description of problem:

1. "firewall-cmd --add-interface" is adding an interface permanently to a zone even if "--permanent" is not mentioned
2. When we add a interface without "--permanent" option it gets added permanently but does not gets listed under

# firewall-cmd --list-interfaces --zone=trusted --permanent 


Version-Release number of selected component (if applicable):
firewalld (All versions)

How reproducible:

- Currently there is no interface in "trusted" zone

# firewall-cmd --list-interfaces --zone=trusted                       -- no output
# firewall-cmd --list-interfaces --zone=trusted --permanent           -- no output


- ens8 interface is added without "--permanent" option

# firewall-cmd --add-interface=ens8 --zone=trusted 
success

# firewall-cmd --list-interfaces --zone=trusted 
ens8

# firewall-cmd --list-interfaces --zone=trusted --permanent            -- no output


- ens9 interface is added with "--permanent" option

# firewall-cmd --add-interface=ens9 --zone=trusted --permanent
success

# firewall-cmd --reload 
success

# firewall-cmd --list-interfaces --zone=trusted 
ens9 ens8

# firewall-cmd --list-interfaces --zone=trusted --permanent
ens9


Actual results:

1. "firewall-cmd --add-interface" is adding an interface permanently to a zone even if "--permanent" is not mentioned
2. When we add a interface without "--permanent" option it gets added permanently but does not gets listed under


Expected results:

1. When "--permanent" option is not mentioned  "firewall-cmd --add-interface" should add the interface temporarily.


Additional info:

Could you please verify whether this is a expected behaviour??

Comment 2 Eric Garver 2018-03-20 17:25:00 UTC
firewalld deliberately retains some information during a --reload. Examples; interface to zone assignment, direct rules.

I believe this is done for uses cases such as libvirt, which will create temporary interfaces and direct rules depending on VM utilization. Otherwise reloading the firewall would remove those VM interfaces from zones potentially dropping all traffic to the VM.

Perhaps this just needs a documentation update. What do you think?

--->8---

    def reload(self, stop=False):
        _panic = self._panic

        # save zone interfaces
        _zone_interfaces = { }
        for zone in self.zone.get_zones():
            _zone_interfaces[zone] = self.zone.get_settings(zone)["interfaces"]
        # save direct config
        _direct_config = self.direct.get_runtime_config()
        _old_dz = self.get_default_zone()

Comment 3 Sangam 2018-03-22 19:30:02 UTC
Hello Eric,

Thanks for your reply, but I am not able to parse it completely. Could you please help me understand it more why is that?

My concern here is that when we add a interface against a zone without enabling "--permanent" flag, the interface stays with that zone even after firewall reload or system reboot.

Comment 4 Eric Garver 2018-03-22 20:08:16 UTC
(In reply to Sangam from comment #3)
> Hello Eric,
> 
> Thanks for your reply, but I am not able to parse it completely. Could you
> please help me understand it more why is that?

Some things that use firewalld expect and depend upon this behavior. Virtual machines are one example.

> 
> My concern here is that when we add a interface against a zone without
> enabling "--permanent" flag, the interface stays with that zone even after
> firewall reload or system reboot.

It will stay after a --reload, but not after a reboot or `systemctl restart firewalld`.

Comment 14 Eric Garver 2018-07-19 15:25:53 UTC
fixed upstream:

  d74304e2ff61 ("firewall-cmd: For non-permanent interface changes don't involve NM")

Comment 19 errata-xmlrpc 2019-08-06 12:03:14 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-2019:2024