Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to commit runtime zone change to config #890

Open
Vogtinator opened this issue Nov 26, 2021 · 5 comments
Open

Unable to commit runtime zone change to config #890

Vogtinator opened this issue Nov 26, 2021 · 5 comments
Labels
medium Medium priority bug.
Projects

Comments

@Vogtinator
Copy link

After adding a custom zone and moving an interface to it, which was previously by default in the public zone, --runtime-to-permanent fails.

How to reproduce it (as minimally and precisely as possible):

# firewall-cmd --permanent --new-zone=my-external
success
# firewall-cmd --reload
success
# firewall-cmd --zone=my-external --change-interface=ens4
success
# firewall-cmd --runtime-to-permanent
Error: RT_TO_PERM_FAILED

The journal shows:

Nov 26 07:59:40 susetest firewalld[3500]: ERROR: ZONE_CONFLICT: ens4public
Nov 26 07:59:40 susetest firewalld[3500]: WARNING: Runtime To Permanent failed on zone 'my-external': org.fedoraproject.FirewallD1.Exception: ZONE_CONFLICT: ens4public
Nov 26 07:59:40 susetest firewalld[3500]: ERROR: RT_TO_PERM_FAILED

The full firewalld log with --debug=1 is attached: firewalld.log

I added the conflicting zone to the exception message, so it's visible that during copy of the my-external zone, the check for duplication fails because ens4 is still assigned to the public zone.

Anything else we need to know?:

Environment:

  • Firewalld Version: 1.0.2
  • Firewalld Backend (cat /etc/firewalld/firewalld.conf | grep FirewallBackend): nftables
  • OS (e.g: cat /etc/os-release): openSUSE Tumbleweed 20211124
Vogtinator added a commit to Vogtinator/os-autoinst-distri-opensuse that referenced this issue Nov 26, 2021
…anent

It fails to write a runtime zone change to the permanent config:
firewalld/firewalld#890
Vogtinator added a commit to Vogtinator/os-autoinst-distri-opensuse that referenced this issue Nov 26, 2021
…anent

It fails to write a runtime zone change to the permanent config:
firewalld/firewalld#890
Vogtinator added a commit to Vogtinator/os-autoinst-distri-opensuse that referenced this issue Nov 26, 2021
…anent

It fails to write a runtime zone change to the permanent config:
firewalld/firewalld#890
Vogtinator added a commit to Vogtinator/os-autoinst-distri-opensuse that referenced this issue Nov 29, 2021
…anent

It fails to write a runtime zone change to the permanent config:
firewalld/firewalld#890
Vogtinator added a commit to os-autoinst/os-autoinst-distri-opensuse that referenced this issue Nov 29, 2021
…anent

It fails to write a runtime zone change to the permanent config:
firewalld/firewalld#890
@erig0
Copy link
Collaborator

erig0 commented Dec 1, 2021

Are you using NetworkManager?

Did you previously assign ens4 to the public zone?
Check the status with:

# firewall-cmd --permanent --get-zone-of-interface ens4

@Vogtinator
Copy link
Author

Are you using NetworkManager?

No.

Did you previously assign ens4 to the public zone?

Yep, implicitly by the system installation:

# firewall-cmd --permanent --get-zone-of-interface ens4
public
# firewall-cmd --get-zone-of-interface ens4
my-external

I just checked the state of the configuration files after running the commands:
/etc/sysconfig/network/ifcfg-ens4 has ZONE=my-external but /etc/firewalld/zones/public.xml has <interface name="ens4"/>. So even though --runtime-to-permanent failed, it appears to have saved some inconsistent configuration. Before running the commands, the ifcfg file had ZONE=public.

lansuse pushed a commit to lansuse/os-autoinst-distri-opensuse that referenced this issue Dec 2, 2021
…anent

It fails to write a runtime zone change to the permanent config:
firewalld/firewalld#890
@erig0
Copy link
Collaborator

erig0 commented Dec 2, 2021

Looks like we should be moving the interface regardless of the existing permanent configuration.
This comment also indicates that may be the case:

for iface in added_ifaces:
if self.parent.getZoneOfInterface(iface):
raise FirewallError(errors.ZONE_CONFLICT, iface) # or move to new zone ?
for source in added_sources:
if self.parent.getZoneOfSource(source):
raise FirewallError(errors.ZONE_CONFLICT, source) # or move to new zone ?

I'll have to investigate this area to make sure it's safe to make said change.

@erig0 erig0 added this to backlog in firewalld via automation Dec 2, 2021
@erig0 erig0 added the medium Medium priority bug. label Dec 2, 2021
@Vogtinator
Copy link
Author

I'll have to investigate this area to make sure it's safe to make said change.

As long as it correctly removes the old zone assignment that should be fine FWICT - otherwise the runtime configuration would be broken as well.

@erig0
Copy link
Collaborator

erig0 commented Dec 2, 2021

It's a bit more complicated due to NetworkManager and ifcfg files. Since the config move from runtime to permanent it needs to be determined which of those should be updated.
Likely needs to be:

  1. try adding interface to NM, if fails move on to 2, else done
  2. set ZONE in ifcfg-
  3. add interface to firewalld zone's XML config

Of course, we also need to deal with removal from the old zone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
medium Medium priority bug.
Projects
firewalld
  
backlog
Development

No branches or pull requests

2 participants