Bug 1437772

Summary: sealert reports system Unknown
Product: Red Hat Enterprise Linux 7 Reporter: Milos Malik <mmalik>
Component: setroubleshootAssignee: Vit Mojzis <vmojzis>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: lvrabec, mgrepl, mmalik, plautrba, tim
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: setroubleshoot-3.2.30-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1656501 (view as bug list) Environment:
Last Closed: 2018-10-30 09:47:31 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 Milos Malik 2017-03-31 07:05:13 UTC
Description of problem:
* setroubleshoot does not recognize all object classes, which can appear in SELinux denials

Version-Release number of selected component (if applicable):
setroubleshoot-3.2.28-1.el7.x86_64
setroubleshoot-plugins-3.0.65-1.el7.noarch
setroubleshoot-server-3.2.28-1.el7.x86_64

How reproducible:
* always

Steps to Reproduce:
1. install the setroubleshoot-server RPM
2. restart the audit daemon
3. useradd -Z user_u user-user
4. passwd user-user
5. ssh user-user@localhost
6. dmesg # following error message is expected
dmesg: read kernel buffer failed: Permission denied
7. sealert -l '*'

Actual results - sealert prints 2 reports, one of them starts with:

SELinux is preventing /usr/bin/dmesg from syslog_read access on the system Unknown.

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

If you believe that dmesg should be allowed syslog_read access on the Unknown system by default.


Expected results:
* the 'system' class should be part of the class_dict in /usr/lib64/python2.7/site-packages/setroubleshoot/signature.py file

Comment 1 Milos Malik 2017-03-31 09:50:13 UTC
When https://github.com/SELinuxProject/selinux-testsuite is used then following setroubleshoot reports can be generated:
# sealert -l '*' | grep Unknown | grep -v -e ^Port -e ^Target
SELinux is preventing /tmp/tmp.Z3WxSIyByR/selinux-testsuite/tests/mmap/mmap_zero from mmap_zero access on the memprotect Unknown.
If you believe that mmap_zero should be allowed mmap_zero access on the Unknown memprotect by default.
SELinux is preventing /tmp/tmp.Z3WxSIyByR/selinux-testsuite/tests/inet_socket/client from recv access on the peer Unknown.
If you believe that client should be allowed recv access on the Unknown peer by default.
SELinux is preventing /tmp/tmp.Z3WxSIyByR/selinux-testsuite/tests/inet_socket/client from recv access on the peer Unknown.
If you believe that client should be allowed recv access on the Unknown peer by default.
SELinux is preventing /tmp/tmp.Z3WxSIyByR/selinux-testsuite/tests/inet_socket/client from recv access on the peer Unknown.
If you believe that client should be allowed recv access on the Unknown peer by default.
SELinux is preventing /tmp/tmp.Z3WxSIyByR/selinux-testsuite/tests/inet_socket/client from polmatch access on the association Unknown.
If you believe that client should be allowed polmatch access on the Unknown association by default.
SELinux is preventing swapper/0 from send access on the packet Unknown.
If you believe that 0 should be allowed send access on the Unknown packet by default.
SELinux is preventing swapper/0 from send access on the packet Unknown.
If you believe that 0 should be allowed send access on the Unknown packet by default.
SELinux is preventing client from recv access on the packet Unknown.
If you believe that client should be allowed recv access on the Unknown packet by default.
SELinux is preventing /tmp/tmp.Z3WxSIyByR/selinux-testsuite/tests/cap_userns/userns_child_exec from sys_admin access on the cap_userns Unknown.
If you believe that userns_child_exec should be allowed sys_admin access on the Unknown cap_userns by default.
#

