Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final Round Updates #40

Merged
merged 10 commits into from
Dec 20, 2023
Prev Previous commit
Next Next commit
time Sync commands updated, enable added
chanakyavasantha committed Dec 20, 2023
commit 4a864b4c5d1b41154541e0c44fa4364bba9b7667
12 changes: 6 additions & 6 deletions harden/time_sync.py
Original file line number Diff line number Diff line change
@@ -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"