Bug 1009668 - SELinux targeted policy preventing pam_mount from mounting home directory
SELinux targeted policy preventing pam_mount from mounting home directory
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
19
x86_64 Linux
unspecified Severity medium
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-09-18 16:09 EDT by lapseofreason0
Modified: 2015-02-18 06:28 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-02-18 06:28:11 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
AVC denial log (15.84 KB, text/plain)
2013-09-25 15:39 EDT, lapseofreason0
no flags Details

  None (edit)
Description lapseofreason0 2013-09-18 16:09:28 EDT
pam_mount fails to mount home directory when SELinux is enabled and the user is in user_u or staff_u.

Mounting works fine for unconfined_u.


Here is the relevant SELinux troubleshooting entry:

SELinux is preventing /usr/libexec/gdm-session-worker from entrypoint access on the file /usr/bin/mount.

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

If you believe that gdm-session-worker should be allowed entrypoint access on the mount 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 gdm-session-wor /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                user_u:user_r:user_t:s0
Target Context                system_u:object_r:mount_exec_t:s0
Target Objects                /usr/bin/mount [ file ]
Source                        gdm-session-wor
Source Path                   /usr/libexec/gdm-session-worker
Port                          <Unknown>
Host                          notebook
Source RPM Packages           gdm-3.8.4-2.fc19.x86_64
Target RPM Packages           util-linux-2.23.2-4.fc19.x86_64
Policy RPM                    selinux-policy-3.12.1-74.3.fc19.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     fedora
Platform                      Linux fedora 3.10.11-200.fc19.x86_64 #1 SMP Mon
                              Sep 9 13:03:01 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-09-18 21:50:31 CEST
Last Seen                     2013-09-18 21:50:31 CEST
Local ID                      [redacted]

Raw Audit Messages
type=AVC msg=audit(1379533831.874:657): avc:  denied  { entrypoint } for  pid=11284 comm="gdm-session-wor" path="/usr/bin/mount" dev="dm-0" ino=161878 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:mount_exec_t:s0 tclass=file


type=SYSCALL msg=audit(1379533831.874:657): arch=x86_64 syscall=execve success=no exit=EACCES a0=7fffcd2c73b0 a1=7facd286c2c0 a2=7facd28703a0 a3=7facd00042e0 items=0 ppid=11272 pid=11284 auid=1000 uid=0 gid=1000 euid=0 suid=0 fsuid=0 egid=1000 sgid=1000 fsgid=1000 ses=8 tty=(none) comm=gdm-session-wor exe=/usr/libexec/gdm-session-worker subj=system_u:system_r:xdm_t:s0-s0:c0.c1023 key=(null)

Hash: gdm-session-wor,user_t,mount_exec_t,file,entrypoint
Comment 1 Daniel Walsh 2013-09-24 13:01:57 EDT
user_t and staff_t for that matter are prevented from mounting of file systems.  I guess the best way to handle this would be to use automount.
Comment 2 lapseofreason0 2013-09-25 13:37:39 EDT
I understand, but automount is not a good alternative if you want the user to use the user password on mount (i.e. for a network share or an encrypted folder).

Any chance you could point me towards how to change the policy to allow mounting using pam_mount?
Comment 3 Daniel Walsh 2013-09-25 13:56:11 EDT
Simplest thing would be to gather AVC's for what is required, then we could look at adding a boolean for this.

setenforce 0

Login,

ausearch -m avc -ts recent.

We can look at that.

Another option would be to allow a confined user to transition to the mount_t domain.

mount_run(user_t, user_r)
Comment 4 lapseofreason0 2013-09-25 15:39:11 EDT
Created attachment 803044 [details]
AVC denial log
Comment 5 lapseofreason0 2013-09-25 15:43:16 EDT
I added the relevant output of ausearch. Basically gdm-session-worker calls mount (or any other command defined in /etc/security/pam_mount.xml), which then calls mount.crypt. This calls cryptsetup to set up the LUKS mapping and then mounts the filesystem.

How would I allow staff_t to transition to mount_t to test if that would work?
Comment 6 Miroslav Grepl 2013-09-25 16:20:36 EDT
Ok, so it is not just about mount_run() but also about lvm_run() which we don't want to allow by default. I am also sceptic about a boolean. We could think about it for staff_u but definitely not for user_u.
Comment 7 Miroslav Grepl 2013-09-25 16:22:35 EDT
Maybe there could be involved a helper script.
Comment 8 lapseofreason0 2013-09-25 16:28:11 EDT
I'm not sure whether you meant this as a question, but in my case there is a helper script involved. It is simply a bash script that gets called by mount when it is called with a special fstype. The script just feeds the password to cryptsetup and then calls mount.
Comment 9 Fedora End Of Life 2015-01-09 17:18:26 EST
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

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 19 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 10 Fedora End Of Life 2015-02-18 06:28:11 EST
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 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.