Hi,
We're using refpolicy 2.20250213 and systemd 257.4 from Yocto walnascar. Our policy type is mcs. The issue is reproducible when using qemux86_64 as MACHINE.
chrony ships with an NetworkManager dispatcher script (deployed into /etc/NetworkManager/dispatcher.d/hrony.nm-dispatcher.dhcp) that by default writes files into /var/run/chrony-dhcp/<interface>.sources: https://gitlab.com/chrony/chrony/-/blob/master/examples/chrony.nm-dispatcher.dhcp#L13
The directory gets the label initrc_runtime_t (as opposed to e.g. chronyd_runtime_t):
drwxrwx---. 2 chronyd chronyd system_u:object_r:chronyd_runtime_t:s0 80 Feb 5 12:35 chrony
drwxr-xr-x. 2 root root system_u:object_r:initrc_runtime_t:s0 60 Feb 5 12:35 chrony-dhcp
With enforcement turned on, this makes it impossible for chronyd to read the file. We currently ship the following workaround in a chrony-nmdispatcher.te file:
policy_module(chrony-nmdispatcher,1.0.0)
require {
type chronyd_runtime_t;
}
init_daemon_runtime_file(chronyd_runtime_t, dir, "chrony-dhcp")
With that, the directory gets labelled chronyd_runtime_t, and chronyd is able to pick up NTP servers by reading the file generated by the dispatcher script.
But presumably, there's room for a more sophisticated solution. The Fedore project, for example, has a complex setup of rules for NetworkManager dispatcher scripts that apply to chrony, e.g. in:
Maybe some of that might be applicable?
Thanks for looking into the issue and best regards
Andi
Hi,
We're using refpolicy
2.20250213andsystemd 257.4from Yoctowalnascar. Our policy type ismcs. The issue is reproducible when usingqemux86_64asMACHINE.chronyships with anNetworkManagerdispatcher script (deployed into/etc/NetworkManager/dispatcher.d/hrony.nm-dispatcher.dhcp) that by default writes files into/var/run/chrony-dhcp/<interface>.sources: https://gitlab.com/chrony/chrony/-/blob/master/examples/chrony.nm-dispatcher.dhcp#L13The directory gets the label
initrc_runtime_t(as opposed to e.g.chronyd_runtime_t):With enforcement turned on, this makes it impossible for
chronydto read the file. We currently ship the following workaround in achrony-nmdispatcher.tefile:With that, the directory gets labelled
chronyd_runtime_t, andchronydis able to pick up NTP servers by reading the file generated by the dispatcher script.But presumably, there's room for a more sophisticated solution. The Fedore project, for example, has a complex setup of rules for
NetworkManagerdispatcher scripts that apply tochrony, e.g. in:Maybe some of that might be applicable?
Thanks for looking into the issue and best regards
Andi