Bug 496246 - SELinux is preventing nm-system-setti (NetworkManager_t) "write" to ifcfg-eth0 (etc_t).
SELinux is preventing nm-system-setti (NetworkManager_t) "write" to ifcfg-eth...
Status: CLOSED DUPLICATE of bug 497278
Product: Fedora
Classification: Fedora
Component: selinux-policy (Show other bugs)
rawhide
All Linux
low Severity medium
: ---
: ---
Assigned To: Daniel Walsh
Fedora Extras Quality Assurance
:
Depends On:
Blocks: F11Target
  Show dependency treegraph
 
Reported: 2009-04-17 10:21 EDT by Mary Ellen Foster
Modified: 2009-04-23 16:05 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-04-23 16:05:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Mary Ellen Foster 2009-04-17 10:21:44 EDT
Description of problem:
NetworkManager always needs to be told to connect on eth0, and I wanted to make that automatic. I went to "Edit connections", double clicked on "System eth0" (which incidentally says I've never connected to it even though I'm using it right now), checked the "Connect automatically" box, and hit "Save".

Then I got a dialogue box saying:
    Could not update connection

    Can't write connection '/etc/sysconfig/network-scripts/ifcfg-eth0'

Here are the permissions on that file:
-rw-r--r--. 3 root root 154 2009-04-16 23:21 /etc/sysconfig/network-scripts/ifcfg-eth0

Version-Release number of selected component (if applicable):
NetworkManager-0.7.1-2.git20090414.fc11.i586


Additional info:

When I re-open the "Edit connections" dialogue for eth0, the "Connect automatically" box is now checked, but I haven't yet tried to see whether that actually happens if I log out and back in.
Comment 1 Niels Haase 2009-04-17 16:19:57 EDT
Thanks for filling this bug.
Unfortunately  I'm not able to reproduce this bug (same version, but under x86_x64, same permissions). 
Anyway, if you want that the eth0 interface is connect automatic you can set the ONBOOT=yes option in the /etc/sysconfig/network-scripts/ifcfg-eth0 file. 

