Bug 1387760 - SELinux is preventing nfs-server-gene from 'write' accesses on the directory generator upon DNF installation or updates.
Summary: SELinux is preventing nfs-server-gene from 'write' accesses on the directory ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 25
Hardware: x86_64
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:ec6aea82a73a973a86ca4be4c55...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-10-21 19:27 UTC by Anass Ahmed
Modified: 2016-11-10 16:38 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.13.1-222.fc25
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-11-10 16:38:01 UTC
Type: ---


Attachments (Terms of Use)

Description Anass Ahmed 2016-10-21 19:27:04 UTC
Description of problem:
Everytime I do installation or update using DNF (no NFS updates being included at all).
SELinux is preventing nfs-server-gene from 'write' accesses on the directory generator.

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

If you believe that nfs-server-gene should be allowed write access on the generator 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 'nfs-server-gene' --raw | audit2allow -M my-nfsservergene
# semodule -X 300 -i my-nfsservergene.pp

Additional Information:
Source Context                system_u:system_r:nfsd_t:s0
Target Context                system_u:object_r:systemd_unit_file_t:s0
Target Objects                generator [ dir ]
Source                        nfs-server-gene
Source Path                   nfs-server-gene
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    <Unknown>
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.8.2-300.fc25.x86_64 #1 SMP Mon
                              Oct 17 23:07:43 UTC 2016 x86_64 x86_64
Alert Count                   12
First Seen                    2016-10-14 18:55:02 EET
Last Seen                     2016-10-21 21:07:51 EET
Local ID                      1d176206-103b-486f-a57d-7ff71a474cbb

Raw Audit Messages
type=AVC msg=audit(1477076871.385:321): avc:  denied  { write } for  pid=10272 comm="nfs-server-gene" name="generator" dev="tmpfs" ino=971238 scontext=system_u:system_r:nfsd_t:s0 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=dir permissive=0


Hash: nfs-server-gene,nfsd_t,systemd_unit_file_t,dir,write


Additional info:
reporter:       libreport-2.8.0
hashmarkername: setroubleshoot
kernel:         4.8.2-300.fc25.x86_64
type:           libreport

Potential duplicate: bug 1377037

Comment 1 Anass Ahmed 2016-10-21 19:29:06 UTC
Maybe duplicate of Bug 1377037, because I changed the reason/title of the bug for more clarification!

Comment 2 Alan Schmidt 2016-10-31 14:58:45 UTC
Also there are complaints about files in subdirectories:

SELinux is preventing nfs-server-gene from write access on the file /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf.

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

If you want to fix the label. 
/run/systemd/generator/nfs-server.service.d/order-with-mounts.conf default label should be nfsd_unit_file_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf

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

If you believe that nfs-server-gene should be allowed write access on the order-with-mounts.conf 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:
# ausearch -c 'nfs-server-gene' --raw | audit2allow -M my-nfsservergene
# semodule -X 300 -i my-nfsservergene.pp

Additional Information:
Source Context                system_u:system_r:nfsd_t:s0
Target Context                system_u:object_r:systemd_unit_file_t:s0
Target Objects                /run/systemd/generator/nfs-server.service.d/order-
                              with-mounts.conf [ file ]
Source                        nfs-server-gene
Source Path                   nfs-server-gene
Port                          <Unknown>
Host                          aschmidt.graphtek.local
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-220.fc25.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     aschmidt.graphtek.local
Platform                      Linux aschmidt.graphtek.local
                              4.8.4-301.fc25.x86_64 #1 SMP Tue Oct 25 00:01:49
                              UTC 2016 x86_64 x86_64
Alert Count                   8
First Seen                    2016-10-29 13:09:52 PDT
Last Seen                     2016-10-31 07:43:04 PDT
Local ID                      7e8399f8-c435-4018-9a7d-1665b9a8134e

Raw Audit Messages
type=AVC msg=audit(1477924984.269:589): avc:  denied  { write } for  pid=2424 comm="nfs-server-gene" path="/run/systemd/generator/nfs-server.service.d/order-with-mounts.conf" dev="tmpfs" ino=173613 scontext=system_u:system_r:nfsd_t:s0 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=file permissive=1


