Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 1361794

Summary: SELinux is preventing nut drivers (including /usr/sbin/usbhid-ups and /usr/sbin/blazer_usb) accessing udev nodes
Product: [Fedora] Fedora Reporter: Vasco Almeida <vasco.almeid>
Component: selinux-policy-targetedAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED EOL QA Contact: Ben Levenson <benl>
Severity: high Docs Contact:
Priority: unspecified    
Version: 24CC: benl, dwalsh, gary.tierney, gdelx001, jcasale, mgrepl, pizza, vasco.almeid
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: 1297163 Environment:
Last Closed: 2017-08-08 16:03:04 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 Vasco Almeida 2016-07-30 15:03:58 UTC
+++ This bug was initially created as a clone of Bug #1297163 +++

Description of problem:

Many files are attempted (assume all are in /run/udev/data but the path is not reported !!!), this is an sealert for one of the files:

SELinux is preventing /usr/sbin/usbhid-ups from read access on the file +usb:2-4:1.0.

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

If you believe that usbhid-ups should be allowed read access on the +usb:2-4:1.0 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 usbhid-ups /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


Additional Information:
Source Context                system_u:system_r:nut_upsdrvctl_t:s0
Target Context                system_u:object_r:udev_var_run_t:s0
Target Objects                +usb:2-4:1.0 [ file ]
Source                        usbhid-ups
Source Path                   /usr/sbin/usbhid-ups
Port                          <Unknown>
Host                          system
Source RPM Packages           
Target RPM Packages           
Policy RPM                    <Unknown>
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     system
Platform                      Linux system 4.2.8-300.fc23.x86_64 #1
                              SMP Tue Dec 15 16:49:06 UTC 2015 x86_64 x86_64
Alert Count                   148
First Seen                    2015-12-29 11:08:28 PST
Last Seen                     2016-01-09 10:46:12 PST
Local ID                      621446fd-75ee-4e4c-9da3-627caa5d29a6

Raw Audit Messages
type=AVC msg=audit(1452365172.173:35013): avc:  denied  { read } for  pid=30857 comm="usbhid-ups" name="+usb:2-4:1.0" dev="tmpfs" ino=14205 scontext=system_u:system_r:nut_upsdrvctl_t:s0 tcontext=system_u:object_r:udev_var_run_t:s0 tclass=file permissive=0


type=SYSCALL msg=audit(1452365172.173:35013): arch=x86_64 syscall=open success=no exit=EACCES a0=7ffc0f61f890 a1=80000 a2=1b6 a3=80000 items=0 ppid=30856 pid=30857 auid=4294967295 uid=57 gid=57 euid=57 suid=57 fsuid=57 egid=57 sgid=57 fsgid=57 tty=(none) ses=4294967295 comm=usbhid-ups exe=/usr/sbin/usbhid-ups subj=system_u:system_r:nut_upsdrvctl_t:s0 key=(null)

Hash: usbhid-ups,nut_upsdrvctl_t,udev_var_run_t,file,read




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

Have a ups on usb configured in nut that the hid driver is scanning through nodes to initially identify and acquire (? a guess...) but is not allowed.

--- Additional comment from  on 2016-01-20 11:51:22 EST ---

Just a note that amending policy with:

allow nut_upsdrvctl_t udev_var_run_t:file { getattr read open };

allows driver to start without complaint.  Everything appears to function now.

Note that nut-server service starts driver service.

Suspect this is a problem with other ups usb drivers as well.

--- Additional comment from Miroslav Grepl on 2016-01-21 03:12:03 EST ---

Thank you for testing.

--- Additional comment from Gary Tierney on 2016-06-28 12:54 EDT ---

Also submitted as a pull-request to fedora-selinux GitHub.

--- Additional comment from Vasco Almeida on 2016-06-30 09:00:16 EDT ---

Gary Tierney's patch works for me. That log on selinux-policy/pull/136 git pull request is from my system before he helped me fix the issue.
Thank you.

Comment 1 Fedora End Of Life 2017-07-25 22:08:57 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. 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 '24'.

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 24 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-08-08 16:03:04 UTC
Fedora 24 changed to end-of-life (EOL) status on 2017-08-08. Fedora 24 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.