Configure ntpd To Run As ntp User
An XCCDF Rule
Description
ntp is a daemon which implements the Network Time Protocol (NTP). It is designed to synchronize system clocks across a variety of systems and use a source that is highly accurate. More information on NTP can be found at http://www.ntp.org. ntp can be configured to be a client and/or a server. To ensure that ntpd is running as ntp user, Add or edit theOPTIONS
variable in /etc/sysconfig/ntpd
to include ' -u ntp:ntp ':
OPTIONS="-u ntp:ntp"This recommendation only applies if ntp is in use on the system.
Rationale
If ntp is in use on the system proper configuration is vital to ensuring time synchronization is working properly. Running ntpd under dedicated user accounts limits the attack surface for potential attacker exploiting security flaws in the daemon or the protocol.
- ID
- xccdf_org.ssgproject.content_rule_ntpd_run_as_ntp_user
- Severity
- Medium
- References
- Updated
Remediation Templates
A Shell Script
# Remediation is applicable only in certain platforms
if dpkg-query --show --showformat='${db:Status-Status}
' 'kernel' 2>/dev/null | grep -q installed && { dpkg-query --show --showformat='${db:Status-Status}\n' 'ntp' 2>/dev/null | grep -q installed; }; then
if grep -q 'OPTIONS=.*' /etc/sysconfig/ntpd; then
# trying to solve cases where the parameter after OPTIONS
#may or may not be enclosed in quotes