Hash: nfs-server-gene,nfsd_t,systemd_unit_file_t,file,write

Comment 3 Lukas Vrabec 2016-10-31 21:28:51 UTC
*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/run/systemd/generator/nfs-server.service.d/order-with-mounts.conf default label should be nfsd_unit_file_t.
Then you can run restorecon.
Do
# /sbin/restorecon -v /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf

Comment 4 Alan Schmidt 2016-10-31 21:46:38 UTC
So, one of the following is true:

1) NFS + SELinux + systemd SHOULD conflict out of the box unless and until an admin makes wise choices about what should be allowed, and makes a small number of local policies.

2) I have misconfigured NFS.

One way or another, I've failed to grasp something essential. I /did/ suspect that setting it up was just too easy for safety.

I will try to google for relevant docs.

I know bug reports are no place for support requests. But if you're feeling magnanimous, "order-with-mounts.conf nfs-server-gene selinux" isn't getting me anything I can identify as an explanation for what nfs thinks it's trying to do.

Any hints?

Comment 5 Anass Ahmed 2016-11-01 11:35:46 UTC
(In reply to Lukas Vrabec from comment #3)
> *****  Plugin restorecon (99.5 confidence) suggests  
> ************************
> 
> If you want to fix the label. 
> /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf default
> label should be nfsd_unit_file_t.
> Then you can run restorecon.
> Do
> # /sbin/restorecon -v
> /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf

Please re-read the original report, I didn't hit the /run/systemd/generator/nfs-server.service.d/order-with-mounts.conf error before, so the fix isn't for me!

Every time DNF updates software, I hit this bug!

I had a new error:
SELinux is preventing nfs-server-gene from add_name access on the directory nfs-server.service.d.

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

If you believe that nfs-server-gene should be allowed add_name access on the nfs-server.service.d 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 'nfs-server-gene' --raw | audit2allow -M my-nfsservergene
# semodule -X 300 -i my-nfsservergene.pp

Additional Information:
Source Context                system_u:system_r:nfsd_t:s0
Target Context                system_u:object_r:systemd_unit_file_t:s0
Target Objects                nfs-server.service.d [ dir ]
Source                        nfs-server-gene
Source Path                   nfs-server-gene
Port                          <Unknown>
Host                          anass-galago
Source RPM Packages           
Target RPM Packages           
Policy RPM                    <Unknown>
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     anass-galago
Platform                      Linux anass-galago 4.8.4-301.fc25.x86_64 #1 SMP
                              Tue Oct 25 00:01:49 UTC 2016 x86_64 x86_64
Alert Count                   4
First Seen                    2016-10-30 00:39:00 EET
Last Seen                     2016-11-01 13:29:53 EET
Local ID                      c130b1e8-19ed-4604-a7fe-db8a6e2dc5d4

Raw Audit Messages
type=AVC msg=audit(1477999793.896:845): avc:  denied  { add_name } for  pid=27082 comm="nfs-server-gene" name="nfs-server.service.d" scontext=system_u:system_r:nfsd_t:s0 tcontext=system_u:object_r:systemd_unit_file_t:s0 tclass=dir permissive=0


Hash: nfs-server-gene,nfsd_t,systemd_unit_file_t,dir,add_name

Comment 6 Lukas Vrabec 2016-11-01 12:08:06 UTC
I added some fixes. Next Fedora update should fix it.

Comment 7 Fedora Update System 2016-11-02 17:51:29 UTC
selinux-policy-3.13.1-222.fc25 has been submitted as an update to Fedora 25. https://bodhi.fedoraproject.org/updates/FEDORA-2016-d1908bac81

Comment 8 Fedora Update System 2016-11-05 18:57:16 UTC
selinux-policy-3.13.1-222.fc25 has been pushed to the Fedora 25 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-d1908bac81

Comment 9 Fedora Update System 2016-11-10 16:38:01 UTC
selinux-policy-3.13.1-222.fc25 has been pushed to the Fedora 25 stable repository. If problems still persist, please make note of it in this bug report.


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