Bug 1212923
| Summary: | [SELinux]: [Snapshot]: SELinux policy updates required in RHEL-7.1 for gluster-snapshot | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | RamaKasturi <knarra> | ||||||||
| Component: | selinux-policy | Assignee: | Miroslav Grepl <mgrepl> | ||||||||
| Status: | CLOSED ERRATA | QA Contact: | Milos Malik <mmalik> | ||||||||
| Severity: | high | Docs Contact: | |||||||||
| Priority: | unspecified | ||||||||||
| Version: | 7.0 | CC: | amukherj, asengupt, ashah, bugs, gluster-bugs, jkurik, knarra, lvrabec, mgrepl, mmalik, plautrba, pprakash, pvrabec, rhsc-qe-bugs, rjoseph, sasundar, sgraf, ssekidde | ||||||||
| Target Milestone: | pre-dev-freeze | Keywords: | ZStream | ||||||||
| Target Release: | 7.1 | ||||||||||
| Hardware: | All | ||||||||||
| OS: | Linux | ||||||||||
| Whiteboard: | |||||||||||
| Fixed In Version: | selinux-policy-3.13.1-29.el7 | Doc Type: | Bug Fix | ||||||||
| Doc Text: | Story Points: | --- | |||||||||
| Clone Of: | |||||||||||
| : | 1231930 1232134 (view as bug list) | Environment: | |||||||||
| Last Closed: | 2015-11-19 10:32:14 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: | |||||||||||
| Bug Depends On: | |||||||||||
| Bug Blocks: | 1212796, 1231930, 1232134 | ||||||||||
| Attachments: |
|
||||||||||
|
Description
RamaKasturi
2015-04-17 16:54:32 UTC
glusterd_t is a permissive domain in RHEL-6.7, but glusterd_t is not a permissive domain in RHEL-7.1. That's why glusterd cannot execute lvm or xfs_growfs programs (see the attachment). Moving from the GlusterFS product to RHEL-7/selinux-policy. $ sesearch -A -s glusterd_t -t lvm_t -c process Found 1 semantic av rules: allow glusterd_t lvm_t : process transition ; $ sesearch -A -s glusterd_t -t fsadm_t -c process Found 1 semantic av rules: allow glusterd_t fsadm_t : process transition ; $ matchpathcon /var/lib/glusterd/hooks/*/*.sh /var/lib/glusterd/hooks/*/*.sh system_u:object_r:bin_t:s0 I see the following avc in the system. Can you check if this has to be fixed? #============= glusterd_t ============== allow glusterd_t fixed_disk_device_t:blk_file getattr; #!!!! This avc is allowed in the current policy allow glusterd_t random_device_t:chr_file getattr; Could you attach the SELinux denials? We can work around both issues, but I would like to see if there is something new that I missed. # ausearch -m avc -m user_avc -m selinux_err -i -ts today Hi Milos, I have run the command mentioned in comment 13 and attached the output file in the link below. http://rhsqe-repo.lab.eng.blr.redhat.com/sosreports/rhsc/1212923/ Thanks kasturi The /dev/log is mislabeled on your machine. # ls -Z /dev/log Please run following command to fix it: # restorecon -v /dev/log All denials in the attachment are caused by this issue. Snapshot creation is successful with SELinux in Enforcing mode on RHEL7.1 but I see the following AVC logged in audit.log
--------------------Part of audit.log---------------------
type=SYSCALL msg=audit(1434024359.865:469285): arch=c000003e syscall=42 success=no exit=-13 a0=a a1=7f0eef7ad740 a2=6e a3=3d items=0 ppid=1 pid=1215 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="setroubleshootd" exe="/usr/bin/python2.7" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1434024359.865:469286): avc: denied { write } for pid=1215 comm="setroubleshootd" name="log" dev="devtmpfs" ino=8426 scontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=sock_file
type=SYSCALL msg=audit(1434024359.865:469286): arch=c000003e syscall=42 success=no exit=-13 a0=a a1=7f0eef7ad740 a2=6e a3=34 items=0 ppid=1 pid=1215 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="setroubleshootd" exe="/usr/bin/python2.7" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1434024359.865:469287): avc: denied { write } for pid=1215 comm="setroubleshootd" name="log" dev="devtmpfs" ino=8426 scontext=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:device_t:s0 tclass=sock_file
type=SYSCALL msg=audit(1434024359.865:469287): arch=c000003e syscall=42 success=no exit=-13 a0=a a1=7f0eef7ad740 a2=6e a3=40 items=0 ppid=1 pid=1215 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="setroubleshootd" exe="/usr/bin/python2.7" subj=system_u:system_r:setroubleshootd_t:s0-s0:c0.c1023 key=(null)
-----------------------------------------------------------------
cat audit.log |audit2allow
#============= audisp_t ==============
allow audisp_t device_t:sock_file write;
#============= auditd_t ==============
allow auditd_t device_t:sock_file write;
#============= setroubleshootd_t ==============
allow setroubleshootd_t device_t:sock_file write;
-----------------------------------------------------------------
rpm -qa |grep selinux
selinux-policy-3.13.1-26.el7.noarch
selinux-policy-targeted-3.13.1-26.el7.noarch
libselinux-utils-2.2.2-6.el7.x86_64
libselinux-python-2.2.2-6.el7.x86_64
libselinux-2.2.2-6.el7.x86_64
You see the same problem as kasturi. Please follow comment#15. Hi Milos, Followed steps in comment15, I see the below AVC after snapshot creation: type=AVC msg=audit(1434111195.127:16089268): avc: denied { getattr } for pid=27395 comm="xfs_db" path="/dev/dm-23" dev="devtmpfs" ino=21845028 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file type=SYSCALL msg=audit(1434111195.127:16089268): arch=c000003e syscall=4 success=no exit=-13 a0=7fff292f4f15 a1=7fff292f2fb0 a2=7fff292f2fb0 a3=7fff292f2d30 items=0 ppid=27392 pid=27395 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="xfs_db" exe="/usr/sbin/xfs_db" subj=system_u:system_r:glusterd_t:s0 key=(null) type=AVC msg=audit(1434111195.137:16089269): avc: denied { getattr } for pid=27400 comm="xfs_db" path="/dev/dm-24" dev="devtmpfs" ino=21845031 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file type=SYSCALL msg=audit(1434111195.137:16089269): arch=c000003e syscall=4 success=no exit=-13 a0=7fff15d2ef15 a1=7fff15d2ce90 a2=7fff15d2ce90 a3=7fff15d2cc10 items=0 ppid=27396 pid=27400 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm="xfs_db" exe="/usr/sbin/xfs_db" subj=system_u:system_r:glusterd_t:s0 key=(null) cat audit.log |audit2allow #============= glusterd_t ============== allow glusterd_t fixed_disk_device_t:blk_file getattr; rpm -qa |grep selinux libselinux-utils-2.2.2-6.el7.x86_64 libselinux-python-2.2.2-6.el7.x86_64 selinux-policy-3.13.1-27.el7.noarch libselinux-2.2.2-6.el7.x86_64 selinux-policy-targeted-3.13.1-27.el7.noarch Following commands (executed before your tests) should help here: # semanage fcontext -a -t fsadm_exec_t /usr/sbin/xfs_db # restorecon -Rv /usr/sbin Hi Miroslav, I see the bug has been moved to Assigned state. Could you please let us know why this has been done? Scheduler fails to create snapshots on RHEL7.1 when SELinux is in Enforcing mode.
When SELinux is in Permissive mode, Scheduler creates snapshots but I see the below AVC
grep "AVC" /var/log/audit/audit.log
type=USER_AVC msg=audit(1434380101.086:4771): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc: received setenforce notice (enforcing=0) exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
type=AVC msg=audit(1434385206.279:4911): avc: denied { getattr } for pid=12694 comm="xfs_db" path="/dev/dm-23" dev="devtmpfs" ino=271817 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file
type=AVC msg=audit(1434385206.279:4912): avc: denied { read } for pid=12694 comm="xfs_db" name="dm-23" dev="devtmpfs" ino=271817 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file
type=AVC msg=audit(1434385206.279:4912): avc: denied { open } for pid=12694 comm="xfs_db" path="/dev/dm-23" dev="devtmpfs" ino=271817 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file
type=AVC msg=audit(1434385206.279:4913): avc: denied { write } for pid=12694 comm="xfs_db" name="dm-23" dev="devtmpfs" ino=271817 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file
type=AVC msg=audit(1434385206.279:4914): avc: denied { ioctl } for pid=12694 comm="xfs_db" path="/dev/dm-23" dev="devtmpfs" ino=271817 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file
==============================================================
rpm -qa |grep selinux
selinux-policy-targeted-3.13.1-27.el7.noarch
libselinux-utils-2.2.2-6.el7.x86_64
libselinux-python-2.2.2-6.el7.x86_64
libselinux-2.2.2-6.el7.x86_64
selinux-policy-3.13.1-27.el7.noarch
================================================================
cat audit.log |audit2allow
#============= glusterd_t ==============
allow glusterd_t fixed_disk_device_t:blk_file { read write getattr open ioctl };
Executed following commands and tried snapshot operations, no avc were reported in the log. # semanage fcontext -a -t fsadm_exec_t /usr/sbin/xfs_db # restorecon -Rv /usr/sbin Using scheduler to create snapshots does not work in 'Enforcing' mode. Tried scheduling snapshots with SElinux in Permissive mode and snapshots were created successfully and no avc denials were reported in the log ausearch -m avc -m user_avc -m selinux_err -i -ts today ---- type=USER_AVC msg=audit(06/16/2015 00:55:01.251:6173) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='avc: received setenforce notice (enforcing=1) exe=/usr/lib/systemd/systemd sauid=root hostname=? addr=? terminal=?' ---- type=USER_AVC msg=audit(06/16/2015 00:55:01.251:6174) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='avc: received policyload notice (seqno=6) exe=/usr/lib/systemd/systemd sauid=root hostname=? addr=? terminal=?' ---- type=USER_AVC msg=audit(06/16/2015 01:01:01.884:6186) : pid=1 uid=root auid=unset ses=unset subj=system_u:system_r:init_t:s0 msg='avc: received setenforce notice (enforcing=0) exe=/usr/lib/systemd/systemd sauid=root hostname=? addr=? terminal=?' Created attachment 1039073 [details]
audit.log
Created attachment 1039074 [details]
audit.log
Executed the following commands and tried few more snapshot operations faced below avc denials:
semanage fcontext -a -t fsadm_exec_t /usr/sbin/xfs_db
restorecon -Rv /usr/sbin
restorecon -v /dev/log
grep "AVC" /var/log/audit/audit.log
type=USER_AVC msg=audit(1434468618.176:4239): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='avc: received policyload notice (seqno=10) exe="/usr/lib/systemd/systemd" sauid=0 hostname=? addr=? terminal=?'
type=AVC msg=audit(1434468674.231:4356): avc: denied { getattr } for pid=15490 comm="glusterd" path="/dev/dm-23" dev="devtmpfs" ino=2083192 scontext=system_u:system_r:glusterd_t:s0 tcontext=system_u:object_r:fixed_disk_device_t:s0 tclass=blk_file
[root@rhsqe-vm07 audit]# cat audit.log |audit2allow
#============= glusterd_t ==============
allow glusterd_t fixed_disk_device_t:blk_file getattr;
rpm -qa |grep selinux
selinux-policy-3.13.1-27.el7.noarch
selinux-policy-targeted-3.13.1-27.el7.noarch
libselinux-2.2.2-6.el7.x86_64
libselinux-utils-2.2.2-6.el7.x86_64
libselinux-python-2.2.2-6.el7.x86_64
Please test it with the latest policy builds. -28.el7 builds Used Scheduler to create Snapshots in Permissive mode,I was able to see the below avc in the log.
grep "AVC" /var/log/audit/audit.log
type=AVC msg=audit(1434560953.008:31062): avc: denied { sigkill } for pid=21362 comm="glusterfs" scontext=system_u:system_r:glusterd_t:s0 tcontext=unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023 tclass=process
cat audit.log |audit2allow
#============= glusterd_t ==============
allow glusterd_t unconfined_t:process sigkill;
rpm -qa |grep selinux
libselinux-utils-2.2.2-6.el7.x86_64
libselinux-python-2.2.2-6.el7.x86_64
selinux-policy-targeted-3.13.1-28.el7.noarch
libselinux-2.2.2-6.el7.x86_64
selinux-policy-3.13.1-28.el7.noarch
Created attachment 1039903 [details] audot logs for comment 29 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-2015-2300.html |