anthcourtney / ansible-role-cis-amazon-linux

Ansible role to apply CIS Amazon Linux Benchmark v2.0.0
MIT License
154 stars 140 forks source link

Adding check on existing ntp options #73

Closed tomotway closed 4 years ago

tomotway commented 4 years ago

The current code causes ntpd to fail to start (at least on the amazon linux version I am testing on, 2018.03):

Starting ntpd: ntpd error: only one user option allowed ntpd - NTP daemon program - Ver. 4.2.8p12 Usage: ntpd [ - [] | --[{=| }] ]... \ [ ... ] Try 'ntpd --help' for more information.

This is because, the -u ntp:ntp is set within the startup script:

[ec2-user@ip-172-31-15-231 ~]$ sudo grep 'daemon $prog' /etc/init.d/ntpd daemon $prog -u ntp:ntp -p /var/run/ntpd.pid $OPTIONS

Adding a check here - if this is already set on the startup script don't set it in the sysconfig file.