Bug 1648864 - SELinux is preventing (vnstatd) from 'mounton' accesses on the directory /run/systemd/unit-root/var/lib/vnstat.
Summary: SELinux is preventing (vnstatd) from 'mounton' accesses on the directory /run...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 29
Hardware: x86_64
OS: Linux
medium
low
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: abrt_hash:be2798cce8a0430045b1e55e5c4...
: 1705474 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-11-12 10:34 UTC by Christian Kujau
Modified: 2019-08-18 01:56 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.14.2-44.fc29 selinux-policy-3.14.2-64.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-18 01:56:34 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Christian Kujau 2018-11-12 10:34:26 UTC
Description of problem:
This alert is displayed right after boot when vnstat.service is enabled. However, vnstatd appears to start, despite this warning.
SELinux is preventing (vnstatd) from 'mounton' accesses on the directory /run/systemd/unit-root/var/lib/vnstat.

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label. 
/run/systemd/unit-root/var/lib/vnstat default label should be init_var_run_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /run/systemd/unit-root/var/lib/vnstat

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that (vnstatd) should be allowed mounton access on the vnstat directory 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 '(vnstatd)' --raw | audit2allow -M my-vnstatd
# semodule -X 300 -i my-vnstatd.pp

Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                system_u:object_r:vnstatd_var_lib_t:s0
Target Objects                /run/systemd/unit-root/var/lib/vnstat [ dir ]
Source                        (vnstatd)
Source Path                   (vnstatd)
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.2-42.fc29.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.18.17-300.fc29.x86_64 #1 SMP Mon
                              Nov 5 17:56:16 UTC 2018 x86_64 x86_64
Alert Count                   32
First Seen                    2018-11-05 15:01:50 PST
Last Seen                     2018-11-12 02:31:18 PST
Local ID                      bb1a0ad6-3ecb-4666-b7d1-22c00c305c88

Raw Audit Messages
type=AVC msg=audit(1542018678.432:141): avc:  denied  { mounton } for  pid=972 comm="(vnstatd)" path="/run/systemd/unit-root/var/lib/vnstat" dev="nvme0n1p6" ino=537650597 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:vnstatd_var_lib_t:s0 tclass=dir permissive=0


Hash: (vnstatd),init_t,vnstatd_var_lib_t,dir,mounton

Version-Release number of selected component:
selinux-policy-3.14.2-42.fc29.noarch

Additional info:
component:      selinux-policy
reporter:       libreport-2.9.6
hashmarkername: setroubleshoot
kernel:         4.18.17-300.fc29.x86_64
type:           libreport

Comment 1 Milos Malik 2018-11-13 10:38:07 UTC
----
type=PROCTITLE msg=audit(11/13/2018 11:37:38.153:766) : proctitle=(vnstatd) 
type=PATH msg=audit(11/13/2018 11:37:38.153:766) : item=0 name=/run/systemd/unit-root/var/lib/vnstat inode=18618693 dev=fc:02 mode=dir,755 ouid=vnstat ogid=vnstat rdev=00:00 obj=system_u:object_r:vnstatd_var_lib_t:s0 nametype=NORMAL cap_fp=none cap_fi=none cap_fe=0 cap_fver=0 
type=CWD msg=audit(11/13/2018 11:37:38.153:766) : cwd=/ 
type=SYSCALL msg=audit(11/13/2018 11:37:38.153:766) : arch=x86_64 syscall=mount success=no exit=EACCES(Permission denied) a0=0x56112d8797f0 a1=0x56112d8401d0 a2=0x0 a3=MS_BIND|MS_REC items=1 ppid=1 pid=1874 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=(vnstatd) exe=/usr/lib/systemd/systemd subj=system_u:system_r:init_t:s0 key=(null) 
type=AVC msg=audit(11/13/2018 11:37:38.153:766) : avc:  denied  { mounton } for  pid=1874 comm=(vnstatd) path=/run/systemd/unit-root/var/lib/vnstat dev="vda2" ino=18618693 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:vnstatd_var_lib_t:s0 tclass=dir permissive=0 
----

Comment 2 Christian Kujau 2019-01-01 21:19:32 UTC
This is still present with selinux-policy-3.14.2-44.fc29 installed. Forced a SELinux relabel run and subsequent reboot, but upon login to Gnome, the SE alert pops up again. vnstatd is running though and appears to be counting packets, only this SE alert keeps popping up (once after a reboot).



