Bug 689438

Summary: SELinux is preventing /bin/systemd-tmpfiles from 'write' accesses on the chr_file kmsg.
Product: [Fedora] Fedora Reporter: Matěj Cepl <mcepl>
Component: systemdAssignee: Lennart Poettering <lpoetter>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 15CC: dwalsh, dzrudy, johannbg, lpoetter, marbolangos, mcepl, metherid, mgrepl, mschmidt, notting, plautrba
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard: setroubleshoot_trace_hash:4ec58baa358a7915c9c5353647d5f380187109c7f9d8c170744f13fd515f5d6a
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-04-04 18:43:18 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Matěj Cepl 2011-03-21 14:21:34 UTC
SELinux is preventing /bin/systemd-tmpfiles from 'write' accesses on the chr_file kmsg.

*****  Plugin catchall (100. confidence) suggests  ***************************

If you believe that systemd-tmpfiles should be allowed write access on the kmsg chr_file 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:
# grep systemd-tmpfile /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:systemd_tmpfiles_t:s0
Target Context                system_u:object_r:kmsg_device_t:s0
Target Objects                kmsg [ chr_file ]
Source                        systemd-tmpfile
Source Path                   /bin/systemd-tmpfiles
Port                          <Neznámé>
Host                          (removed)
Source RPM Packages           systemd-units-20-1.fc15
Target RPM Packages           
Policy RPM                    selinux-policy-3.9.16-5.fc15
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Permissive
Host Name                     (removed)
Platform                      Linux (removed) 2.6.38-1.fc15.x86_64 #1 SMP Tue Mar
                              15 05:29:00 UTC 2011 x86_64 x86_64
Alert Count                   1
First Seen                    Po 21. březen 2011, 12:38:33 CET
Last Seen                     Po 21. březen 2011, 12:38:33 CET
Local ID                      130b5cae-1e4b-4c7a-a9bb-481a121667ad

Raw Audit Messages
type=AVC msg=audit(1300707513.160:5807): avc:  denied  { write } for  pid=20463 comm="systemd-tmpfile" name="kmsg" dev=devtmpfs ino=5332 scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:object_r:kmsg_device_t:s0 tclass=chr_file


type=AVC msg=audit(1300707513.160:5807): avc:  denied  { open } for  pid=20463 comm="systemd-tmpfile" name="kmsg" dev=devtmpfs ino=5332 scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:object_r:kmsg_device_t:s0 tclass=chr_file


type=SYSCALL msg=audit(1300707513.160:5807): arch=x86_64 syscall=open success=yes exit=ESRCH a0=408f40 a1=80101 a2=ffffffff a3=32f45973ac items=0 ppid=1 pid=20463 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=systemd-tmpfile exe=/bin/systemd-tmpfiles subj=system_u:system_r:systemd_tmpfiles_t:s0 key=(null)

Hash: systemd-tmpfile,systemd_tmpfiles_t,kmsg_device_t,chr_file,write

audit2allow

#============= systemd_tmpfiles_t ==============
#!!!! The source type 'systemd_tmpfiles_t' can write to a 'chr_file' of the following types:
# console_device_t, null_device_t, zero_device_t, devtty_t

allow systemd_tmpfiles_t kmsg_device_t:chr_file { write open };

audit2allow -R

#============= systemd_tmpfiles_t ==============
#!!!! The source type 'systemd_tmpfiles_t' can write to a 'chr_file' of the following types:
# console_device_t, null_device_t, zero_device_t, devtty_t

allow systemd_tmpfiles_t kmsg_device_t:chr_file { write open };

Comment 1 Daniel Walsh 2011-03-21 21:45:14 UTC
Why is systemd_tmpfiles writing kernel messages?

Comment 2 Daniel Walsh 2011-03-21 21:50:02 UTC
Added policy to allow this in selinux-policy-3.9.16-6.fc15

Mark as modified if this was the intention of systemd to do this,

Comment 3 Lennart Poettering 2011-03-29 00:05:19 UTC
Most systemd tools will log to stderr if isatty(STDERR_FILENO) is true, or to syslog if /dev/log can be connected to, or to /dev/kmsg as last resort.

I am not sure why /dev/log isn't accessible on Matej's machine though. Maybe a followup of the rsyslog labelling issue?

Comment 4 Daniel Walsh 2011-03-29 16:01:10 UTC
Fixed in  selinux-policy-3.9.16-6.fc15