Skip to content

chrony-dhcp not labelled correctly #1079

@Longhanks

Description

@Longhanks

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions