Bug 1623410
Summary: | avc denied { unlink} and { write }for comm="rpc.statd" after mask and unmask rpc-statd.service | |||
---|---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Yongcheng Yang <yoyang> | |
Component: | selinux-policy | Assignee: | Lukas Vrabec <lvrabec> | |
Status: | CLOSED WONTFIX | QA Contact: | Milos Malik <mmalik> | |
Severity: | unspecified | Docs Contact: | ||
Priority: | unspecified | |||
Version: | 7.6 | CC: | lvrabec, mgrepl, mmalik, plautrba, ssekidde, vmojzis, xzhou, yoyang, zpytela | |
Target Milestone: | rc | Keywords: | Reproducer | |
Target Release: | --- | |||
Hardware: | Unspecified | |||
OS: | Linux | |||
Whiteboard: | ||||
Fixed In Version: | Doc Type: | If docs needed, set a value | ||
Doc Text: | Story Points: | --- | ||
Clone Of: | ||||
: | 1629665 (view as bug list) | Environment: | ||
Last Closed: | 2019-02-28 19:17:02 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: | 1629665 |
Description
Yongcheng Yang
2018-08-29 09:59:29 UTC
HI, If you remove this pid file by hand. (# rm -rf /var/run/rpc.statd.pid) and reproduce the scenario, is it working? THanks, Lukas. The /var/run/rpc.statd.pid file is mislabeled. Following command should fix it: # restorecon -v /var/run/rpc.statd.pid I'm interested in how it got mislabeled. Hi Lukas and Milos, Thanks for your suggestions. Both "rm -f" and "restorecon -v" with file "/var/run/rpc.statd.pid" can fix this issue! ######################### # Without any workaround ######################### [root~]# echo > /var/log/audit/audit.log [root~]# systemctl mask --now rpc-statd.service rpcbind.service rpcbind.socket Created symlink from /etc/systemd/system/rpc-statd.service to /dev/null. Created symlink from /etc/systemd/system/rpcbind.service to /dev/null. Created symlink from /etc/systemd/system/rpcbind.socket to /dev/null. [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:11 /var/run/rpc.statd.pid [root~]# systemctl restart nfs [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:11 /var/run/rpc.statd.pid [root~]# mount localhost:/export_test /mnt -o vers=3 Failed to start rpc-statd.service: Unit is masked. mount.nfs: rpc.statd is not running but is required for remote locking. mount.nfs: Either use '-o nolock' to keep locks local, or start statd. mount.nfs: an incorrect mount option was specified [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:12 /var/run/rpc.statd.pid [root~]# systemctl unmask --now rpc-statd.service rpcbind.service rpcbind.socket Removed symlink /etc/systemd/system/rpc-statd.service. Removed symlink /etc/systemd/system/rpcbind.service. Removed symlink /etc/systemd/system/rpcbind.socket. [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:12 /var/run/rpc.statd.pid [root~]# cat /var/log/audit/audit.log | grep denied [root~]# systemctl start rpcbind [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:12 /var/run/rpc.statd.pid ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# cat /var/log/audit/audit.log | grep denied [root~]# systemctl start nfs [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid ls: cannot access /var/run/rpc.statd.pid: No such file or directory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# cat /var/log/audit/audit.log | grep denied type=AVC msg=audit(1535591621.609:1023): avc: denied { unlink } for pid=4716 comm="rpc.statd" name="rpc.statd.pid" dev="tmpfs" ino=138007 scontext=system_u:system_r:rpcd_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file permissive=0 type=AVC msg=audit(1535591621.609:1024): avc: denied { write } for pid=4716 comm="rpc.statd" name="rpc.statd.pid" dev="tmpfs" ino=138007 scontext=system_u:system_r:rpcd_t:s0 tcontext=unconfined_u:object_r:var_run_t:s0 tclass=file permissive=0 [root~]# ######################### # Removing rpc.statd.pid ######################### [root~]# echo > /var/log/audit/audit.log [root~]# systemctl mask --now rpc-statd.service rpcbind.service rpcbind.socket Created symlink from /etc/systemd/system/rpc-statd.service to /dev/null. Created symlink from /etc/systemd/system/rpcbind.service to /dev/null. Created symlink from /etc/systemd/system/rpcbind.socket to /dev/null. [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:19 /var/run/rpc.statd.pid [root~]# systemctl restart nfs [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:19 /var/run/rpc.statd.pid [root~]# mount localhost:/export_test /mnt -o vers=3 Failed to start rpc-statd.service: Unit is masked. mount.nfs: rpc.statd is not running but is required for remote locking. mount.nfs: Either use '-o nolock' to keep locks local, or start statd. mount.nfs: an incorrect mount option was specified [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:21 /var/run/rpc.statd.pid [root~]# systemctl unmask --now rpc-statd.service rpcbind.service rpcbind.socket Removed symlink /etc/systemd/system/rpc-statd.service. Removed symlink /etc/systemd/system/rpcbind.service. Removed symlink /etc/systemd/system/rpcbind.socket. [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:21 /var/run/rpc.statd.pid [root~]# systemctl start rpcbind [root~]# cat /var/log/audit/audit.log | grep denied [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:21 /var/run/rpc.statd.pid ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# rm /var/run/rpc.statd.pid <<<<<<<<<<<<<<<< rm: remove regular empty file ‘/var/run/rpc.statd.pid’? y [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid ls: cannot access /var/run/rpc.statd.pid: No such file or directory [root~]# systemctl start nfs [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 5 Aug 29 21:22 /var/run/rpc.statd.pid 5071 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# cat /var/log/audit/audit.log | grep denied [root~]# [root~]# systemctl status rpc-statd ● rpc-statd.service - NFS status monitor for NFSv2/3 locking. Loaded: loaded (/usr/lib/systemd/system/rpc-statd.service; static; vendor preset: disabled) Active: active (running) since Wed 2018-08-29 21:22:08 EDT; 2min 41s ago ... ######################### # Executing "restorecon -v" ######################### [root~]# echo > /var/log/audit/audit.log [root~]# systemctl mask --now rpc-statd.service rpcbind.service rpcbind.socket Created symlink from /etc/systemd/system/rpc-statd.service to /dev/null. Created symlink from /etc/systemd/system/rpcbind.service to /dev/null. Created symlink from /etc/systemd/system/rpcbind.socket to /dev/null. [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid ls: cannot access /var/run/rpc.statd.pid: No such file or directory [root~]# systemctl restart nfs [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid ls: cannot access /var/run/rpc.statd.pid: No such file or directory ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# mount localhost:/export_test /mnt -o vers=3 Failed to start rpc-statd.service: Unit is masked. mount.nfs: rpc.statd is not running but is required for remote locking. mount.nfs: Either use '-o nolock' to keep locks local, or start statd. mount.nfs: an incorrect mount option was specified [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:15 /var/run/rpc.statd.pid ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# systemctl unmask --now rpc-statd.service rpcbind.service rpcbind.socket Removed symlink /etc/systemd/system/rpc-statd.service. Removed symlink /etc/systemd/system/rpcbind.service. Removed symlink /etc/systemd/system/rpcbind.socket. [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:15 /var/run/rpc.statd.pid [root~]# systemctl start rpcbind [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:15 /var/run/rpc.statd.pid [root~]# cat /var/log/audit/audit.log | grep denied [root~]# restorecon -v /var/run/rpc.statd.pid <<<<<<<<<< restorecon reset /run/rpc.statd.pid context unconfined_u:object_r:var_run_t:s0->unconfined_u:object_r:rpcd_var_run_t:s0 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 0 Aug 29 21:15 /var/run/rpc.statd.pid [root~]# systemctl start nfs [root~]# ll /var/run/rpc.statd.pid ; [ $? -eq 0 ] && cat /var/run/rpc.statd.pid -rw-r--r--. 1 rpcuser rpcuser 5 Aug 29 21:18 /var/run/rpc.statd.pid 4868 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [root~]# cat /var/log/audit/audit.log | grep denied [root~]# systemctl status rpc-statd ● rpc-statd.service - NFS status monitor for NFSv2/3 locking. Loaded: loaded (/usr/lib/systemd/system/rpc-statd.service; static; vendor preset: disabled) Active: active (running) since Wed 2018-08-29 21:18:30 EDT; 26s ago ... Can I close this bug? So is this not a bug? Or something others' problem? I thought comment #2 and comment #3 are just workaround before. Shouldn't we go to investigate why "/var/run/rpc.statd.pid" got mislabeled? (In reply to Yongcheng Yang from comment #6) > So is this not a bug? Or something others' problem? > > I thought comment #2 and comment #3 are just workaround before. > > Shouldn't we go to investigate why "/var/run/rpc.statd.pid" got mislabeled? I agree. We should find out. This issue was not selected to be included in Red Hat Enterprise Linux 7.7 because it is seen either as low or moderate impact to a small number of use-cases. The next release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available. We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise, we recommend moving the request to Red Hat Enterprise Linux 8 if applicable. |