Bug 1719754
| Summary: | SELinux prevents cups-browsed from creating a symlink in /tmp | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | Petr Sklenar <psklenar> |
| Component: | selinux-policy | Assignee: | Lukas Vrabec <lvrabec> |
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> |
| Severity: | medium | Docs Contact: | |
| Priority: | medium | ||
| Version: | 7.7 | CC: | adm.fkt.physik, alex, lvrabec, mmalik, paulds, plautrba, rik.theys, ssekidde, vmojzis, zdohnal, zpytela |
| Target Milestone: | rc | Keywords: | AutoVerified, Regression |
| Target Release: | 7.8 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | If docs needed, set a value | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2020-03-31 19:10:50 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: | |||
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).
# 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. *** Bug 1756489 has been marked as a duplicate of this bug. *** 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 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
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 |
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: