Bug 1027148

Summary: avc: denied { setattr } for pid=183 comm="systemd-tmpfile" during boot
Product: [Fedora] Fedora Reporter: Vitaly Kuznetsov <vkuznets>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 20CC: atodorov, dominick.grift, dwalsh, johannbg, keramidasceid, lemenkov, lnykryn, lvrabec, mgrepl, msekleta, plautrba, systemd-maint, vpavlin, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: selinux-policy-3.12.1-122.fc20 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-02-12 14:44:21 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:

Description Vitaly Kuznetsov 2013-11-06 09:39:24 UTC
Description of problem:

I'm seeing the following in /var/log/messages:
# grep "avc.*denied" /var/log/messages 
Nov  6 09:19:41 ip-10-62-83-156 kernel: [399654.738880] type=1400 audit(1383729579.090:4): avc:  denied  { setattr } for  pid=183 comm="systemd-tmpfile" name="journal" dev="xvda1" ino=255451 scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir
Nov  6 09:19:41 ip-10-62-83-156 kernel: [399654.738953] type=1400 audit(1383729579.090:5): avc:  denied  { setattr } for  pid=183 comm="systemd-tmpfile" name="7bd3c66a3d974c51b7a407a5bd3073b9" dev="xvda1" ino=385758 scontext=system_u:system_r:systemd_tmpfiles_t:s0 tcontext=system_u:object_r:var_log_t:s0 tclass=dir

[root@ip-10-62-83-156 ~]# find /var/log/ -inum 255451
/var/log/journal
[root@ip-10-62-83-156 ~]# find /var/log/ -inum 385758
/var/log/journal/7bd3c66a3d974c51b7a407a5bd3073b9

Version-Release number of selected component (if applicable):
systemd-208-4.fc20.x86_64

How reproducible:
always

Steps to Reproduce:
I've done my testing for F20-Beta-RC4 AMI on EC2 only, but should be reproducible on bare metal as well 

1. Start F20-Beta-RC4 AMI on EC2
2. Do 'yum update'
3. Reboot

Actual results:
avc: denied messages

Expected results:
no denials

Additional info:

Comment 1 Vitaly Kuznetsov 2013-11-06 09:52:09 UTC
I can also see:
Nov  6 09:19:40 ip-10-62-83-156 systemd-tmpfiles: chmod(/var/log/journal) failed: Permission denied
Nov  6 09:19:40 ip-10-62-83-156 systemd-tmpfiles: chmod(/var/log/journal/7bd3c66a3d974c51b7a407a5bd3073b9) failed: Permission denied

in /var/log/messages

Comment 3 Peter Lemenkov 2013-11-07 10:38:31 UTC
Confirm that. I have to add the following rule:

https://github.com/lemenkov/selinux-rules/blob/master/auriga-systemd-tmpfiles.te

module auriga-systemd-tmpfiles 1.0;

require {
        type systemd_tmpfiles_t;
        type var_log_t;
        class dir { relabelfrom relabelto setattr };
}

#============= systemd_tmpfiles_t ==============
allow systemd_tmpfiles_t var_log_t:dir { relabelfrom relabelto setattr };

Comment 4 Zbigniew Jędrzejewski-Szmek 2013-11-15 22:22:48 UTC
Hm, I get a slightly simpler result from audit2allow:

#============= systemd_tmpfiles_t ==============
allow systemd_tmpfiles_t var_log_t:dir setattr;

Either way, can we get this applied? This results in an annoying warning for probably all F20 installations?

Comment 5 Zbigniew Jędrzejewski-Szmek 2013-11-15 22:23:44 UTC
systemd changed in http://cgit.freedesktop.org/systemd/systemd/commit/?id=4608af43.

Comment 6 Alexander Todorov 2013-11-19 09:30:48 UTC
Seen here:
http://beaker.fedoraproject.org/bkr/jobs/51

will re-test with the latest.

Comment 7 Daniel Walsh 2014-01-23 14:30:59 UTC
Looks like the latest code in F20 allows this.

selinux-policy-3.12.1-120.fc20 or earlier.

Comment 8 Fedora Update System 2014-01-27 19:16:17 UTC
selinux-policy-3.12.1-121.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/selinux-policy-3.12.1-121.fc20

Comment 9 Fedora Update System 2014-01-29 03:06:26 UTC
Package selinux-policy-3.12.1-121.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-121.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-1700/selinux-policy-3.12.1-121.fc20
then log in and leave karma (feedback).

Comment 10 Fedora Update System 2014-01-30 03:32:29 UTC
Package selinux-policy-3.12.1-122.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.12.1-122.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-1700/selinux-policy-3.12.1-122.fc20
then log in and leave karma (feedback).

Comment 11 Fedora Update System 2014-02-12 14:44:21 UTC
selinux-policy-3.12.1-122.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.