Bug 1433971

Summary: SELinux is preventing systemd from 'open' accesses on the file /gnu/store/gj2i5xs7nm80mwrb139pa8iqfccw08zz-guix-0.12.0/lib/systemd/system/guix-daemon.service.
Product: [Fedora] Fedora Reporter: hashim.muqtadir
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: aplaza, dominick.grift, dwalsh, lvrabec, mgrepl, plautrba, pmoore, ssekidde
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:6181a2b154cf803ce8c945bb2ce9f53e98d1ecee73bfb737d301089cd35a3081;VARIANT_ID=workstation;
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-12-12 10:41:13 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 hashim.muqtadir 2017-03-20 13:36:23 UTC
Description of problem:
I followed the steps for installing guix, 
provided at https://www.gnu.org/software/guix/manual/html_node/Binary-Installation.html, 
which include:
- Download guix
- unpack in tmp
- move to /var/guix and /gnu
- run guix-daemon as service

Doing so causes the service to fail to start and selinux complains.

While guix is not provided as a package in fedora, it would still be very useful
if it worked well with fedora and selinux out of the box, or, some documentation on how
to make it work.

Following the steps in the selinux troubleshooter to install custom policies do work, so it is
admittedly not too big a deal though.

SELinux is preventing systemd from 'open' accesses on the file /gnu/store/gj2i5xs7nm80mwrb139pa8iqfccw08zz-guix-0.12.0/lib/systemd/system/guix-daemon.service.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/gnu/store/gj2i5xs7nm80mwrb139pa8iqfccw08zz-guix-0.12.0/lib/systemd/system/guix-daemon.service default label should be default_t.
Then you can run restorecon.
# /sbin/restorecon -v /gnu/store/gj2i5xs7nm80mwrb139pa8iqfccw08zz-guix-0.12.0/lib/systemd/system/guix-daemon.service

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that systemd should be allowed open access on the guix-daemon.service file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
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:user_tmp_t:s0
Target Objects                /gnu/store/gj2i5xs7nm80mwrb139pa8iqfccw08zz-
                              [ file ]
Source                        systemd
Source Path                   systemd
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-225.11.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.9.14-200.fc25.x86_64 #1 SMP Mon
                              Mar 13 19:26:40 UTC 2017 x86_64 x86_64
Alert Count                   1
First Seen                    2017-03-20 18:22:18 PKT
Last Seen                     2017-03-20 18:22:18 PKT
Local ID                      071e3f3e-fd80-4626-a0a6-0a561bb9239a

Raw Audit Messages
type=AVC msg=audit(1490016138.843:6012): avc:  denied  { open } for  pid=1 comm="systemd" path="/gnu/store/gj2i5xs7nm80mwrb139pa8iqfccw08zz-guix-0.12.0/lib/systemd/system/guix-daemon.service" dev="dm-0" ino=2627026 scontext=system_u:system_r:init_t:s0 tcontext=unconfined_u:object_r:user_tmp_t:s0 tclass=file permissive=0

Hash: systemd,init_t,user_tmp_t,file,open

Version-Release number of selected component:

Additional info:
reporter:       libreport-2.8.0
hashmarkername: setroubleshoot
kernel:         4.9.14-200.fc25.x86_64
type:           libreport

Potential duplicate: bug 1324650

Comment 1 Fedora End Of Life 2017-11-16 18:35:11 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 2 Fedora End Of Life 2017-12-12 10:41:13 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

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

Comment 3 Andrew Plaza 2019-05-03 05:53:07 UTC
I can confirm this is still a bug on Fedora 30. I tried installing Guix today and ran into the same issue, where SELinux blocks guix-daemon from executing:

Relevant Logs:

May 03 01:52:02 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=guix-daemon comm="systemd>
May 03 01:52:02 localhost.localdomain audit[4610]: AVC avc:  denied  { read } for  pid=4610 comm="(x-daemon)" name="current-guix" dev="dm-1" ino=1707509 scontext=system_u:sy>
May 03 01:52:02 localhost.localdomain systemd[4610]: guix-daemon.service: Failed to execute command: Permission denied
May 03 01:52:02 localhost.localdomain systemd[4610]: guix-daemon.service: Failed at step EXEC spawning /var/guix/profiles/per-user/root/current-guix/bin/guix-daemon: Permiss>
-- Subject: Process /var/guix/profiles/per-user/root/current-guix/bin/guix-daemon could not be executed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- The process /var/guix/profiles/per-user/root/current-guix/bin/guix-daemon could not be executed and failed.
-- The error number returned by this process is ERRNO.