Bug 1979121

Summary: [RHEL8.5] SELinux is preventing /usr/sbin/lldpad
Product: Red Hat Enterprise Linux 8 Reporter: guazhang <guazhang>
Component: selinux-policyAssignee: Zdenek Pytela <zpytela>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.5CC: lvrabec, mmalik, plautrba, ssekidde
Target Milestone: betaKeywords: Triaged
Target Release: 8.5Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.14.3-78.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-09 19:43:34 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 guazhang@redhat.com 2021-07-05 03:40:59 UTC
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Memory protection checking:     actual (secure)
Max kernel policy version:      33
selinux-policy-3.14.3-72.el8.noarch
----
time->Sun Jul  4 22:27:29 2021
type=PROCTITLE msg=audit(1625452049.961:55): proctitle=2F7573722F7362696E2F6C6C64706164002D74
type=SYSCALL msg=audit(1625452049.961:55): arch=c000003e syscall=44 success=no exit=-13 a0=3 a1=562bdbb615e0 a2=1a a3=0 items=0 ppid=1 pid=1170 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="lldpad" exe="/usr/sbin/lldpad" subj=system_u:system_r:lldpad_t:s0 key=(null)
type=AVC msg=audit(1625452049.961:55): avc:  denied  { sendto } for  pid=1170 comm="lldpad" path=002F636F6D2F696E74656C2F6C6C647061642F34383233 scontext=system_u:system_r:lldpad_t:s0 tcontext=system_u:system_r:kdumpctl_t:s0 tclass=unix_dgram_socket permissive=0
----
time->Sun Jul  4 22:27:31 2021
type=PROCTITLE msg=audit(1625452051.970:56): proctitle=2F7573722F7362696E2F6C6C64706164002D74
type=SYSCALL msg=audit(1625452051.970:56): arch=c000003e syscall=44 success=no exit=-13 a0=3 a1=562bdbb615e0 a2=12 a3=0 items=0 ppid=1 pid=1170 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="lldpad" exe="/usr/sbin/lldpad" subj=system_u:system_r:lldpad_t:s0 key=(null)
type=AVC msg=audit(1625452051.970:56): avc:  denied  { sendto } for  pid=1170 comm="lldpad" path=002F636F6D2F696E74656C2F6C6C647061642F34383237 scontext=system_u:system_r:lldpad_t:s0 tcontext=system_u:system_r:kdumpctl_t:s0 tclass=unix_dgram_socket permissive=0



[root@storageqe-64 ~]# sealert -l 26b75a38-91f6-4972-823e-16471041e851
SELinux is preventing /usr/sbin/lldpad from sendto access on the unix_dgram_socket @/com/intel/lldpad/4880.

*****  Plugin catchall (100. confidence) suggests   **************************

If you believe that lldpad should be allowed sendto access on the 4880 unix_dgram_socket 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:
# ausearch -c 'lldpad' --raw | audit2allow -M my-lldpad
# semodule -X 300 -i my-lldpad.pp


Additional Information:
Source Context                system_u:system_r:lldpad_t:s0
Target Context                system_u:system_r:kdumpctl_t:s0
Target Objects                @/com/intel/lldpad/4880 [ unix_dgram_socket ]
Source                        lldpad
Source Path                   /usr/sbin/lldpad
Port                          <Unknown>
Host                          storageqe-64.rhts.eng.pek2.redhat.com
Source RPM Packages           
Target RPM Packages           
SELinux Policy RPM            selinux-policy-targeted-3.14.3-72.el8.noarch
Local Policy RPM              selinux-policy-targeted-3.14.3-72.el8.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     storageqe-64.rhts.eng.pek2.redhat.com
Platform                      Linux storageqe-64.rhts.eng.pek2.redhat.com
                              4.18.0-320.el8.x86_64 #1 SMP Thu Jul 1 15:28:02
                              EDT 2021 x86_64 x86_64
Alert Count                   4
First Seen                    2021-07-04 22:27:29 EDT
Last Seen                     2021-07-04 22:45:57 EDT
Local ID                      26b75a38-91f6-4972-823e-16471041e851

Raw Audit Messages
type=AVC msg=audit(1625453157.487:54): avc:  denied  { sendto } for  pid=1185 comm="lldpad" path=002F636F6D2F696E74656C2F6C6C647061642F34383830 scontext=system_u:system_r:lldpad_t:s0 tcontext=system_u:system_r:kdumpctl_t:s0 tclass=unix_dgram_socket permissive=0


Hash: lldpad,lldpad_t,kdumpctl_t,unix_dgram_socket,sendto

[root@storageqe-64 ~]# ausearch -c 'lldpad' --raw | audit2allow -M my-lldpad
Nothing to do
[root@storageqe-64 ~]# semodule -X 300 -i my-lldpad.pp
libsemanage.map_file: Unable to open my-lldpad.pp
 (No such file or directory).
libsemanage.semanage_direct_install_file: Unable to read file my-lldpad.pp
 (No such file or directory).
semodule:  Failed on my-lldpad.pp!
[root@storageqe-64 ~]# 


https://beaker.engineering.redhat.com/recipes/10240966#task128389646,task128389647

Comment 2 Zdenek Pytela 2021-07-16 08:27:03 UTC
Seems one part of the communication is allowed:

# sesearch -A -s lldpad_t -t kdumpctl_t -c unix_dgram_socket -p sendto
# sesearch -A -s kdumpctl_t -t lldpad_t -c unix_dgram_socket -p sendto
allow unconfined_domain_type domain:unix_dgram_socket { accept append bind connect create getattr getopt ioctl listen lock map name_bind read recv_msg recvfrom relabelfrom relabelto send_msg sendto setattr setopt shutdown write };

Comment 3 guazhang@redhat.com 2021-07-19 10:31:49 UTC
Hi,

from the job the case  hit the error, but sometimes just reboot also hit it too, so no clear reproducer.

if you want to know the case steps, please refer below steps.

# get fcoe luns mpatha
# vgcreate  testvg /dev/mapper/mpatha
# lvcreate -L500M -n test_lv testvg -y
# mkfs.xfs -f /dev/mapper/testvg-test_lv
# echo '/dev/mapper/testvg-test_lv	/mnt/mytest	xfs	_netdev	0 2' >> /etc/fstab
# mount /mnt/mytest
# reboot
# check the lv if mounted 
# dt flags=direct oncerr=abort iodir=forward align=0 min=b max=256k pattern=incr dispose=keep disable=eof,pstats slices=0 runtime=120 of=/mnt/mytest/dt.img 
# reboot 
# check the lv if mounted 
# umount /mnt/mytest
# wipefs --all /dev/mapper/testvg-test_lv
# remove lvm

https://beaker.engineering.redhat.com/recipes/10326409#tasks

Comment 4 Zdenek Pytela 2021-08-11 17:35:41 UTC
I've submitted a Fedora PR to address the issue:
https://github.com/fedora-selinux/selinux-policy/pull/831

Comment 7 Zdenek Pytela 2021-08-23 11:43:37 UTC
I've submitted a Fedora PR to correct the previous solution and the right domain kdumpctl_t:
https://github.com/fedora-selinux/selinux-policy/pull/842

Comment 15 errata-xmlrpc 2021-11-09 19:43:34 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-2021:4420