Skip to content

Commit

Permalink
Merge pull request #1913 from indrajitr/chrony-nts
Browse files Browse the repository at this point in the history
ntp: T5112: Enable support for NTS (Network Time Security) in chrony
  • Loading branch information
c-po committed Mar 25, 2023
2 parents 58b2961 + 85ed5fe commit 8f1e8d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion data/templates/chrony/chrony.conf.j2
Expand Up @@ -17,6 +17,7 @@ clientloglimit 1048576

driftfile /run/chrony/drift
dumpdir /run/chrony
ntsdumpdir /run/chrony
pidfile {{ config_file | replace('.conf', '.pid') }}

# Determine when will the next leap second occur and what is the current offset
Expand All @@ -31,7 +32,7 @@ user {{ user }}
{% if config.pool is vyos_defined %}
{% set association = 'pool' %}
{% endif %}
{{ association }} {{ server | replace('_', '-') }} iburst {{ 'noselect' if config.noselect is vyos_defined }} {{ 'prefer' if config.prefer is vyos_defined }}
{{ association }} {{ server | replace('_', '-') }} iburst {{ 'nts' if config.nts is vyos_defined }} {{ 'noselect' if config.noselect is vyos_defined }} {{ 'prefer' if config.prefer is vyos_defined }}
{% endfor %}
{% endif %}

Expand Down
6 changes: 6 additions & 0 deletions interface-definitions/ntp.xml.in
Expand Up @@ -37,6 +37,12 @@
<valueless/>
</properties>
</leafNode>
<leafNode name="nts">
<properties>
<help>Enable Network Time Security (NTS) for the server</help>
<valueless/>
</properties>
</leafNode>
<leafNode name="pool">
<properties>
<help>Associate with a number of remote servers</help>
Expand Down
3 changes: 2 additions & 1 deletion smoketest/scripts/cli/test_service_ntp.py
Expand Up @@ -46,7 +46,7 @@ def tearDown(self):
def test_01_ntp_options(self):
# Test basic NTP support with multiple servers and their options
servers = ['192.0.2.1', '192.0.2.2']
options = ['noselect', 'prefer']
options = ['nts', 'noselect', 'prefer']
pools = ['pool.vyos.io']

for server in servers:
Expand All @@ -65,6 +65,7 @@ def test_01_ntp_options(self):
config = cmd(f'sudo cat {NTP_CONF}')
self.assertIn('driftfile /run/chrony/drift', config)
self.assertIn('dumpdir /run/chrony', config)
self.assertIn('ntsdumpdir /run/chrony', config)
self.assertIn('clientloglimit 1048576', config)
self.assertIn('rtcsync', config)
self.assertIn('makestep 1.0 3', config)
Expand Down

0 comments on commit 8f1e8d7

Please sign in to comment.