Comment 2 Milos Malik 2017-07-24 15:23:27 UTC
# rpm -qa selinux-policy\*
selinux-policy-targeted-3.13.1-166.el7.noarch
selinux-policy-3.13.1-166.el7.noarch
# ausearch -m avc -m selinux_err -i
----
type=PROCTITLE msg=audit(07/24/2017 11:21:02.483:319) : proctitle=dmesg 
type=SYSCALL msg=audit(07/24/2017 11:21:02.483:319) : arch=x86_64 syscall=open success=no exit=EACCES(Permission denied) a0=0x4061a4 a1=O_RDONLY|O_NONBLOCK a2=0x0 a3=0x7ffe9f8fc090 items=0 ppid=10444 pid=10464 auid=user-user uid=user-user gid=user-user euid=user-user suid=user-user fsuid=user-user egid=user-user sgid=user-user fsgid=user-user tty=pts1 ses=5 comm=dmesg exe=/usr/bin/dmesg subj=user_u:user_r:user_t:s0 key=(null) 
type=AVC msg=audit(07/24/2017 11:21:02.483:319) : avc:  denied  { read } for  pid=10464 comm=dmesg name=kmsg dev="devtmpfs" ino=4862 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:kmsg_device_t:s0 tclass=chr_file 
----
type=PROCTITLE msg=audit(07/24/2017 11:21:02.484:320) : proctitle=dmesg 
type=SYSCALL msg=audit(07/24/2017 11:21:02.484:320) : arch=x86_64 syscall=syslog success=no exit=EACCES(Permission denied) a0=0xa a1=0x0 a2=0x0 a3=0x7ffe9f8fc090 items=0 ppid=10444 pid=10464 auid=user-user uid=user-user gid=user-user euid=user-user suid=user-user fsuid=user-user egid=user-user sgid=user-user fsgid=user-user tty=pts1 ses=5 comm=dmesg exe=/usr/bin/dmesg subj=user_u:user_r:user_t:s0 key=(null) 
type=AVC msg=audit(07/24/2017 11:21:02.484:320) : avc:  denied  { syslog_read } for  pid=10464 comm=dmesg scontext=user_u:user_r:user_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=system 
----
type=PROCTITLE msg=audit(07/24/2017 11:21:02.485:321) : proctitle=dmesg 
type=SYSCALL msg=audit(07/24/2017 11:21:02.485:321) : arch=x86_64 syscall=syslog success=no exit=EACCES(Permission denied) a0=0x3 a1=0x810030 a2=0x4008 a3=0x72 items=0 ppid=10444 pid=10464 auid=user-user uid=user-user gid=user-user euid=user-user suid=user-user fsuid=user-user egid=user-user sgid=user-user fsgid=user-user tty=pts1 ses=5 comm=dmesg exe=/usr/bin/dmesg subj=user_u:user_r:user_t:s0 key=(null) 
type=AVC msg=audit(07/24/2017 11:21:02.485:321) : avc:  denied  { syslog_read } for  pid=10464 comm=dmesg scontext=user_u:user_r:user_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=system 
----
# sealert -l '*'
SELinux is preventing dmesg from read access on the chr_file kmsg.

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

If you believe that dmesg should be allowed read access on the kmsg chr_file 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 'dmesg' --raw | audit2allow -M my-dmesg
# semodule -i my-dmesg.pp


Additional Information:
Source Context                user_u:user_r:user_t:s0
Target Context                system_u:object_r:kmsg_device_t:s0
Target Objects                kmsg [ chr_file ]
Source                        dmesg
Source Path                   dmesg
Port                          <Unknown>
Host                          qeos-117.lab.eng.rdu2.redhat.com
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-166.el7.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     qeos-117.lab.eng.rdu2.redhat.com
Platform                      Linux qeos-117.lab.eng.rdu2.redhat.com
                              3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57
                              EDT 2017 x86_64 x86_64
Alert Count                   1
First Seen                    2017-07-24 11:21:02 EDT
Last Seen                     2017-07-24 11:21:02 EDT
Local ID                      972fdce4-5796-401d-9835-b910a55ecfb9

Raw Audit Messages
type=AVC msg=audit(1500909662.483:319): avc:  denied  { read } for  pid=10464 comm="dmesg" name="kmsg" dev="devtmpfs" ino=4862 scontext=user_u:user_r:user_t:s0 tcontext=system_u:object_r:kmsg_device_t:s0 tclass=chr_file


Hash: dmesg,user_t,kmsg_device_t,chr_file,read

SELinux is preventing dmesg from syslog_read access on the system Unknown.

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

If you believe that dmesg should be allowed syslog_read access on the Unknown system 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 'dmesg' --raw | audit2allow -M my-dmesg
# semodule -i my-dmesg.pp


Additional Information:
Source Context                user_u:user_r:user_t:s0
Target Context                system_u:system_r:kernel_t:s0
Target Objects                Unknown [ system ]
Source                        dmesg
Source Path                   dmesg
Port                          <Unknown>
Host                          qeos-117.lab.eng.rdu2.redhat.com
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.13.1-166.el7.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     qeos-117.lab.eng.rdu2.redhat.com
Platform                      Linux qeos-117.lab.eng.rdu2.redhat.com
                              3.10.0-693.el7.x86_64 #1 SMP Thu Jul 6 19:56:57
                              EDT 2017 x86_64 x86_64
Alert Count                   2
First Seen                    2017-07-24 11:21:02 EDT
Last Seen                     2017-07-24 11:21:02 EDT
Local ID                      62e83f60-c8c4-40ce-8b83-3c9bc9e4d54d

Raw Audit Messages
type=AVC msg=audit(1500909662.485:321): avc:  denied  { syslog_read } for  pid=10464 comm="dmesg" scontext=user_u:user_r:user_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=system


Hash: dmesg,user_t,kernel_t,system,syslog_read
#

Comment 7 errata-xmlrpc 2018-10-30 09:47:31 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-2018:3100