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

fix: timesyncd.conf missing [Time] section #166

Closed
wants to merge 2 commits into from

Conversation

colinbruner
Copy link
Contributor

Overall Review of Changes:
Adding the [Time] header to the timesyncd.conf template to allow for the configuration file to be properly parsed by timesyncd daemon.

Issue Fixes:
n/a

Enhancements:
n/a

How has this been tested?:
I tested this locally during a packer build and observed the following via journalctl

$ journalctl -u systemd-timesyncd.service
...
Nov 08 22:28:13 packer-654c02ef-a137-f71d-a70b-47036632b345 systemd[1]: Starting Network Time Synchronization...
Nov 08 22:28:13 packer-654c02ef-a137-f71d-a70b-47036632b345 systemd-timesyncd[286]: /etc/systemd/timesyncd.conf.d/50-timesyncd.conf:5: Assignment outside of section. Ignoring.
Nov 08 22:28:13 packer-654c02ef-a137-f71d-a70b-47036632b345 systemd-timesyncd[286]: /etc/systemd/timesyncd.conf.d/50-timesyncd.conf:8: Assignment outside of section. Ignoring.

# modifying file locally
$ cat /etc/systemd/timesyncd.conf.d/50-timesyncd.conf
## Ansible controlled file
# Added as part of ansible-lockdown CIS baseline
# provided by MindPointGroup LLC

[Time]
NTP=time.nist.gov


FallbackNTP=time-a-g.nist.gov time-b-g.nist.gov time-c-g.nist.gov

# restart systemd-timesyncd service
$ systemctl restart systemd-timesyncd.service

# validating configuration is properly reflected
$ journalctl -u systemd-timesyncd.service
Nov 08 22:34:07 packer-654c02ef-a137-f71d-a70b-47036632b345 systemd[1]: Started Network Time Synchronization.
Nov 08 22:34:07 packer-654c02ef-a137-f71d-a70b-47036632b345 systemd-timesyncd[1133]: Initial synchronization to time server 132.163.97.3:123 (time.nist.gov).

By default the ubtu22cis_time_pool appears to template out as the following. systemd-timesyncd does not parse this well.

NTP=[{'name': 'time.nist.gov', 'options': 'iburst maxsources 4'}]

I've copied the logic from FallbackNTP to also iterate and render NTP servers in the same manner for the NTP directive.

@colinbruner
Copy link
Contributor Author

I just realized I've duplicated the PR submitted here, oops!

Will go ahead and close this one out in favor of the earlier PR.

@colinbruner colinbruner closed this Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant