Skip to content

chrony: add NTS server support and confdir include#5370

Open
uistlabs wants to merge 2 commits intoopnsense:masterfrom
uistlabs:feature/chrony-nts-server
Open

chrony: add NTS server support and confdir include#5370
uistlabs wants to merge 2 commits intoopnsense:masterfrom
uistlabs:feature/chrony-nts-server

Conversation

@uistlabs
Copy link
Copy Markdown

@uistlabs uistlabs commented Apr 5, 2026

Summary

Add NTS (Network Time Security, RFC 8915) server configuration support to the chrony plugin:

  • NTS server certificate/key paths — enables chrony to serve NTS-authenticated time to LAN clients using the administrator's own PKI certificates
  • NTS port — configurable NTS-KE port (default: 4460)
  • confdir includeinclude /usr/local/etc/chrony.opnsense.d/*.conf for custom directives, following the same extensibility pattern used by other OPNsense plugins (e.g. Squid's pre-auth/*.conf)

Motivation

Chrony has supported NTS server mode since version 4.0 (2020). The OPNsense chrony plugin currently supports NTS as a client (connecting to NTS-enabled upstream servers) but has no mechanism to configure chrony as an NTS server for downstream clients.

This is useful for environments with internal PKI where routers act as NTP servers for LAN hosts. NTS provides cryptographic authentication of time responses, protecting against NTP spoofing attacks.

NTS server mode coexists with plain NTP — non-NTS clients continue using UDP 123 as usual, while NTS-capable clients additionally perform a TLS handshake on TCP 4460 for key establishment.

Changes

File Change
General.xml (model) Added ntsservercert, ntsserverkey, ntsport fields with path validation
chrony.conf (template) Added conditional NTS server block + confdir include
general.xml (form) Added NTS Server section header and three GUI fields
setup.sh Create /usr/local/etc/chrony.opnsense.d/ directory
Makefile Version bump to 1.6
pkg-descr Changelog entry

Testing

Tested on OPNsense 25.1 with chrony 4.6:

  • NTS server serving time to chrony clients with internal PKI certificates
  • Plain NTP clients continue working alongside NTS clients
  • confdir include correctly loads drop-in configuration files
  • Empty NTS fields produce no change to chrony.conf (backward compatible)
  • File path validation rejects non-absolute paths

References

universal-is-tech and others added 2 commits April 5, 2026 00:45
Add configuration options for chrony NTS server mode:
- ntsservercert: path to TLS certificate chain (PEM)
- ntsserverkey: path to TLS private key
- ntsport: NTS-KE port (default: 4460)

Also add confdir include for /usr/local/etc/chrony.opnsense.d/*.conf,
following the same extensibility pattern used by other OPNsense plugins
(e.g. Squid's pre-auth/post-auth includes). This allows custom chrony
directives without modifying the managed template.

NTS (Network Time Security, RFC 8915) provides cryptographic
authentication for NTP. Chrony supports serving NTS alongside plain
NTP on the same instance since version 4.0. This change enables
administrators to configure their OPNsense routers as NTS servers
for internal networks using their own PKI certificates.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The chrony.opnsense.d directory needs group ownership set to chronyd
so that chronyd can traverse the directory to read NTS key files
after privilege drop. Without this, ntsserverkey paths inside the
confdir are inaccessible and NTS-KE fails silently.

Matches the ownership pattern already used for /var/db/chrony,
/var/lib/chrony, and /var/run/chrony in the same script.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants