Bug 1403224

Summary: SELinux is preventing NFS mount in user /home directory
Product: [Fedora] Fedora Reporter: srakitnican <samuel.rakitnican>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 25CC: dominick.grift, dwalsh, lvrabec, mgrepl, oliver.henshaw, plautrba, pmoore, ssekidde
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 10:47:23 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description srakitnican 2016-12-09 13:14:11 UTC
Description of problem:
SELinux is preventing systemd from read access on the directory Music.

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

If you believe that systemd should be allowed read access on the Music directory 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:
# ausearch -c 'systemd' --raw | audit2allow -M my-systemd
# semodule -X 300 -i my-systemd.pp

Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                unconfined_u:object_r:audio_home_t:s0
Target Objects                Music [ dir ]
Source                        systemd
Source Path                   systemd
Port                          <Unknown>
Host                          rawhide
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-224.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     rawhide
Platform                      Linux rawhide 4.8.11-300.fc25.x86_64 #1 SMP Mon
                              Nov 28 18:24:51 UTC 2016 x86_64 x86_64
Alert Count                   16
First Seen                    2016-11-03 08:36:24 CET
Last Seen                     2016-12-09 13:55:32 CET
Local ID                      9a8d9d5f-83b5-4e7d-97e2-c1b86cdd8865

Raw Audit Messages
type=AVC msg=audit(1481288132.702:482): avc:  denied  { read } for  pid=1 comm="systemd" name="Music" dev="md126p3" ino=939524611 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:audio_home_t:s0 tclass=dir permissive=0


Hash: systemd,init_t,audio_home_t,dir,read


Version-Release number of selected component (if applicable):
selinux-policy-3.13.1-224.fc25.noarch
selinux-policy-targeted-3.13.1-224.fc25.noarch


How reproducible: By restarting systemd .mount


Actual results:
* home-srakit-Music.mount - /home/srakit/Music
   Loaded: loaded (/etc/fstab; generated; vendor preset: disabled)
   Active: failed (Result: exit-code) since Fri 2016-12-09 13:55:32 CET; 16min ago
    Where: /home/srakit/Music
     What: 192.168.1.20:/home/srakit/Music
     Docs: man:fstab(5)
           man:systemd-fstab-generator(8)
  Process: 15194 ExecMount=/usr/bin/mount 192.168.1.20:/home/srakit/Music /home/srakit/Music -t nfs -o defaults,x-systemd.requires=network.target (code=exited, status=32)

Dec 09 13:55:32 rawhide systemd[1]: home-srakit-Music.mount: Failed to check directory /home/srakit/Music: Permission denied
Dec 09 13:55:32 rawhide systemd[1]: Mounting /home/srakit/Music...
Dec 09 13:55:32 rawhide systemd[1]: home-srakit-Music.mount: Mount process exited, code=exited status=32
Dec 09 13:55:32 rawhide mount[15194]: mount.nfs: access denied by server while mounting 192.168.1.20:/home/srakit/Music
Dec 09 13:55:32 rawhide systemd[1]: Failed to mount /home/srakit/Music.
Dec 09 13:55:32 rawhide systemd[1]: home-srakit-Music.mount: Unit entered failed state.


Expected results:


Additional info:

Comment 1 srakitnican 2016-12-14 12:39:51 UTC
It seems the initial issue of "home-srakit-Music.mount: Failed to check directory /home/srakit/Music: Permission denied" was a configuration issue (client ip address changed). After sorting that out NFS mount is mounting like it should.

Still, initial SELinux denial is in effect, systemd is denied "read access on the Music directory".

Comment 2 srakitnican 2017-02-15 18:38:52 UTC
In addition to that, trying to configure systemd to automount network share to user /home directory is blocked by selinux.


SELinux is preventing systemd from read access on the directory Music.

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

If you believe that systemd should be allowed read access on the Music directory 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:
# ausearch -c 'systemd' --raw | audit2allow -M my-systemd
# semodule -X 300 -i my-systemd.pp


Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                unconfined_u:object_r:audio_home_t:s0
Target Objects                Music [ dir ]
Source                        systemd
Source Path                   systemd
Port                          <Unknown>
Host                          oldiemodern
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-225.6.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     oldiemodern
Platform                      Linux oldiemodern 4.9.9-200.fc25.x86_64 #1 SMP Thu
                              Feb 9 17:28:13 UTC 2017 x86_64 x86_64
Alert Count                   13
First Seen                    2017-02-11 16:55:37 CET
Last Seen                     2017-02-15 19:32:36 CET
Local ID                      98331ebf-40b5-4949-8ba8-95039e369248

Raw Audit Messages
type=AVC msg=audit(1487183556.929:630): avc:  denied  { read } for  pid=1 comm="systemd" name="Music" dev="sda3" ino=1704013 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:audio_home_t:s0 tclass=dir permissive=0


Hash: systemd,init_t,audio_home_t,dir,read

SELinux is preventing systemd from mounton access on the directory /home/srakit/Music.

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

If you believe that systemd should be allowed mounton access on the Music directory 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:
# ausearch -c 'systemd' --raw | audit2allow -M my-systemd
# semodule -X 300 -i my-systemd.pp


Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                unconfined_u:object_r:audio_home_t:s0
Target Objects                /home/srakit/Music [ dir ]
Source                        systemd
Source Path                   systemd
Port                          <Unknown>
Host                          oldiemodern
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-225.6.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     oldiemodern
Platform                      Linux oldiemodern 4.9.9-200.fc25.x86_64 #1 SMP Thu
                              Feb 9 17:28:13 UTC 2017 x86_64 x86_64
Alert Count                   3
First Seen                    2017-02-15 19:16:59 CET
Last Seen                     2017-02-15 19:32:36 CET
Local ID                      43c3eb47-381c-415a-a0b5-f7eef699edff

Raw Audit Messages
type=AVC msg=audit(1487183556.929:631): avc:  denied  { mounton } for  pid=1 comm="systemd" path="/home/srakit/Music" dev="sda3" ino=1704013 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:audio_home_t:s0 tclass=dir permissive=0


Hash: systemd,init_t,audio_home_t,dir,mounton

Comment 3 Oliver Henshaw 2017-02-20 12:55:55 UTC
I see the 'read' denied part of this when bind-mounting Music directories from a data disk onto home.

# findmnt
...
├─/home                                          /dev/mapper/VGFastAlpine-LVHome
 ├─/home/oliver/Music                           /dev/mapper/VGAlpine-LVData[/oliver/Music]
│ └─/home/oliver/Videos                          /dev/mapper/VGAlpine-LVData[/oliver/Videos]

Videos/ shows no problems but I see these messages in the journal:

avc:  denied  { read } for  pid=1 comm="systemd" name="Music" dev="dm-6" ino=11927598 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:audio_home_t:s0 tclass=dir permissive=0
home-oliver-Music.mount: Failed to check directory /home/oliver/Music: Permission denied

though it's just warnings (it's trying to fsck?) and there's no problem reading the directories. I also see this with "tcontext=unconfined_u:object_r:virt_home_t:s0" bind-mounted directories.

Comment 4 Fedora End Of Life 2017-11-16 19:56:34 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. 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 '25'.

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 25 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 5 Fedora End Of Life 2017-12-12 10:47:23 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 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.