Bug 1255951

Summary: SELinux policy prevents lircd from dropping privileges
Product: [Fedora] Fedora Reporter: Michael Chapman <redhat-bugzilla>
Component: selinux-policy-targetedAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED EOL QA Contact: Ben Levenson <benl>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 22CC: dwalsh
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-07-19 17:37:26 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:
Embargoed:

Description Michael Chapman 2015-08-22 09:11:39 UTC
This bug is reported against selinux-policy-targeted-3.13.1-128.10.fc22.noarch.

lircd can be configured to run as a low-privilege user through its --effective-user command-line option or effective-user config option. This is thwarted by the current SELinux targeted policy on F22, however, as it does not permit lircd to read /etc/passwd and /etc/group or call setuid() and setgid(). lircd continues to run as the root user if SELinux is enforcing.

The log message from lircd is:

  lircd-0.9.2a[15384]: Illegal effective uid: lirc: Permission denied

This is from its attempt to call getpwnam on the username "lirc" (i.e. reading /etc/passwd).

My workaround is the following custom policy:

  policy_module(my_lircd, 1.0.0)

  gen_require(`
      type lircd_t;
  ')

  auth_read_passwd(lircd_t)
  allow lircd_t self:capability { setuid setgid };

setgid() isn't used by lirc 0.9.2, but it will be by lirc 0.9.3.

Comment 1 Fedora End Of Life 2016-07-19 17:37:26 UTC
Fedora 22 changed to end-of-life (EOL) status on 2016-07-19. Fedora 22 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.