Dave Hart
2024-11-12 19:13:05 UTC
It seems obvious to me that ntpd should log an error and terminate when it
is unable to adjust the system clock. To my surprise,
https://bugs.ntp.org/1433 pointed out that when a Linux ntpd binary built
to use capabilities is run on a kernel build without capability capability,
ntpd blithely runs without complaint while effectively doing nothing. For
this specific problem, you could blame the user and say they need to use
ntpd built --without-linux-caps, but there's a more general issue of ntpd
not reporting let alone aborting on a failure to control the clock.
To explain the context a bit, I came across bug 1433 somehow and saw that
in 2019 the decade-old bug was fixed by having ntpd test for whether
capabilities work before dropping root (they're needed to crank the clock
when not running as root on Linux). When capabilities do not work, ntpd
was then ignoring the request to drop root and run as a user, typically
"ntp". This meant it was silently opening up an opportunity for more
useful privilege elevation or remote code execution despite the user's
explicit configuration, and that's unacceptable to me. My intention is to
change the behavior to error out when controlling the clock fails (via step
or slew). If you think that's a bad idea, please speak up and explain your
reasoning.
Cheers,
Dave Hart
is unable to adjust the system clock. To my surprise,
https://bugs.ntp.org/1433 pointed out that when a Linux ntpd binary built
to use capabilities is run on a kernel build without capability capability,
ntpd blithely runs without complaint while effectively doing nothing. For
this specific problem, you could blame the user and say they need to use
ntpd built --without-linux-caps, but there's a more general issue of ntpd
not reporting let alone aborting on a failure to control the clock.
To explain the context a bit, I came across bug 1433 somehow and saw that
in 2019 the decade-old bug was fixed by having ntpd test for whether
capabilities work before dropping root (they're needed to crank the clock
when not running as root on Linux). When capabilities do not work, ntpd
was then ignoring the request to drop root and run as a user, typically
"ntp". This meant it was silently opening up an opportunity for more
useful privilege elevation or remote code execution despite the user's
explicit configuration, and that's unacceptable to me. My intention is to
change the behavior to error out when controlling the clock fails (via step
or slew). If you think that's a bad idea, please speak up and explain your
reasoning.
Cheers,
Dave Hart