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 1297163 - SELinux is preventing /usr/sbin/usbhid-ups (nut) accessing udev nodes
Summary: SELinux is preventing /usr/sbin/usbhid-ups (nut) accessing udev nodes
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted
Version: 23
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Ben Levenson
Depends On:
TreeView+ depends on / blocked
Reported: 2016-01-10 02:14 UTC by gdelx001
Modified: 2016-12-20 17:44 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1361794 (view as bug list)
Last Closed: 2016-12-20 17:44:49 UTC

Attachments (Terms of Use) (deleted)
2016-06-28 16:54 UTC, Gary Tierney
no flags Details | Diff

Description gdelx001 2016-01-10 02:14:23 UTC
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.
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):

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.

Comment 1 gdelx001 2016-01-20 16:51:22 UTC
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.

Comment 2 Miroslav Grepl 2016-01-21 08:12:03 UTC
Thank you for testing.

Comment 3 Gary Tierney 2016-06-28 16:54:22 UTC
Created attachment 1173502 [details]

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

Comment 4 Vasco Almeida 2016-06-30 13:00:16 UTC
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 5 Fedora End Of Life 2016-11-24 14:49:08 UTC
This message is a reminder that Fedora 23 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 23. 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 '23'.

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 23 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 6 Fedora End Of Life 2016-12-20 17:44:49 UTC
Fedora 23 changed to end-of-life (EOL) status on 2016-12-20. Fedora 23 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.

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