SELinux is preventing (vnstatd) from mounton access on the directory /run/systemd/unit-root/var/lib/vnstat.
....
Additional Information:
Source Context                system_u:system_r:init_t:s0
Target Context                system_u:object_r:vnstatd_var_lib_t:s0
Target Objects                /run/systemd/unit-root/var/lib/vnstat [ dir ]
Source                        (vnstatd)
Source Path                   (vnstatd)
Port                          <Unknown>
Host                          horus
Source RPM Packages           
Target RPM Packages           
Policy RPM                    selinux-policy-3.14.2-44.fc29.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     horus
Platform                      Linux horus 4.19.10-300.fc29.x86_64 #1 SMP Mon Dec
                              17 15:34:44 UTC 2018 x86_64 x86_64
Alert Count                   3
First Seen                    2018-12-14 15:04:34 PST
Last Seen                     2019-01-01 13:07:34 PST
Local ID                      81f91594-c286-432f-bbb6-713a54087c75

Raw Audit Messages
type=AVC msg=audit(1546376854.213:137): avc:  denied  { mounton } for  pid=1004 comm="(vnstatd)" path="/run/systemd/unit-root/var/lib/vnstat" dev="nvme0n1p6" ino=537650597 scontext=system_u:system_r:init_t:s0 tcontext=system_u:object_r:vnstatd_var_lib_t:s0 tclass=dir permissive=0


Hash: (vnstatd),init_t,vnstatd_var_lib_t,dir,mounton

Comment 3 Lukas Vrabec 2019-05-02 11:48:01 UTC
*** Bug 1705474 has been marked as a duplicate of this bug. ***

Comment 4 Daniel Arena 2019-06-14 15:14:02 UTC
This is now preventing vnstat.service from starting in Fedora 30.

some more logs:

Jun 14 11:06:13 localhost.localdomain systemd[1]: Started vnStat network traffic monitor.
Jun 14 11:06:13 localhost.localdomain audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=vnstat comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=suc>
Jun 14 11:06:13 localhost.localdomain audit[20092]: AVC avc:  denied  { mounton } for  pid=20092 comm="(vnstatd)" path="/run/systemd/unit-root/var/lib/vnstat" dev="dm-0" ino=124196 scontext=system_u:system_r:init_t:s0 tcontext=system_u:o>
Jun 14 11:06:13 localhost.localdomain audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=vnstat comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=fail>
Jun 14 11:06:13 localhost.localdomain systemd[20092]: vnstat.service: Failed to set up mount namespacing: Permission denied
Jun 14 11:06:13 localhost.localdomain systemd[20092]: vnstat.service: Failed at step NAMESPACE spawning /usr/sbin/vnstatd: Permission denied
Jun 14 11:06:13 localhost.localdomain systemd[1]: vnstat.service: Main process exited, code=exited, status=226/NAMESPACE
Jun 14 11:06:13 localhost.localdomain systemd[1]: vnstat.service: Failed with result 'exit-code'.
Jun 14 11:06:13 localhost.localdomain systemd[1]: vnstat.service: Service RestartSec=100ms expired, scheduling restart.
Jun 14 11:06:13 localhost.localdomain systemd[1]: vnstat.service: Scheduled restart job, restart counter is at 1.
Jun 14 11:06:13 localhost.localdomain systemd[1]: Stopped vnStat network traffic monitor.

Comment 5 Lukas Vrabec 2019-06-17 20:32:31 UTC
commit 2f9692d829113985c576641ec0dd5192340e5645 (HEAD -> rawhide)
Author: Lukas Vrabec <lvrabec>
Date:   Mon Jun 17 22:32:16 2019 +0200

    Add vnstatd_var_lib_t to mountpoint attribute BZ(1648864)

Comment 6 Fedora Update System 2019-06-18 11:33:07 UTC
FEDORA-2019-096a80ef39 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-096a80ef39

Comment 7 Gustavo Maciel Dias Vieira 2019-06-18 12:37:30 UTC
selinux-policy-3.14.3-39.fc30 fixes it for Fedora 30.

Comment 8 Fedora Update System 2019-06-19 04:13:56 UTC
selinux-policy-3.14.2-61.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-096a80ef39

Comment 9 Fedora Update System 2019-07-10 12:47:27 UTC
FEDORA-2019-2eec328cc1 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-2eec328cc1

Comment 10 Fedora Update System 2019-07-11 03:10:53 UTC
selinux-policy-3.14.2-62.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-2eec328cc1

Comment 11 Fedora Update System 2019-07-19 08:08:44 UTC
FEDORA-2019-8071724c9b has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-8071724c9b

Comment 12 Fedora Update System 2019-07-20 03:41:49 UTC
selinux-policy-3.14.2-63.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-8071724c9b

Comment 13 Fedora Update System 2019-08-02 07:50:15 UTC
FEDORA-2019-b51794f502 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-b51794f502

Comment 14 Fedora Update System 2019-08-03 02:02:18 UTC
selinux-policy-3.14.2-64.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-b51794f502

Comment 15 Fedora Update System 2019-08-18 01:56:34 UTC
selinux-policy-3.14.2-64.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


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