RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1719754 - SELinux prevents cups-browsed from creating a symlink in /tmp
Summary: SELinux prevents cups-browsed from creating a symlink in /tmp
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.7
Hardware: All
OS: Linux
medium
medium
Target Milestone: rc
: 7.8
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
: 1756489 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-06-12 13:19 UTC by Petr Sklenar
Modified: 2020-03-31 19:11 UTC (History)
11 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 19:10:50 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:1007 0 None None None 2020-03-31 19:11:18 UTC

Description Petr Sklenar 2019-06-12 13:19:50 UTC
Description of problem:
there are plenty of avc denial when running cups-browsed

Version-Release number of selected component (if applicable):
cups-1.6.3-40.el7.x86_64
selinux-policy-3.13.1-250.el7.noarch

RHEL-7.7-20190606.1

How reproducible:
always

Steps to Reproduce:
 
        echo 'BrowseRemoteProtocols dnssd cups' >> /etc/cups/cups-browsed.conf
        echo 'BrowsePoll cups<server>:631' >> /etc/cups/cups-browsed.conf
        service cups restart
        service cups-browsed restart

Actual results:
type=PROCTITLE msg=audit(06/12/2019 09:13:20.250:206316) : proctitle=/usr/sbin/cups-browsed 
type=SYSCALL msg=audit(06/12/2019 09:13:20.250:206316) : arch=x86_64 syscall=symlink success=no exit=EACCES(Permission denied) a0=0x7ffce9dd8ed0 a1=0x5557da53e718 a2=0x5557da53e72a a3=0x5d00fa70 items=0 ppid=1 pid=10999 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=cups-browsed exe=/usr/sbin/cups-browsed subj=system_u:system_r:cupsd_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/12/2019 09:13:20.250:206316) : avc:  denied  { create } for  pid=10999 comm=cups-browsed name=5d00fa703d7d4 scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=lnk_file permissive=0 
----
type=PROCTITLE msg=audit(06/12/2019 09:13:20.250:206317) : proctitle=/usr/sbin/cups-browsed 
type=SYSCALL msg=audit(06/12/2019 09:13:20.250:206317) : arch=x86_64 syscall=symlink success=no exit=EACCES(Permission denied) a0=0x7ffce9dd8ed0 a1=0x5557da53e718 a2=0x5557da53e72a a3=0x5d00fa70 items=0 ppid=1 pid=10999 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=cups-browsed exe=/usr/sbin/cups-browsed subj=system_u:system_r:cupsd_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/12/2019 09:13:20.250:206317) : avc:  denied  { create } for  pid=10999 comm=cups-browsed name=5d00fa703d81a scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=lnk_file permissive=0 

Expected results:


Additional info:

