Skip to content

Commit

Permalink
[Backport release-24.11] nixos/ntpd: fix permissions error when creat…
Browse files Browse the repository at this point in the history
…ing drift file (#367479)
  • Loading branch information
ck3d authored Dec 31, 2024
2 parents 3d53b26 + dbb71e2 commit cf442b8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion nixos/modules/services/networking/ntp/ntpd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ in
group = "ntp";
description = "NTP daemon user";
home = "/var/lib/ntp";
createHome = true;
};
users.groups.ntp = { };

Expand All @@ -155,7 +156,6 @@ in
serviceConfig = {
ExecStart = "@${ntp}/bin/ntpd ntpd -g ${builtins.toString ntpFlags}";
Type = "forking";
StateDirectory = "ntp";

# Hardening options
PrivateDevices = true;
Expand Down
2 changes: 2 additions & 0 deletions nixos/tests/ntpd.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import ./make-test-python.nix (
machine.wait_for_console_text('Listen normally on 10 eth*')
machine.succeed('systemctl is-active ntpd.service')
machine.succeed('ntpq -p')
# ntp user must be able to create drift files
machine.succeed('su -s /bin/sh -c "touch /var/lib/ntp/ntp.drift" ntp')
'';
}
)

0 comments on commit cf442b8

Please sign in to comment.