Skip to content

Commit

Permalink
time Sync commands updated, enable added
Browse files Browse the repository at this point in the history
  • Loading branch information
chanakyavasantha committed Dec 20, 2023
1 parent 7e67fc5 commit 4a864b4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions harden/time_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def get_script(config):
# Install NTP package
script += "sudo apt install ntp\n"
# Add or edit the line in /etc/init.d/ntp
if file_systems_config['ntp_servers']:
for item in file_systems_config['ntp_servers']:
script += f"echo 'server {item}' iburst| sudo tee -a /etc/ntp.conf\n"
if file_systems_config['enable_ntp_user']:
script += "echo 'RUNASUSER=ntp' | sudo tee -a /etc/init.d/ntp\n"
if file_systems_config['enable_ntp_server']:
if file_systems_config['ntp_servers']:
for item in file_systems_config['ntp_servers']:
script += f"echo 'server {item}' iburst| sudo tee -a /etc/ntp.conf\n"
if file_systems_config['enable_ntp_user']:
script += "echo 'RUNASUSER=ntp' | sudo tee -a /etc/init.d/ntp\n"


# Restart NTP service
script += "sudo systemctl restart ntp.service\n"

Expand Down

0 comments on commit 4a864b4

Please sign in to comment.