Bug 2112395

Summary: SELinux prevents samba-bgpd from talking to various sockets
Product: Red Hat Enterprise Linux 9 Reporter: Denis Karpelevich <dkarpele>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 9.1CC: asn, lvrabec, mmalik, nknazeko, ssekidde
Target Milestone: rcKeywords: AutoVerified, Triaged
Target Release: 9.1Flags: pm-rhel: mirror+
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-34.1.40-1.el9 Doc Type: Bug Fix
Doc Text:
Cause: When `rpcclient localhost -c 'enumprinters'` or a similar command is executed, SELinux prevents samba-bgqd connects to the cups service to get the list of configured printers. Consequence: Test is working only in Permissive mode. Fix: Allow samba-bgqd get a printer list Result: No AVC denials
Story Points: ---
Clone Of:
: 2114737 (view as bug list) Environment:
Last Closed: 2022-11-15 11:14:11 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:

Comment 1 Zdenek Pytela 2022-07-29 15:55:07 UTC
Denis,

Do you happen to know which action takes place here?

This is the denial interpreted:

----
type=PROCTITLE msg=audit(07/29/2022 11:01:59.156:2037) : proctitle=/usr/libexec/samba/samba-bgqd --ready-signal-fd=17 --parent-watch-fd=0 --debuglevel=0 -F 
type=AVC msg=audit(07/29/2022 11:01:59.156:2037) : avc:  denied  { read } for  pid=23653 comm=samba-bgqd name=cups.sock dev="tmpfs" ino=1442 scontext=system_u:system_r:winbind_rpcd_t:s0 tcontext=system_u:object_r:cupsd_var_run_t:s0 tclass=sock_file permissive=0 
type=SYSCALL msg=audit(07/29/2022 11:01:59.156:2037) : arch=x86_64 syscall=access success=no exit=EACCES(Permission denied) a0=0x7f4ebaa79812 a1=R_OK a2=0x4 a3=0xffffffff items=0 ppid=23651 pid=23653 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=samba-bgqd exe=/usr/libexec/samba/samba-bgqd subj=system_u:system_r:winbind_rpcd_t:s0 key=(null) 
rhel91# ls -lZ /usr/libexec/samba/samba-bgqd

Comment 3 Andreas Schneider 2022-08-01 05:12:39 UTC
When you do e.g. `rpcclient localhost -c 'enumprinters'` we will connect to cups to scan the printers which are configured. The printers are cached and we try to update them regularly.

Comment 6 Milos Malik 2022-08-01 07:04:50 UTC
Steps that I used to reproduce the issue:

0) get a RHEL-9.1 machine (targeted policy is active)
1) install various samba and cups packages
2) start the smb, nmb, winbind, cups services
3) # smbpasswd -a
4) # rpcclient localhost -c 'enumprinters'
5) # ausearch -m avc -m user_avc -m selinux_err -i -ts today

Comment 9 Zdenek Pytela 2022-08-05 15:34:01 UTC
Denis,

The issue will be addressed in Rawhide, RHEL 9.1 and 8.7. Are also some other releases affected?

Comment 19 errata-xmlrpc 2022-11-15 11:14:11 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 (selinux-policy bug fix and enhancement update), 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-2022:8283