Bug 1297163 - SELinux is preventing /usr/sbin/usbhid-ups (nut) accessing udev nodes
SELinux is preventing /usr/sbin/usbhid-ups (nut) accessing udev nodes
Status: CLOSED EOL
Product: Fedora
Classification: Fedora
Component: selinux-policy-targeted (Show other bugs)
23
x86_64 Linux
medium Severity high
: ---
: ---
Assigned To: Miroslav Grepl
Ben Levenson
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2016-01-09 21:14 EST by gdelx001
Modified: 2016-12-20 12:44 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1361794 (view as bug list)
Environment:
Last Closed: 2016-12-20 12:44:49 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
https://github.com/fedora-selinux/selinux-policy/pull/136 (621 bytes, patch)
2016-06-28 12:54 EDT, Gary Tierney
no flags Details | Diff

  None (edit)
Description gdelx001 2016-01-09 21:14:23 EST
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.
Comment 1 gdelx001 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.
Comment 2 Miroslav Grepl 2016-01-21 03:12:03 EST
Thank you for testing.
Comment 3 Gary Tierney 2016-06-28 12:54 EDT
Created attachment 1173502 [details]
https://github.com/fedora-selinux/selinux-policy/pull/136

Also submitted as a pull-request to fedora-selinux GitHub.
Comment 4 Vasco Almeida 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 5 Fedora End Of Life 2016-11-24 09:49:08 EST
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 12:44:49 EST
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
bug.

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.