Bug 1024308

Summary: SELinux is preventing /usr/sbin/lightdm from 'unlink' accesses on the file /home/brian/.xsession-errors.old.
Product: [Fedora] Fedora Reporter: Brian J. Murrell <brian>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: dominick.grift, dwalsh, lvrabec, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:5267e6649b619449fc869e8d3564651e2638e3e9350853f0a3fc4a6b0b73366f
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-10-29 11:37:52 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Brian J. Murrell 2013-10-29 11:20:38 UTC
Description of problem:
Logging in.  For reference:

[brian@pc ~]$ ls -lZ  /home/brian/.xsession-errors*
-rw-------. brian brian system_u:object_r:xdm_home_t:s0  /home/brian/.xsession-errors
-rw-------. brian brian system_u:object_r:file_t:s0      /home/brian/.xsession-errors.old
SELinux is preventing /usr/sbin/lightdm from 'unlink' accesses on the file /home/brian/.xsession-errors.old.

*****  Plugin restorecon (82.4 confidence) suggests  *************************

If you want to fix the label. 
/home/brian/.xsession-errors.old default label should be xdm_home_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /home/brian/.xsession-errors.old

*****  Plugin file (7.05 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin file (7.05 confidence) suggests  *******************************

If you think this is caused by a badly mislabeled machine.
Then you need to fully relabel.
Do
touch /.autorelabel; reboot

*****  Plugin catchall_labels (4.59 confidence) suggests  ********************

If you want to allow lightdm to have unlink access on the .xsession-errors.old file
Then you need to change the label on /home/brian/.xsession-errors.old
Do
# semanage fcontext -a -t FILE_TYPE '/home/brian/.xsession-errors.old'
where FILE_TYPE is one of the following: auth_cache_t, auth_home_t, cache_home_t, cgroup_t, config_home_t, data_home_t, dbus_home_t, etc_runtime_t, faillog_t, fonts_cache_t, gconf_home_t, gkeyringd_tmp_t, gnome_home_t, gstreamer_home_t, icc_data_home_t, krb5_host_rcache_t, locale_t, mozilla_plugin_tmpfs_t, pam_var_console_t, pam_var_run_t, systemd_passwd_var_run_t, user_fonts_t, user_home_t, user_tmp_t, user_tmpfs_t, var_auth_t, xauth_home_t, xdm_home_t, xdm_lock_t, xdm_log_t, xdm_rw_etc_t, xdm_spool_t, xdm_tmp_t, xdm_tmpfs_t, xdm_var_lib_t, xdm_var_run_t, xkb_var_lib_t, xserver_log_t. 
Then execute: 
restorecon -v '/home/brian/.xsession-errors.old'


*****  Plugin catchall (1.31 confidence) suggests  ***************************

If you believe that lightdm should be allowed unlink access on the .xsession-errors.old 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 lightdm /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:xdm_t:s0-s0:c0.c1023
Target Context                system_u:object_r:file_t:s0
Target Objects                /home/brian/.xsession-errors.old [ file ]
Source                        lightdm
Source Path                   /usr/sbin/lightdm
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           lightdm-1.6.2-1.fc19.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-74.9.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.11.4-201.fc19.x86_64 #1 SMP Thu
                              Oct 10 14:11:18 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-10-29 07:13:26 EDT
Last Seen                     2013-10-29 07:13:26 EDT
Local ID                      3d1a2f31-c130-45a7-9734-22297ff270e8

Raw Audit Messages
type=AVC msg=audit(1383045206.799:502): avc:  denied  { unlink } for  pid=17657 comm="lightdm" name=".xsession-errors.old" dev="dm-5" ino=175426 scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:file_t:s0 tclass=file


type=SYSCALL msg=audit(1383045206.799:502): arch=x86_64 syscall=rename success=no exit=EACCES a0=dd9680 a1=ddb2b0 a2=da92e0 a3=38f301b2e0 items=0 ppid=17604 pid=17657 auid=1001 uid=1001 gid=1001 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 ses=29 tty=(none) comm=lightdm exe=/usr/sbin/lightdm subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)

Hash: lightdm,xdm_t,file_t,file,unlink

Additional info:
reporter:       libreport-2.1.8
hashmarkername: setroubleshoot
kernel:         3.11.4-201.fc19.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-10-29 11:37:52 UTC
You will need to fix labeling.

$ restorecon -R -v ~/

Comment 2 Brian J. Murrell 2013-10-30 02:24:18 UTC
I think the point here is how did /home/brian/.xsession-errors.old get unlabeled considering it's a file that lightdm would have created?