Description of problem: Editing /etc/mtab with vi to add another mount. Will not save as selinux prevents writing a backup copy. Additional info: libreport version: 2.0.18 kernel: 3.6.10-2.fc17.x86_64 description: :SELinux is preventing /usr/bin/vi from 'relabelto' accesses on the file mtaz~. : :***** Plugin catchall (100. confidence) suggests *************************** : :If you believe that vi should be allowed relabelto access on the mtaz~ 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 vi /var/log/audit/audit.log | audit2allow -M mypol :# semodule -i mypol.pp : :Additional Information: :Source Context unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1 : 023 :Target Context unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1 : 023 :Target Objects mtaz~ [ file ] :Source vi :Source Path /usr/bin/vi :Port <Unknown> :Host (removed) :Source RPM Packages vim-minimal-7.3.682-1.fc17.x86_64 :Target RPM Packages :Policy RPM selinux-policy-3.10.0-161.fc17.noarch :Selinux Enabled True :Policy Type targeted :Enforcing Mode Enforcing :Host Name (removed) :Platform Linux (removed) 3.6.10-2.fc17.x86_64 #1 SMP Tue : Dec 11 18:07:34 UTC 2012 x86_64 x86_64 :Alert Count 8 :First Seen 2013-01-03 11:14:23 SAST :Last Seen 2013-01-03 11:21:48 SAST :Local ID e23dca14-81c0-4243-bd7b-22fd6baa6fc2 : :Raw Audit Messages :type=AVC msg=audit(1357204908.70:79): avc: denied { relabelto } for pid=2310 comm="vi" name="mtaz~" dev="dm-1" ino=72369 scontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=file : : :type=SYSCALL msg=audit(1357204908.70:79): arch=x86_64 syscall=setxattr success=no exit=EACCES a0=c03cf0 a1=3138416b6b a2=c0a140 a3=36 items=0 ppid=1940 pid=2310 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts0 ses=2 comm=vi exe=/usr/bin/vi subj=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 key=(null) : :Hash: vi,unconfined_t,unconfined_t,file,relabelto : :audit2allow : :#============= unconfined_t ============== :allow unconfined_t self:file relabelto; : :audit2allow -R : :#============= unconfined_t ============== :allow unconfined_t self:file relabelto; :
Created attachment 672321 [details] File: type
Created attachment 672322 [details] File: hashmarkername
ls -lZ /etc/mtaz Did you somehow put down a label of unconfined_t?
Hi Daniel No I have not touched this file for months. When it objected to the backup file, I deleted all the mtab backups and tried again with the same result. I got round the problem using system-config-lvm. [root@andys-hm ~]# ls -lZ /etc/mta* lrwxrwxrwx. root root system_u:object_r:etc_t:s0 /etc/mtab -> /proc/mounts -r--r--r--. root root unconfined_u:object_r:etc_t:s0 /etc/mtab~ -r--r--r--. root root unconfined_u:object_r:etc_t:s0 /etc/mtaz~ [root@andys-hm ~]# vi /etc/mtab in vi error when trying :w! "/etc/mtab" E667: Fsync failed WARNING: Original file may be lost or damaged don't quit the editor until the file is successfully written! Press ENTER or type command to continue Hope this helps Regards Andy
Ok I think I understand. vi /etc/mtab points at /proc/mounts which points to /proc/self/mounts which has the process label unconfined_t. vi is trying to preserve the xatts on /etc/mtab, so it attempts to create a backup file /etc/mtaz~ with unconfined_t. SELinux blocks putting a process type on a file, generating the AVC. I guess we can add a dontaudit for this. The failure on saving is because you are not allowed to save a /proc/self/mounts file, it is not a real file.
Added a dontaudit to F19 policy.
Hi Daniel This makes sense. Thanks for the feedback and response. Regards Andy
This message is a reminder that Fedora 17 is nearing its end of life. Approximately 4 (four) weeks from now Fedora will stop maintaining and issuing updates for Fedora 17. It is Fedora's policy to close all bug reports from releases that are no longer maintained. At that time this bug will be closed as WONTFIX if it remains open with a Fedora 'version' of '17'. Package Maintainer: If you wish for this bug to remain open because you plan to fix it in a currently maintained version, simply change the 'version' to a later Fedora version prior to Fedora 17's end of life. Bug Reporter: Thank you for reporting this issue and we are sorry that we may not be able to fix it before Fedora 17 is end of life. If you would still like to see this bug fixed and are able to reproduce it against a later version of Fedora, you are encouraged change the 'version' to a later Fedora version prior to Fedora 17's end of life. Although we aim to fix as many bugs as possible during every release's lifetime, sometimes those efforts are overtaken by events. Often a more recent Fedora release includes newer upstream software that fixes bugs or makes them obsolete.