RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1671129 - sbd daemon is not allowed to write/append to the /proc/sysrq-trigger
Summary: sbd daemon is not allowed to write/append to the /proc/sysrq-trigger
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.0
Hardware: Unspecified
OS: Linux
medium
medium
Target Milestone: rc
: 8.1
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On: 1673107 1682526
Blocks: 1671132
TreeView+ depends on / blocked
 
Reported: 2019-01-30 20:13 UTC by Miroslav Lisik
Modified: 2020-11-14 08:40 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1671132 (view as bug list)
Environment:
Last Closed: 2019-11-05 22:10:04 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1660147 0 unspecified CLOSED timeout-action triggered by sbd-daemon isn't configurable 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHBA-2019:3547 0 None None None 2019-11-05 22:11:03 UTC

Description Miroslav Lisik 2019-01-30 20:13:31 UTC
Description of problem:

Sbd daemon is not allowed to write/append to the /proc/sysrq-trigger for reboot/off/panic action.

Version-Release number of selected component (if applicable):
# rpm -qa selinux-policy*
selinux-policy-targeted-3.14.1-51.el8.noarch
selinux-policy-3.14.1-51.el8.noarch

How reproducible:
always

Steps to Reproduce:

1. install sbd package

# yum -y -q install sbd

2. create loop device:

# dd if=/dev/zero of=part-00 bs=1M count=400
# losetup /dev/loop0 part-00

3. create sbd heder on the loop device:

# sbd -d /dev/loop0 create
Initializing device /dev/loop0
Creating version 2.1 header on device 4 (uuid: db84b618-fb0b-4631-b6bc-54f3664d00a1)
Initializing 255 slots on device 4
Device /dev/loop0 is initialized.


4. prepare sbd configuration file

# cat > /etc/sysconfig/sbd <<EOF
# enable debug mode, which does panic instead of reboot
SBD_OPTS="-Z"
SBD_DELAY_START=no
SBD_DEVICE="/dev/loop0"
SBD_PACEMAKER=yes
SBD_STARTMODE=always
SBD_WATCHDOG_DEV=/dev/null
SBD_WATCHDOG_TIMEOUT=5
EOF

5. Modify sbd.service file to enable start service manualy:

# sed -i "s/^RefuseManualStart=.*$/RefuseManualStart=false/" /usr/lib/systemd/system/sbd.service
# sed -i "s/^RefuseManualStop=.*$/RefuseManualStop=false/" /usr/lib/systemd/system/sbd.service
# systemctl daemon-reload

6. Start the sbd service:

# systemctl start sbd
# systemctl show sbd -p ActiveState
ActiveState=active

7. Write 'reset' message to the slot on the sbd device (use sbd's list command to get the slot name).

# sbd -d /dev/loop0 message $(sbd -d /dev/loop0 list | awk '{print $2}') reset

Broadcast message from systemd-journald.lab.eng.brq.redhat.com (Wed 2019-01-30 20:39:16 CET):

sbd[17401]:    emerg: do_exit: Rebooting system: crashdump


8. check the avc messages

# getenforce
Enforcing
# ausearch -m avc -m user_avc -m selinux_err -m user_selinux_err -i
----
type=PROCTITLE msg=audit(01/30/2019 20:39:16.015:1576) : proctitle=sbd: inquisitor 
type=SYSCALL msg=audit(01/30/2019 20:39:16.015:1576) : arch=x86_64 syscall=openat success=no exit=EACCES(Permission denied) a0=0xffffff9c a1=0x5652549be7ad a2=O_WRONLY|O_CREAT|O_APPEND a3=0x1b6 items=0 ppid=1 pid=17401 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sbd exe=/usr/sbin/sbd subj=system_u:system_r:sbd_t:s0 key=(null) 
type=AVC msg=audit(01/30/2019 20:39:16.015:1576) : avc:  denied  { append } for  pid=17401 comm=sbd name=sysrq-trigger dev="proc" ino=4026532092 scontext=system_u:system_r:sbd_t:s0 tcontext=system_u:object_r:sysctl_t:s0 tclass=file permissive=0


Actual results:

sbd daemon is not allowed to write/append to the /proc/sysrq-trigger

Expected results:

sbd daemon is allowed to write/append to the /proc/sysrq-trigger

----------------
Additional info:

The same issue was in bz1455631 where apppend/sys_boot were denied.

a 'sys_boot' issue was solved by

allow sbd_t sbd_t : capability { sys_boot }

but

allow sbd_t proc_t : dir { write }

did not help to allow append to /proc/sysrq-trigger which has different context.

# ls -lZ /proc/sysrq-trigger 
--w-------. 1 root root system_u:object_r:sysctl_t:s0 0 Jan 24 09:52 /proc/sysrq-trigger

Comment 10 errata-xmlrpc 2019-11-05 22:10:04 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-2019:3547


Note You need to log in before you can comment on or make changes to this bug.