Bug 929340

Summary: SELinux is preventing /usr/bin/kdm from 'create' accesses on the file .xsession-errors-:0.
Product: [Fedora] Fedora Reporter: Peter Trenholme <PTrenholme>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: awilliam, dominick.grift, dwalsh, ipilcher, lvrabec, mgrepl, robatino, tchollingsworth
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:53647c0d03f5dfc7ba401b56e376717d5bb459af6a520603dca13bc8e418fc13 AcceptedFreezeException
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-04-19 05:54:48 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 834085, 834090    

Description Peter Trenholme 2013-03-29 18:30:37 UTC
Description of problem:
Start a user session in KDE using the KDM.

Since a user session nees to be able to create (and read, write, and delete) the sesson errors file.
this is a likely oversight in the latest targeted file, eh?
SELinux is preventing /usr/bin/kdm from 'create' accesses on the file .xsession-errors-:0.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that kdm should be allowed create access on the .xsession-errors-:0 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 kdm /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:user_home_t:s0
Target Objects                .xsession-errors-:0 [ file ]
Source                        kdm
Source Path                   /usr/bin/kdm
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           kdm-4.10.1-2.fc20.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.12.1-24.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.0-0.rc4.git0.1.fc19.x86_64 #1
                              SMP Mon Mar 25 02:31:02 UTC 2013 x86_64 x86_64
Alert Count                   7
First Seen                    2013-03-26 15:52:16 PDT
Last Seen                     2013-03-29 10:25:26 PDT
Local ID                      fb826867-f552-430a-b1aa-e1bbc1879107

Raw Audit Messages
type=AVC msg=audit(1364577926.921:455): avc:  denied  { create } for  pid=2153 comm="kdm" name=".xsession-errors-:0" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:user_home_t:s0 tclass=file


type=SYSCALL msg=audit(1364577926.921:455): arch=x86_64 syscall=open success=no exit=EACCES a0=e3c260 a1=4c1 a2=180 a3=0 items=0 ppid=2103 pid=2153 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 ses=2 tty=(none) comm=kdm exe=/usr/bin/kdm subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)

Hash: kdm,xdm_t,user_home_t,file,create

audit2allow

#============= xdm_t ==============
allow xdm_t user_home_t:file create;

audit2allow -R
require {
	type xdm_t;
}

#============= xdm_t ==============
mta_mailserver_delivery(xdm_t)


Additional info:
hashmarkername: setroubleshoot
kernel:         3.9.0-0.rc4.git0.1.fc19.x86_64
type:           libreport

Potential duplicate: bug 922155

Comment 1 Daniel Walsh 2013-04-01 13:56:07 UTC
Fixed in selinux-policy-3.12.1-25.fc19.noarch

Comment 2 Adam Williamson 2013-04-05 20:08:04 UTC
Description of problem:
AVC shows up just on install and reboot to installed system with F19 Alpha TC5 KDE live, no user interaction needed.

Additional info:
hashmarkername: setroubleshoot
kernel:         3.9.0-0.rc4.git0.1.fc19.x86_64
type:           libreport

Comment 3 Fedora Update System 2013-04-08 11:43:18 UTC
selinux-policy-3.12.1-28.fc19 has been submitted as an update for Fedora 19.
https://admin.fedoraproject.org/updates/FEDORA-2013-5045/selinux-policy-3.12.1-28.fc19

Comment 4 Fedora Update System 2013-04-08 15:55:01 UTC
Package selinux-policy-3.12.1-28.fc19:
* should fix your issue,
* was pushed to the Fedora 19 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-28.fc19'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-5045/selinux-policy-3.12.1-28.fc19
then log in and leave karma (feedback).

Comment 5 Adam Williamson 2013-04-12 21:18:42 UTC
Proposing as a final release blocker: "In most cases, there must be no SELinux 'AVC: denied' messages or abrt crash notifications on initial boot and subsequent login (see Blocker_Bug_FAQ) ". Also AlphaFreezeException, kind of as a proxy - I think it would be good to get the latest selinux-policy into Alpha now we slipped, it fixes an awful lot of restrictions and doesn't tighten anything down, so it should be safe and reduce the number of AVCs we see in install and post-install testing.

Comment 6 Dennis Gilmore 2013-04-12 21:22:37 UTC
+1 to getting in Alpha

Comment 7 Andre Robatino 2013-04-12 21:40:42 UTC
+1 for AlphaFreezeException

Comment 8 Adam Williamson 2013-04-12 21:47:02 UTC
That's +3, setting Accepted.

Comment 9 Fedora Update System 2013-04-19 05:54:51 UTC
selinux-policy-3.12.1-28.fc19 has been pushed to the Fedora 19 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Ian Pilcher 2013-10-21 15:34:29 UTC
I am getting this denial with selinux-policy-targeted-3.12.1-74.9.fc19.noarch when I log in remotely (with VNC) to a MATE session.

I am using KDM with XDMCP.

Here are the detailed audit messages:

type=SYSCALL msg=audit(1382105196.159:1328): arch=c000003e syscall=2 success=no exit=-13 a0=7f7e27496990 a1=4c1 a2=180 a3=ffffffe0 items=0 ppid=31738 pid=31756 auid=1000 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 ses=106 tty=(none) comm="kdm" exe="/usr/bin/kdm" subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)

type=AVC msg=audit(1382105196.159:1328): avc:  denied  { create } for  pid=31756 comm="kdm" name=".xsession-errors-localhost:10" scontext=system_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=system_u:object_r:user_home_t:s0 tclass=file

Comment 11 Daniel Walsh 2013-10-22 17:44:22 UTC
Do you have the xdm_write_home boolean turned on?

# setsebool -P xdm_write_home 1

If it exists in F19...

Comment 12 Ian Pilcher 2013-10-22 18:07:01 UTC
(In reply to Daniel Walsh from comment #11)
> Do you have the xdm_write_home boolean turned on?
> 
> # setsebool -P xdm_write_home 1
> 
> If it exists in F19...

It does exist in F19, and it wasn't turned on.  Not sure why I didn't think to look for a relevant boolean.

I just double-checked, and SETroubleshoot didn't mention that boolean in its output.  Should I file a bug against setroubleshoot-plugins?

Comment 13 Daniel Walsh 2013-10-24 18:27:05 UTC
Might have been a boolean we created in Fedora 20

Comment 14 Miroslav Grepl 2013-10-25 06:45:47 UTC
Yes, it was created just in F20. 

Lukas,
could you back port it.

Comment 15 Ian Pilcher 2013-10-25 06:52:58 UTC
(In reply to Miroslav Grepl from comment #14)
> Yes, it was created just in F20. 
> 
> Lukas,
> could you back port it.

Just to make sure everyone is on the same page, the boolean is definitely present on my F19 system:

  [pilcher@ian ~]$ getsebool xdm_write_home
  xdm_write_home --> off
  [pilcher@ian ~]$ cat /etc/fedora-release
  Fedora release 19 (Schrödinger’s Cat)
  [pilcher@ian ~]$ rpm -q selinux-policy-targeted
  selinux-policy-targeted-3.12.1-74.10.fc19.noarch

Are you talking about enhancing SETroubleshoot to tell people about this boolean when the relevant AVC occurs?

Comment 16 Miroslav Grepl 2013-10-25 07:38:57 UTC
OK, You are right. The boolean has been back ported.