Comment 5 Milos Malik 2019-06-12 13:37:35 UTC
Following SELinux denials appear in permissive mode:
----
type=PROCTITLE msg=audit(06/12/2019 09:35:19.758:2613) : proctitle=/usr/sbin/cups-browsed 
type=PATH msg=audit(06/12/2019 09:35:19.758:2613) : item=2 name=/tmp/5d00ff97b9623 inode=389400 dev=fd:01 mode=link,777 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:tmp_t:s0 objtype=CREATE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=PATH msg=audit(06/12/2019 09:35:19.758:2613) : item=1 name=/tmp/ inode=74 dev=fd:01 mode=dir,sticky,777 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:tmp_t:s0 objtype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=PATH msg=audit(06/12/2019 09:35:19.758:2613) : item=0 name=/etc/cups/ppd/brno1-0th-cafe.ppd objtype=UNKNOWN cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(06/12/2019 09:35:19.758:2613) :  cwd=/ 
type=SYSCALL msg=audit(06/12/2019 09:35:19.758:2613) : arch=x86_64 syscall=symlink success=yes exit=0 a0=0x7ffc8a5289e0 a1=0x55a60d83f718 a2=0x55a60d83f72a a3=0x7ffc8a527020 items=3 ppid=1 pid=22375 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=cups-browsed exe=/usr/sbin/cups-browsed subj=system_u:system_r:cupsd_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/12/2019 09:35:19.758:2613) : avc:  denied  { create } for  pid=22375 comm=cups-browsed name=5d00ff97b9623 scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=lnk_file permissive=1 
----
type=PROCTITLE msg=audit(06/12/2019 09:35:19.761:2614) : proctitle=/usr/sbin/cups-browsed 
type=PATH msg=audit(06/12/2019 09:35:19.761:2614) : item=1 name=/tmp/5d00ff97b9623 inode=389400 dev=fd:01 mode=link,777 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:tmp_t:s0 objtype=DELETE cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=PATH msg=audit(06/12/2019 09:35:19.761:2614) : item=0 name=/tmp/ inode=74 dev=fd:01 mode=dir,sticky,777 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:tmp_t:s0 objtype=PARENT cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(06/12/2019 09:35:19.761:2614) :  cwd=/ 
type=SYSCALL msg=audit(06/12/2019 09:35:19.761:2614) : arch=x86_64 syscall=unlink success=yes exit=0 a0=0x55a60d83f718 a1=0x0 a2=0x7ff9681ea7b8 a3=0x7ff9681ea7b8 items=2 ppid=1 pid=22375 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=cups-browsed exe=/usr/sbin/cups-browsed subj=system_u:system_r:cupsd_t:s0-s0:c0.c1023 key=(null) 
type=AVC msg=audit(06/12/2019 09:35:19.761:2614) : avc:  denied  { unlink } for  pid=22375 comm=cups-browsed name=5d00ff97b9623 dev="vda1" ino=389400 scontext=system_u:system_r:cupsd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:tmp_t:s0 tclass=lnk_file permissive=1 
----

The amount of SELinux denials triggered by the reproducer in enforcing mode is huge (thousands).

Comment 6 Milos Malik 2019-06-12 13:41:52 UTC
# rpm -qa selinux\*
selinux-policy-devel-3.13.1-251.el7.noarch
selinux-policy-targeted-3.13.1-251.el7.noarch
selinux-policy-mls-3.13.1-251.el7.noarch
selinux-policy-3.13.1-251.el7.noarch
# sesearch -s cupsd_t -t tmp_t -T
Found 3 semantic te rules:
   type_transition cupsd_t tmp_t : dir cupsd_tmp_t; 
   type_transition cupsd_t tmp_t : file cupsd_tmp_t; 
   type_transition cupsd_t tmp_t : fifo_file cupsd_tmp_t; 

Found 1 named file transition filename_trans:
type_transition cupsd_t tmp_t : file krb5_host_rcache_t "host_0"; 
#

I believe that a type_transition rule for lnk_file:cupsd_tmp_t is missing.

Comment 23 Lukas Vrabec 2019-10-02 08:45:29 UTC
*** Bug 1756489 has been marked as a duplicate of this bug. ***

Comment 24 Rik Theys 2019-10-21 08:47:28 UTC
Hi,

Is there any ETA on when an update that fixes this bug will be released for 7.7?

Would you be able to share a .te file that resolves this issue in the mean time? I'm having a hard time finding the correct syntax for configuring the correct type_transition rule...

Regards,
Rik

Comment 25 Rik Theys 2019-10-21 09:27:07 UTC
Hi,

After some more fiddling I've created the following .te file which seems to work:

====
module esat-cups_tmp 1.0;

require {
        type tmp_t;
        type cupsd_t;
        type cupsd_tmp_t;
        class lnk_file {create read unlink} ;
}

#============= cupsd_t ==============

type_transition cupsd_t tmp_t : lnk_file cupsd_tmp_t;
allow cupsd_t cupsd_tmp_t:lnk_file { create read unlink };
====

I have no idea if these are sufficient.

Regards,
Rik

Comment 27 errata-xmlrpc 2020-03-31 19:10:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1007


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