Bug 1358217

Summary: firewalld errors when writing ifcfg files
Product: Red Hat Enterprise Linux 7 Reporter: Beniamino Galvani <bgalvani>
Component: firewalldAssignee: Thomas Woerner <twoerner>
Status: CLOSED DUPLICATE QA Contact: Tomas Dolezal <todoleza>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: todoleza
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-20 13:50:43 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:

Description Beniamino Galvani 2016-07-20 09:53:15 UTC
Description of problem:

On RHEL 7.3 firewalld prints some errors while trying to write to
ifcfg files in /etc/sysconfig/network-scripts/:

firewalld[15502]: ERROR: Failed to open temporary file: [Errno 13] Permission denied: '/etc/sysconfig/network-scripts/ifcfg-connie.TOf4_T'
firewalld[15502]: ERROR: Calling post func <function ifcfg_set_zone_of_interface at 0x7f86276846e0>(('', 'eth6')) failed: [Errno 13] Permission denied: '/etc/sysconfig/network-scripts/ifcfg-connie.TOf4_T'

This is probably caused by the following SELinux denial:

type=SYSCALL msg=audit(1469005938.730:189): arch=c000003e syscall=2 success=no exit=-13 a0=1a1ecc0 a1=200c2 a2=180 a3=67666366692f7374 items=0 ppid=1 pid=15502 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=($
type=AVC msg=audit(1469005938.730:189): avc:  denied  { write } for  pid=15502 comm="firewalld" path="/etc/sysconfig/network-scripts/ifcfg-connie.TOf4_T" dev="dm-0" ino=51616668 scontext=system_u:system_r:firewalld_t:s0 tcontext=system_u$

But apart from this, what is the reason for firewalld to update ifcfg
files? NetworkManager reads the firewall zone from the ifcfg files and
then calls firewalld D-Bus methods to update the zone, so it seems not
necessary for firewalld to update the connection files.

Except of logs:

05:37:58 NetworkManager[15308]: <debug> [1469007478.9296] device[0x7fbec3ddd320] (eth6): running queued state change to disconnected (id 3812)
05:37:58 NetworkManager[15308]: <info>  [1469007478.9296] device (eth6): state change: deactivating -> disconnected (reason 'new-activation') [110 30 60]
05:37:58 NetworkManager[15308]: <debug> [1469007478.9296] device[0x7fbec3ddd320] (eth6): will enable userland IPv6LL
05:37:58 NetworkManager[15308]: <debug> [1469007478.9297] platform-linux: link: change 8: user-ipv6ll: set IPv6 address generation mode to none
05:37:58 NetworkManager[15308]: <debug> [1469007478.9300] platform-linux: do-request-link: 8
05:37:58 NetworkManager[15308]: <debug> [1469007478.9303] platform-linux: do-change-link[8]: success changing link: success
05:37:58 NetworkManager[15308]: <debug> [1469007478.9307] platform-linux: sysctl: setting '/proc/sys/net/ipv6/conf/eth6/disable_ipv6' to '1' (current value is '0')
05:37:58 NetworkManager[15308]: <debug> [1469007478.9310] platform-linux: sysctl: setting '/proc/sys/net/ipv6/conf/eth6/disable_ipv6' to '0' (current value is '1')
05:37:58 NetworkManager[15308]: <debug> [1469007478.9311] device[0x7fbec3ddd320] (eth6): deactivating device (reason 'new-activation') [60]
05:37:58 NetworkManager[15308]: <debug> [1469007478.9315] firewall: [0x7fbec3e5a0c0,remove:"eth6"]: firewall zone remove eth6:default
05:37:58 NetworkManager[15308]: <debug> [1469007478.9316] device[0x7fbec3ddd320] (eth6): remove_pending_action (3): 'dhcp4' not pending (expected)
05:37:58 NetworkManager[15308]: <debug> [1469007478.9323] kill child process 'dhcp-client-eth6' (16697): waiting up to 500 milliseconds for process to terminate normally after sending SIGTERM (15)...
05:37:58 firewalld[16613]: ERROR: Failed to open temporary file: [Errno 13] Permission denied: '/etc/sysconfig/network-scripts/ifcfg-connie.QdLW36'
05:37:58 firewalld[16613]: ERROR: Calling post func <function ifcfg_set_zone_of_interface at 0x7f1ce1a756e0>(('', 'eth6')) failed: [Errno 13] Permission denied: '/etc/sysconfig/network-scripts/ifcfg-connie.QdLW36'


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

firewalld-0.4.3.2-1.el7.noarch
RHEL 7.3


How reproducible:

The problem is always reproducible in NetworkManager automated tests when a connection specifying a firewall zone is activated/deactivated.

Comment 2 Tomas Dolezal 2016-07-20 13:50:43 UTC
> But apart from this, what is the reason for firewalld to update ifcfg
> files? NetworkManager reads the firewall zone from the ifcfg files and
> then calls firewalld D-Bus methods to update the zone, so it seems not
> necessary for firewalld to update the connection files.
The zone is newly stored only in one place to prevent duplication and configuration errors. Because NetworkManager don't need to be running or there could be an interface which is not NM_CONTROLLED, firewalld needs to write this information on its own. It also uses dbus api to do this.

closing as duplicate of already existing selinux bug 1304723

*** This bug has been marked as a duplicate of bug 1304723 ***