Bug 1122013 - pam_systemd causes AVC for ThinLinc
Summary: pam_systemd causes AVC for ThinLinc
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 20
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-07-22 11:08 UTC by Pierre Ossman
Modified: 2015-06-30 01:36 UTC (History)
5 users (show)

Fixed In Version: selinux-policy-3.12.1-182.fc20
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-06-30 01:36:11 UTC


Attachments (Terms of Use)
Policy file for ThinLinc (4.68 KB, text/plain)
2014-08-20 10:39 UTC, Pierre Ossman
no flags Details

Description Pierre Ossman 2014-07-22 11:08:58 UTC
pam_systemd is messing around with the given $DISPLAY, causing this AVC:

> type=AVC msg=audit(1406027132.689:67802): avc:  denied  { search } for  pid=4487 comm="tl-session" name=".X11-unix" dev="tmpfs" ino=18235 scontext=system_u:system_r:thinlinc_session_t:s0 tcontext=system_u:object_r:xdm_tmp_t:s0 tclass=dir

Commenting out pam_systemd gets rid of the audit message.

Comment 1 Daniel Walsh 2014-08-04 22:03:01 UTC
Where did the thinlinc_session_t type come from?  It is not something we ship?

Looks like thinlinc ships their own policy, you have to work with them.

Comment 2 Pierre Ossman 2014-08-20 10:36:21 UTC
Yes, it is an external policy. I was in a rush and should have been clearer.

The point was that I believe the auth_use_pam() macro needs to be adjusted as (apparently) some PAM modules now need more access to do their work.

Comment 3 Pierre Ossman 2014-08-20 10:39:04 UTC
Created attachment 928755 [details]
Policy file for ThinLinc

This is the policy that defines the thinlinc_session_t type, and also calls auth_login_pgm_domain() to indicate that it needs to be allowed to perform a login.


(I was also unable to reset the assignee back properly :/)

Comment 4 Daniel Walsh 2014-08-20 14:46:42 UTC
What is it searching for in /tmp/.X11-unix?

Adding this to auth_use_pam seems like it is streting it, since I am not sure pam is causing this AVC.  Seems to be X Specific.

Comment 5 Pierre Ossman 2014-08-20 15:15:20 UTC
Well, I haven't dug around in pam_systemd to figure out what it's up to, but I assume that the triggering condition is that PAM_XDISPLAY is set. Perhaps pam_systemd tries to verify the X11 socket? Or add some root window properties?

One question is why this isn't seen with anything shipped with Fedora. I suspect that only display managers have PAM_XDISPLAY set. And they most likely run in a context where they need access to X11 anyway. If you put the non-graphical portions of GDM in a different context, then you might see similar problems.

tl-session is more specialised and more or less only does the login.
(It also runs before the X server is started, so whatever pam_systemd is up to will probably fail. But that's a separate matter.)

Comment 6 Daniel Walsh 2014-08-21 12:02:44 UTC
Is the search all that is needed?  Have you run in permissive mode, to see if it actually does any other access?

Comment 7 Pierre Ossman 2014-08-21 13:03:52 UTC
This is the only AVC I see, even in permissive mode.

Comment 8 Daniel Walsh 2014-08-22 13:08:43 UTC
d0c04a625cd235b9c362a4bc17acfc7e2c5aca52 fixes this in git.

Comment 9 Lukas Vrabec 2014-08-27 12:19:35 UTC
commit d0c04a625cd235b9c362a4bc17acfc7e2c5aca52
Author: Dan Walsh <dwalsh@redhat.com>
Date:   Fri Aug 22 09:08:23 2014 -0400

    Allow programs to use pam to search through user_tmp_t dires (/tmp/.X11-unix)

https://github.com/selinux-policy/selinux-policy/commit/d0c04a625cd235b9c362a4bc17acfc7e2c5aca52

Comment 10 Fedora Update System 2014-08-27 14:52:53 UTC
selinux-policy-3.12.1-182.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-182.fc20

Comment 11 Fedora Update System 2014-08-28 15:30:43 UTC
Package selinux-policy-3.12.1-182.fc20:
* should fix your issue,
* was pushed to the Fedora 20 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-182.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-9819/selinux-policy-3.12.1-182.fc20
then log in and leave karma (feedback).

Comment 12 Fedora Update System 2014-08-30 03:54:51 UTC
selinux-policy-3.12.1-182.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 13 Pierre Ossman 2014-09-09 07:56:03 UTC
Confirmed that the issue is solved. Thank you. :)

Comment 14 Pierre Ossman 2014-09-09 15:20:36 UTC
I spoke too soon. Not sure why the AVC didn't show up the first time. Still getting:

> type=AVC msg=audit(1410275853.495:53011): avc:  denied  { search } for  pid=8600 comm="tl-session" name=".X11-unix" dev="tmpfs" ino=18622 scontext=system_u:system_r:thinlinc_session_t:s0 tcontext=system_u:object_r:xdm_tmp_t:s0 tclass=dir

selinux-policy-3.12.1-182.fc20.noarch
selinux-policy-devel-3.12.1-182.fc20.noarch

Comment 15 Pierre Ossman 2014-09-09 15:41:21 UTC
Ah. The problem is that the X11 files are xdm_tmp_t, not normal tmp_t. You need a call to xserver_search_xdm_tmp_dirs() rather than userdom_search_user_tmp_dirs().

Comment 16 Pierre Ossman 2014-09-29 07:47:29 UTC
Ping?

Comment 17 Miroslav Grepl 2014-09-29 09:48:38 UTC
We get it as user_tmp_t in F21. It needs to be allowed by thinlinc policy which we don't ship.

Comment 18 Pierre Ossman 2014-09-29 10:25:45 UTC
So F20 is already too old to be adjusted?

$ ls -Z /tmp/.X11-unix/
srwxrwxrwx. root root system_u:object_r:xdm_tmp_t:s0   X0

Comment 19 Miroslav Grepl 2014-09-29 10:43:30 UTC
Lukas,
could you add a fix for f20? We want to have

xserver_search_xdm_tmp_dirs()

together with 

userdom_search_user_tmp_dirs()

in F20.

Comment 20 Lukas Vrabec 2014-09-29 10:57:28 UTC
commit d3b075499ae66359bfda64aec6d3ef881502c71f
Author: Lukas Vrabec <lvrabec@redhat.com>
Date:   Mon Sep 29 12:56:34 2014 +0200

     Allow programs to use pam to search through xdm_tmp_t dires. BZ (#1122013)

https://github.com/selinux-policy/selinux-policy/commit/d3b075499ae66359bfda64aec6d3ef881502c71f

Comment 21 Fedora Update System 2014-09-30 08:36:17 UTC
selinux-policy-3.12.1-188.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-188.fc20

Comment 22 Fedora Update System 2014-10-01 04:22:49 UTC
Package selinux-policy-3.12.1-188.fc20:
* should fix your issue,
* was pushed to the Fedora 20 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-188.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-11932/selinux-policy-3.12.1-188.fc20
then log in and leave karma (feedback).

Comment 23 Fedora End Of Life 2015-05-29 12:26:03 UTC
This message is a reminder that Fedora 20 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 20. 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 EOL if it remains open with a Fedora  'version'
of '20'.

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.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 20 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 this bug is closed as described in the policy above.

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.

Comment 24 Fedora End Of Life 2015-06-30 01:36:11 UTC
Fedora 20 changed to end-of-life (EOL) status on 2015-06-23. Fedora 20 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


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