Description of problem: # restorecon -Rv /var restorecon reset /var/lock/LCK.. context unconfined_u:object_r:apcupsd_lock_t:s0->unconfined_u:object_r:var_lock_t:s0 # Version-Release number of selected component (if applicable): apcupsd-3.14.12-1.el6.x86_64 apcupsd-cgi-3.14.12-1.el6.x86_64 selinux-policy-3.7.19-279.el6.noarch selinux-policy-targeted-3.7.19-279.el6.noarch How reproducible: * always Steps to Reproduce: 1. get a RHEL-6.7 machine (active targeted policy) 2. start the apcupsd service 3. restorecon -Rv /var 4. stop the apcupsd service 5. search for SELinux denials Actual results (enforcing mode): ---- type=PATH msg=audit(11/27/2015 04:54:50.269:362) : item=0 name=/var/lock/LCK.. inode=135046 dev=fc:01 mode=file,644 ouid=root ogid=root rdev=00:00 obj=unconfined_u:object_r:var_lock_t:s0 nametype=NORMAL type=CWD msg=audit(11/27/2015 04:54:50.269:362) : cwd=/ type=SYSCALL msg=audit(11/27/2015 04:54:50.269:362) : arch=x86_64 syscall=open success=no exit=-13(Permission denied) a0=0xbf32ac a1=O_RDONLY a2=0x20 a3=0x7f4e91f8ca20 items=1 ppid=1 pid=2506 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=4 comm=apcupsd exe=/sbin/apcupsd subj=unconfined_u:system_r:apcupsd_t:s0 key=(null) type=AVC msg=audit(11/27/2015 04:54:50.269:362) : avc: denied { read } for pid=2506 comm=apcupsd name=LCK.. dev=vda1 ino=135046 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=unconfined_u:object_r:var_lock_t:s0 tclass=file ---- Expected results: * no SELinux denials # matchpathcon /var/lock/LCK.. /var/lock/LCK.. system_u:object_r:apcupsd_lock_t:s0 #
Ok we have /var/lock/subsys/apcupsd -- gen_context(system_u:object_r:apcupsd_lock_t,s0) /var/lock/LCK.. -- gen_context(system_u:object_r:apcupsd_lock_t,s0) labeling in RHEL-7.
If SSSD is running and nsswitch.conf is configured in certain way then following AVC appears in enforcing mode: ---- type=PATH msg=audit(12/03/2015 11:18:45.061:61) : item=0 name=(null) inode=25543 dev=fc:03 mode=dir,755 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:sssd_var_lib_t:s0 nametype=NORMAL type=SOCKADDR msg=audit(12/03/2015 11:18:45.061:61) : saddr=local /var/lib/sss/pipes/nss type=SYSCALL msg=audit(12/03/2015 11:18:45.061:61) : arch=x86_64 syscall=connect success=no exit=-13(Permission denied) a0=0x3 a1=0x7ffd7b1cb550 a2=0x6e a3=0x7ffd7b1cb1e0 items=1 ppid=5697 pid=5708 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=tty sgid=tty fsgid=tty tty=(none) ses=1 comm=wall exe=/usr/bin/wall subj=unconfined_u:system_r:apcupsd_t:s0 key=(null) type=AVC msg=audit(12/03/2015 11:18:45.061:61) : avc: denied { search } for pid=5708 comm=wall name=sss dev=vda3 ino=25543 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:object_r:sssd_var_lib_t:s0 tclass=dir ---- The denial is usually accompanied by following messages in the terminal: # Broadcast message from root (Thu Dec 3 11:24:36 2015): Warning communications lost with UPS #
Following AVCs appeared in permissive mode: ---- type=PATH msg=audit(12/03/2015 11:31:14.957:133) : item=0 name=/var/lib/sss/mc/passwd inode=437 dev=fc:03 mode=file,644 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:sssd_public_t:s0 nametype=NORMAL type=CWD msg=audit(12/03/2015 11:31:14.957:133) : cwd=/ type=SYSCALL msg=audit(12/03/2015 11:31:14.957:133) : arch=x86_64 syscall=open success=yes exit=3 a0=0x9822f0 a1=O_RDONLY|O_CLOEXEC a2=0x7ffc1816e12c a3=0x7ffc1816ddd0 items=1 ppid=10213 pid=10606 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1 comm=apccontrol exe=/bin/bash subj=unconfined_u:system_r:apcupsd_t:s0 key=(null) type=AVC msg=audit(12/03/2015 11:31:14.957:133) : avc: denied { open } for pid=10606 comm=apccontrol name=passwd dev=vda3 ino=437 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file type=AVC msg=audit(12/03/2015 11:31:14.957:133) : avc: denied { read } for pid=10606 comm=apccontrol name=passwd dev=vda3 ino=437 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file type=AVC msg=audit(12/03/2015 11:31:14.957:133) : avc: denied { search } for pid=10606 comm=apccontrol name=mc dev=vda3 ino=25545 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=dir type=AVC msg=audit(12/03/2015 11:31:14.957:133) : avc: denied { search } for pid=10606 comm=apccontrol name=sss dev=vda3 ino=25543 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:object_r:sssd_var_lib_t:s0 tclass=dir ---- type=SYSCALL msg=audit(12/03/2015 11:31:14.961:134) : arch=x86_64 syscall=fstat success=yes exit=0 a0=0x3 a1=0x7ffc1816e090 a2=0x7ffc1816e090 a3=0x7ffc1816de00 items=0 ppid=10213 pid=10606 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1 comm=apccontrol exe=/bin/bash subj=unconfined_u:system_r:apcupsd_t:s0 key=(null) type=AVC msg=audit(12/03/2015 11:31:14.961:134) : avc: denied { getattr } for pid=10606 comm=apccontrol path=/var/lib/sss/mc/passwd dev=vda3 ino=437 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:object_r:sssd_public_t:s0 tclass=file ---- type=PATH msg=audit(12/03/2015 11:31:14.961:135) : item=0 name=(null) inode=370 dev=fc:03 mode=socket,666 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:sssd_var_lib_t:s0 nametype=NORMAL type=SOCKADDR msg=audit(12/03/2015 11:31:14.961:135) : saddr=local /var/lib/sss/pipes/nss type=SYSCALL msg=audit(12/03/2015 11:31:14.961:135) : arch=x86_64 syscall=connect success=yes exit=0 a0=0x4 a1=0x7ffc1816e0f0 a2=0x6e a3=0x7ffc1816dd80 items=1 ppid=10213 pid=10606 auid=root uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=1 comm=apccontrol exe=/bin/bash subj=unconfined_u:system_r:apcupsd_t:s0 key=(null) type=AVC msg=audit(12/03/2015 11:31:14.961:135) : avc: denied { connectto } for pid=10606 comm=apccontrol path=/var/lib/sss/pipes/nss scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:system_r:sssd_t:s0 tclass=unix_stream_socket type=AVC msg=audit(12/03/2015 11:31:14.961:135) : avc: denied { write } for pid=10606 comm=apccontrol name=nss dev=vda3 ino=370 scontext=unconfined_u:system_r:apcupsd_t:s0 tcontext=system_u:object_r:sssd_var_lib_t:s0 tclass=sock_file ----
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://rhn.redhat.com/errata/RHBA-2016-0763.html