Bug 971130

Summary: SELinux is preventing /usr/lib/systemd/systemd-timedated from 'create' accesses on the file .adjtimeXXdfqS.
Product: [Fedora] Fedora Reporter: Moritz Baumann <baumanmo>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 18CC: dominick.grift, dwalsh, mgrepl
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: abrt_hash:5a917a9dd79b45bcb0f89f6767c4f8a3fa7d161bb84c0b7a6b216ab24646c645
Fixed In Version: selinux-policy-3.11.1-98.fc18 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-07-25 00:39:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Love and peace none

Description Moritz Baumann 2013-06-05 18:50:15 UTC
Description of problem:
1) timedatectl set-local-rtc 1
2) AVC alert showed up
SELinux is preventing /usr/lib/systemd/systemd-timedated from 'create' accesses on the file .adjtimeXXdfqS.

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

If you believe that systemd-timedated should be allowed create access on the .adjtimeXXdfqS 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-timedat /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

Additional Information:
Source Context                system_u:system_r:systemd_timedated_t:s0
Target Context                system_u:object_r:adjtime_t:s0
Target Objects                .adjtimeXXdfqS [ file ]
Source                        systemd-timedat
Source Path                   /usr/lib/systemd/systemd-timedated
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           systemd-201-2.fc18.7.x86_64
Target RPM Packages           
Policy RPM                    selinux-policy-3.11.1-97.fc18.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 3.9.4-200.fc18.x86_64 #1 SMP Fri
                              May 24 20:10:49 UTC 2013 x86_64 x86_64
Alert Count                   1
First Seen                    2013-06-05 20:48:01 CEST
Last Seen                     2013-06-05 20:48:01 CEST
Local ID                      34e43459-c012-41af-b7a2-12bc71120bbd

Raw Audit Messages
type=AVC msg=audit(1370458081.796:341): avc:  denied  { create } for  pid=2732 comm="systemd-timedat" name=".adjtimeXXdfqS" scontext=system_u:system_r:systemd_timedated_t:s0 tcontext=system_u:object_r:adjtime_t:s0 tclass=file


type=SYSCALL msg=audit(1370458081.796:341): arch=x86_64 syscall=open success=no exit=EACCES a0=7fdb2a0e4a00 a1=800c2 a2=180 a3=27d3a78eff items=0 ppid=1 pid=2732 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 ses=4294967295 tty=(none) comm=systemd-timedat exe=/usr/lib/systemd/systemd-timedated subj=system_u:system_r:systemd_timedated_t:s0 key=(null)

Hash: systemd-timedat,systemd_timedated_t,adjtime_t,file,create

audit2allow

#============= systemd_timedated_t ==============
allow systemd_timedated_t adjtime_t:file create;

audit2allow -R
require {
	type systemd_timedated_t;
	type adjtime_t;
	class file create;
}

#============= systemd_timedated_t ==============
allow systemd_timedated_t adjtime_t:file create;


Additional info:
reporter:       libreport-2.1.4
hashmarkername: setroubleshoot
kernel:         3.9.4-200.fc18.x86_64
type:           libreport

Comment 1 Miroslav Grepl 2013-06-06 06:48:24 UTC
Back ported from F19.

    Allow systemd_timedate_t to manage /etc/adjtime.
    
    Add transition rules to unconfined domains and to sysadm_t to create /etc/adjtime
    with the proper label.

Comment 2 poma 2013-06-06 10:06:00 UTC
Created attachment 757588 [details]
Love and peace

Comment 3 poma 2013-06-06 10:12:13 UTC
Cherry picked Miroslav's commit	520d6f23fc5f05827f125d2dc69da846c9499e83[1].
'timedated-set-local-rtc-f18.patch' attach.

$ grep ^'LOCAL\|UTC' /etc/adjtime
LOCAL
 
$ timedatectl | grep ^\ RTC
 RTC in local TZ: yes
 
$ timedatectl set-local-rtc off
 
$ timedatectl | grep ^\ RTC
 RTC in local TZ: no
 
$ grep ^'LOCAL\|UTC' /etc/adjtime
UTC


[1] http://pkgs.fedoraproject.org/cgit/selinux-policy.git/commit/?id=520d6f23fc5f05827f125d2dc69da846c9499e83

Comment 4 Fedora Update System 2013-06-27 13:35:06 UTC
selinux-policy-3.11.1-98.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/selinux-policy-3.11.1-98.fc18

Comment 5 Fedora Update System 2013-06-28 06:09:15 UTC
Package selinux-policy-3.11.1-98.fc18:
* should fix your issue,
* was pushed to the Fedora 18 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.11.1-98.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2013-11859/selinux-policy-3.11.1-98.fc18
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2013-07-25 00:39:03 UTC
selinux-policy-3.11.1-98.fc18 has been pushed to the Fedora 18 stable repository.  If problems still persist, please make note of it in this bug report.