-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 2 Mary Ellen Foster 2009-04-20 05:19:55 EDT
I just did a fresh reinstall --- x86_64 this time -- and I'm seeing the same thing. I don't want it to necessarily come up on *boot* -- is that what the checkbox means? -- but I do want it to connect automatically when I log in like it does to wireless networks that are saved automatically. At the moment, I always have to manually select "System eth0" every time I log in.
Comment 3 Niels Haase 2009-04-20 07:34:37 EDT
(In reply to comment #2)
> I just did a fresh reinstall --- x86_64 this time -- and I'm seeing the same
> thing.
 
Strange, I will try to reproduce it (again). Just for the sake of completeness. You are using rawhide x86_64 (fully updated) with NetworkManager-0.7.1-2.git20090414 on GNOME desktop environment? You are logged in as normal user. If you try to change the settings on "System eth0" you get an error message. If there a padlock on the edit button that's require your root password?

> I don't want it to necessarily come up on *boot* -- is that what the
> checkbox means?

Yes

> -- but I do want it to connect automatically when I log in like
> it does to wireless networks that are saved automatically. 

The wireless device should also have the option ONBOOT=yes. But the connection will get online only when you login in GNOME because here is the keyring with the necessary passphrases for WEP/WPA are saved. If you set it to ONBOOT=no, you must explicit choose the WLAN you would connect per click on it after you logged in.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 4 Mary Ellen Foster 2009-04-20 07:45:18 EDT
(In reply to comment #3)
> Just for the sake of completeness.
> You are using rawhide x86_64 (fully updated)

Yes.

> with NetworkManager-0.7.1-2.git20090414

Actually, it's NetworkManager-0.7.1-3.git20090414

> on GNOME desktop environment?

No -- I'm using KDE. Sorry, I should have mentioned this -- may well be relevant! :)

> You are logged in as normal user.

Yes.

> If you try to change the settings on "System eth0" you get
> an error message.

Yes. And, newly, I also get an selinux denial:
"SELinux is preventing nm-system-setti (NetworkManager_t) "write" to ifcfg-eth0 (etc_t)."

Note that the "start automatically" check now seems to stay enabled and it may well be coming up automatically, although I haven't rebooted yet today so this may still not stick.

> If there a padlock on the edit button that's require your
> root password?

I entered my root password once the first time I did this and set it to "remember", as far as I recall.
Comment 5 Niels Haase 2009-04-21 04:03:23 EDT
Hello,

the NetworkManager release 0.7.1-2.git20090414 include the possibility to change the "eth system" connection dirctly (without the usage of s-c-n): 

Tue Apr 14 2009 Dan Williams <dcbw@redhat.com> - 1:0.7.1-2.git20090414 - ifcfg-rh: enable write support for wired and wifi connections 

You need to enter your root password, to do the change but it seams that SELinux blocks the writing attempt to the config file (/etc/network-scripts/ifcfg-eth0). Please find below the complete SELinux message from AVC:

I'm not sure about the priority for a fix about the frozen zone with F11, but I set this bug to F11Target. Please feel free to remove it if you disagree my suggestion. Thanks for you help with this.

Changing title to reflect the SELinux relevance and also assign to selinux-policy package.

Summary:

SELinux is preventing nm-system-setti (NetworkManager_t) "write" to ifcfg-eth0
(etc_t).

Detailed Description:

SELinux is preventing nm-system-setti (NetworkManager_t) "write" to ifcfg-eth0
(etc_t). The SELinux type etc_t, is a generic type for all files in the
directory and very few processes (SELinux Domains) are allowed to write to this
SELinux type. This type of denial usual indicates a mislabeled file. By default
a file created in a directory has the gets the context of the parent directory,
but SELinux policy has rules about the creation of directories, that say if a
process running in one SELinux Domain (D1) creates a file in a directory with a
particular SELinux File Context (F1) the file gets a different File Context
(F2). The policy usually allows the SELinux Domain (D1) the ability to write,
unlink, and append on (F2). But if for some reason a file (ifcfg-eth0) was
created with the wrong context, this domain will be denied. The usual solution
to this problem is to reset the file context on the target file, restorecon -v
'ifcfg-eth0'. If the file context does not change from etc_t, then this is
probably a bug in policy. Please file a bug report
(http://bugzilla.redhat.com/bugzilla/enter_bug.cgi) against the selinux-policy
package. If it does change, you can try your application again to see if it
works. The file context could have been mislabeled by editing the file or moving
the file from a different directory, if the file keeps getting mislabeled, check
the init scripts to see if they are doing something to mislabel the file.

Allowing Access:

You can attempt to fix file context by executing restorecon -v 'ifcfg-eth0'

Fix Command:

restorecon 'ifcfg-eth0'

Additional Information:

Source Context                system_u:system_r:NetworkManager_t:s0-s0:c0.c1023
Target Context                system_u:object_r:etc_t:s0
Target Objects                ifcfg-eth0 [ file ]
Source                        nm-system-setti
Source Path                   /usr/sbin/nm-system-settings
Port                          <Unknown>
Host                          localhost.localdomain
Source RPM Packages           NetworkManager-0.7.1-3.git20090414.fc11
Target RPM Packages           
Policy RPM                    selinux-policy-3.6.12-2.fc11
Selinux Enabled               True
Policy Type                   targeted
MLS Enabled                   True
Enforcing Mode                Enforcing
Plugin Name                   mislabeled_file
Host Name                     localhost.localdomain
Platform                      Linux localhost.localdomain
                              2.6.29.1-54.fc11.x86_64 #1 SMP Tue Apr 7 05:26:42
                              EDT 2009 x86_64 x86_64
Alert Count                   1
First Seen                    Tue 21 Apr 2009 09:40:24 AM CEST
Last Seen                     Tue 21 Apr 2009 09:40:24 AM CEST
Local ID                      0b8b5da1-88f0-4b6e-bc31-491970dda68c
Line Numbers                  

Raw Audit Messages            

node=localhost.localdomain type=AVC msg=audit(1240299624.17:18697): avc:  denied  { write } for  pid=1800 comm="nm-system-setti" name="ifcfg-eth0" dev=dm-0 ino=131111 scontext=system_u:system_r:NetworkManager_t:s0-s0:c0.c1023 tcontext=system_u:object_r:etc_t:s0 tclass=file

node=localhost.localdomain type=SYSCALL msg=audit(1240299624.17:18697): arch=c000003e syscall=2 success=no exit=-13 a0=2105c00 a1=41 a2=1a4 a3=1 items=0 ppid=1 pid=1800 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="nm-system-setti" exe="/usr/sbin/nm-system-settings" subj=system_u:system_r:NetworkManager_t:s0-s0:c0.c1023 key=(null)



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 6 Daniel Walsh 2009-04-21 10:16:09 EDT
This is a mislabeled file

restroecon -R -v /etc/sysconfig

Should fix the labeling.

Not sure how it got mislabeled.  system-config-network Might be the problem or editing?
Comment 7 Daniel Walsh 2009-04-21 10:16:42 EDT
# matchpathcon /etc/sysconfig/network-scripts/ifcfg-eth0 
/etc/sysconfig/network-scripts/ifcfg-eth0	system_u:object_r:net_conf_t:s0
Comment 8 Niels Haase 2009-04-22 01:46:12 EDT
Reporter, could you please try the above mentioned command from Daniel.
(comment #6)
 
> restroecon -R -v /etc/sysconfig
 
And give us a feedback it if solves the problem? Thank you.



-- 
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Comment 9 Mary Ellen Foster 2009-04-22 04:49:10 EDT
I'm travelling and can't test this until Sunday evening, so if someone else can test before then that would be great.
Comment 10 Niels Haase 2009-04-23 16:05:52 EDT

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

Note You need to log in before you can comment on or make changes to this bug.