Bug 1421248

Summary: avc: denied { chown } for pid=28835 comm="chronyd"
Product: Red Hat Enterprise Linux 7 Reporter: Petr Sklenar <psklenar>
Component: selinux-policyAssignee: Lukas Vrabec <lvrabec>
Status: CLOSED ERRATA QA Contact: Milos Malik <mmalik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.4CC: lvrabec, mgrepl, mmalik, plautrba, pvrabec, qcai, rskvaril, ssekidde
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 15:22:43 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 Petr Sklenar 2017-02-10 18:06:37 UTC
Description of problem:
chronyd causes denial when starting

Version-Release number of selected component (if applicable):
chrony-3.1-1.el7.x86_64
selinux-policy-3.13.1-117.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. systemctl restart chronyd

Actual results:
type=AVC msg=audit(1486749775.953:842): avc:  denied  { chown } for  pid=28835 comm="chronyd" capability=0  scontext=system_u:system_r:chronyd_t:s0 tcontext=system_u:system_r:chronyd_t:s0 tclass=capability


[root@masox ~]# systemctl restart chronyd
[root@masox ~]# systemctl status chronyd
● chronyd.service - NTP client/server
   Loaded: loaded (/usr/lib/systemd/system/chronyd.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2017-02-10 19:03:24 CET; 1s ago
     Docs: man:chronyd(8)
           man:chrony.conf(5)
  Process: 28886 ExecStartPost=/usr/libexec/chrony-helper update-daemon (code=exited, status=0/SUCCESS)
  Process: 28882 ExecStart=/usr/sbin/chronyd $OPTIONS (code=exited, status=0/SUCCESS)
 Main PID: 28884 (chronyd)
   CGroup: /system.slice/chronyd.service
           └─28884 /usr/sbin/chronyd

Feb 10 19:03:24 masox.brq.redhat.com systemd[1]: Starting NTP client/server...
Feb 10 19:03:24 masox.brq.redhat.com chronyd[28884]: chronyd version 3.1 starting (+CMDMON +NTP +REFCLOCK +RTC +PRIVDROP +SCFILTER +SECHASH +SIGND +ASYNCDNS +IPV6 +DEBUG)
Feb 10 19:03:24 masox.brq.redhat.com chronyd[28884]: commandkey directive is no longer supported
Feb 10 19:03:24 masox.brq.redhat.com chronyd[28884]: generatecommandkey directive is no longer supported
Feb 10 19:03:24 masox.brq.redhat.com chronyd[28884]: Could not change ownership of /var/run/chrony : Operation not permitted
Feb 10 19:03:24 masox.brq.redhat.com chronyd[28884]: Could not access /var/run/chrony : No such file or directory
Feb 10 19:03:24 masox.brq.redhat.com chronyd[28884]: Disabled command socket /var/run/chrony/chronyd.sock
Feb 10 19:03:24 masox.brq.redhat.com chronyd[28884]: Frequency 13.119 +/- 1.419 ppm read from /var/lib/chrony/drift
Feb 10 19:03:24 masox.brq.redhat.com systemd[1]: Started NTP client/server.



Expected results:
no denial

Additional info:

Comment 3 Milos Malik 2017-02-11 19:17:07 UTC
FYI: the /var/run/chrony directory did not exist after installation of chrony package. The directory was not created by the reproducer in enforcing mode, but got created by the reproducer in permissive mode.

Caught in enforcing mode:
----
type=PATH msg=audit(02/11/2017 14:11:58.434:300) : item=0 name=/var/run/chrony inode=34471 dev=00:13 mode=dir,750 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:chronyd_var_run_t:s0 objtype=NORMAL 
type=CWD msg=audit(02/11/2017 14:11:58.434:300) :  cwd=/ 
type=SYSCALL msg=audit(02/11/2017 14:11:58.434:300) : arch=x86_64 syscall=chown success=no exit=EPERM(Operation not permitted) a0=0x7efdb8e8af30 a1=chrony a2=chrony a3=0x7efdb7b416c0 items=1 ppid=1 pid=14367 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=chronyd exe=/usr/sbin/chronyd subj=system_u:system_r:chronyd_t:s0 key=(null) 
type=AVC msg=audit(02/11/2017 14:11:58.434:300) : avc:  denied  { chown } for  pid=14367 comm=chronyd capability=chown  scontext=system_u:system_r:chronyd_t:s0 tcontext=system_u:system_r:chronyd_t:s0 tclass=capability 
----
Caught in permissive mode:
----
type=PATH msg=audit(02/11/2017 14:13:02.664:305) : item=0 name=/var/run/chrony inode=34729 dev=00:13 mode=dir,750 ouid=root ogid=root rdev=00:00 obj=system_u:object_r:chronyd_var_run_t:s0 objtype=NORMAL 
type=CWD msg=audit(02/11/2017 14:13:02.664:305) :  cwd=/ 
type=SYSCALL msg=audit(02/11/2017 14:13:02.664:305) : arch=x86_64 syscall=chown success=yes exit=0 a0=0x7f7c00e5cf30 a1=chrony a2=chrony a3=0x7f7c006e96c0 items=1 ppid=1 pid=14389 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=chronyd exe=/usr/sbin/chronyd subj=system_u:system_r:chronyd_t:s0 key=(null) 
type=AVC msg=audit(02/11/2017 14:13:02.664:305) : avc:  denied  { chown } for  pid=14389 comm=chronyd capability=chown  scontext=system_u:system_r:chronyd_t:s0 tcontext=system_u:system_r:chronyd_t:s0 tclass=capability 
----

Comment 4 Radka Brychtova 2017-02-21 13:04:31 UTC
*** Bug 1425408 has been marked as a duplicate of this bug. ***

Comment 7 Lukas Vrabec 2017-04-10 15:30:21 UTC
*** Bug 1440791 has been marked as a duplicate of this bug. ***

Comment 8 errata-xmlrpc 2017-08-01 15:22:43 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:1861