Description of problem: When I try to connect my computer to Internet using a TP-Link wifi dongle, sometimes it gets successfully connected but most of the time it doesn't. I have dual boot system, one is this new Fedora22 and other one is Windows 7. I am able to connect through this wifi device on Windows all the time but on Linux it works sometimes only. SELinux is preventing NetworkManager from 'unlink' accesses on the file /etc/resolv.conf. ***** Plugin restorecon (94.8 confidence) suggests ************************ If you want to fix the label. /etc/resolv.conf default label should be net_conf_t. Then you can run restorecon. Do # /sbin/restorecon -v /etc/resolv.conf ***** Plugin catchall_labels (5.21 confidence) suggests ******************* If you want to allow NetworkManager to have unlink access on the resolv.conf file Then you need to change the label on /etc/resolv.conf Do # semanage fcontext -a -t FILE_TYPE '/etc/resolv.conf' where FILE_TYPE is one of the following: NetworkManager_etc_rw_t, NetworkManager_tmp_t, NetworkManager_var_lib_t, NetworkManager_var_run_t, dhcpc_state_t, dhcpc_var_run_t, dnsmasq_var_run_t, hostname_etc_t, named_cache_t, net_conf_t, pppd_var_run_t, systemd_passwd_var_run_t. Then execute: restorecon -v '/etc/resolv.conf' ***** Plugin catchall (1.44 confidence) suggests ************************** If you believe that NetworkManager should be allowed unlink access on the resolv.conf file by default. Then you should report this as a bug. You can generate a local policy module to allow this access. Do allow this access for now by executing: # grep NetworkManager /var/log/audit/audit.log | audit2allow -M mypol # semodule -i mypol.pp Additional Information: Source Context system_u:system_r:NetworkManager_t:s0 Target Context unconfined_u:object_r:etc_t:s0 Target Objects /etc/resolv.conf [ file ] Source NetworkManager Source Path NetworkManager Port <Unknown> Host (removed) Source RPM Packages Target RPM Packages Policy RPM selinux-policy-3.13.1-128.16.fc22.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name (removed) Platform Linux (removed) 4.2.3-200.fc22.x86_64+debug #1 SMP Thu Oct 8 03:09:19 UTC 2015 x86_64 x86_64 Alert Count 23 First Seen 2015-10-21 10:14:27 IST Last Seen 2015-10-26 23:36:58 IST Local ID 7da0f16f-de55-4b24-b360-fb2bf50a4846 Raw Audit Messages type=AVC msg=audit(1445882818.391:751): avc: denied { unlink } for pid=816 comm="NetworkManager" name="resolv.conf" dev="dm-1" ino=1450912 scontext=system_u:system_r:NetworkManager_t:s0 tcontext=unconfined_u:object_r:etc_t:s0 tclass=file permissive=0 Hash: NetworkManager,NetworkManager_t,etc_t,file,unlink Version-Release number of selected component: selinux-policy-3.13.1-128.16.fc22.noarch Additional info: reporter: libreport-2.6.2 hashmarkername: setroubleshoot kernel: 4.2.3-200.fc22.x86_64+debug type: libreport Potential duplicate: bug 666454
***** Plugin restorecon (94.8 confidence) suggests ************************ If you want to fix the label. /etc/resolv.conf default label should be net_conf_t. Then you can run restorecon. Do # /sbin/restorecon -v /etc/resolv.conf
(In reply to Daniel Walsh from comment #1) > ***** Plugin restorecon (94.8 confidence) suggests > ************************ > > If you want to fix the label. > /etc/resolv.conf default label should be net_conf_t. > Then you can run restorecon. > Do > # /sbin/restorecon -v /etc/resolv.conf How to set default label to net_conf_t? Well what I did try previously was to run restorecon(without changing the default label since I have no idea about 'labels?') but it didn't work. Output was: restorecon reset /etc/resolv.conf context unconfined_u:object_r:etc_t:s0->unconfined_u:object_r:net_conf_t:s0 This notification "SELinux preventing..." is received sometimes only. Thank you Daniel Walsh.
The question is how did it get mislabeled in the first place. What process is creating /etc/resolv.conf and how is it doing it. Most likely the tool is creating a tmp file in /etc and then renaming it. If a user just created /etc/resolv.conf it will get labeled correctly. mv /etc/resolv.conf /etc/resolv.conf.old touch /etc/resolv.conf ls -lZ /etc/resolv.conf Should be labeled net_conf_t. But if you did touch /etc/resolv.conf.foobar mv /etc/resolv.conf.foobar /etc/resolv.conf ls -lZ /etc/resolv.conf Will end up labeled etc_t.