busybox ntpd can not run as a time server
Package Information
- Package name: busybox
- Package version: 1.36.1-r29
- Alpine version: 3.20.3
- Alpine architecture: x86_64
Summary
The ntpd
command can not be used as a time server. The conf.d
comment says
that adding -l
to the options should enable this functionality. However
ntpd
crashes when that option is turned on.
ntpd
would have reported permission denied
, but since stderr/stdout is send
to /dev/null
nothing is shown.
This is caused by commit bcb45e25 which introduced
a rootless ntpd
. The commit changes the running user to ntp
while adding the
^cap_sys_time
capability. This is enough to change the time, but it is not
enough to open the time server listening port. For that, the capability
^cap_net_bind_service
also needs to be added. Adding this to the capabilities
in the init
scripts fixes this issue.
Steps to reproduce
- Add
-l
to theNTPD_OPTS
in/etc/conf.d/ntpd
. - Restart ntpd:
service ntpd restart
- Check if ntpd is running:
service ntpd status
- It should show
ntpd
is running, but it actually showsntpd
is crashed.