From be61e655cf85f73e60411a1e86e794bc4c633db8 Mon Sep 17 00:00:00 2001 From: BPplays Date: Fri, 14 Aug 2026 15:32:47 -0700 Subject: [PATCH 1/5] added config overrides to chrony --- .../System/Status/ChronyOverrideStatus.php | 60 +++++++++++++++++++ .../templates/OPNsense/Chrony/chrony.conf | 5 ++ 2 files changed, 65 insertions(+) create mode 100644 net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php diff --git a/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php b/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php new file mode 100644 index 0000000000..3a987cb7b7 --- /dev/null +++ b/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php @@ -0,0 +1,60 @@ +internalPriority = 2; + $this->internalPersistent = true; + $this->internalIsBanner = true; + $this->internalTitle = gettext('Chrony config override'); + $this->internalScope = [ + '/ui/chrony/general/index', + ]; + } + + public function collectStatus() + { + if ( + count(glob('/usr/local/etc/chrony/conf.d/*')) || + count(glob('/usr/local/etc/chrony/sources.d/*')) + ) { + $this->internalMessage = gettext( + 'The configuration contains manual overwrites, these may interfere with the settings configured here.' + ); + $this->internalStatus = SystemStatusCode::NOTICE; + } + } +} diff --git a/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf b/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf index 7cd4f7a16f..3723cf7d90 100644 --- a/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf +++ b/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf @@ -34,3 +34,8 @@ allow {{ network }} {% endif %} {% endif %} + + +confdir /usr/local/etc/chrony/conf.d +sourcedir /usr/local/etc/chrony/sources.d + From 56d7f14109346f01c3971be95a38fe0059cefd87 Mon Sep 17 00:00:00 2001 From: BPplays Date: Fri, 14 Aug 2026 15:43:35 -0700 Subject: [PATCH 2/5] added /var/run/chrony to chrony overrides --- .../library/OPNsense/System/Status/ChronyOverrideStatus.php | 5 ++++- .../opnsense/service/templates/OPNsense/Chrony/chrony.conf | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php b/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php index 3a987cb7b7..50277f4af1 100644 --- a/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php +++ b/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php @@ -49,7 +49,10 @@ public function collectStatus() { if ( count(glob('/usr/local/etc/chrony/conf.d/*')) || - count(glob('/usr/local/etc/chrony/sources.d/*')) + count(glob('/var/run/chrony/conf.d/*')) || + count(glob('/usr/local/etc/chrony/sources.d/*')) || + count(glob('/var/run/chrony/sources.d/*')) + ) { $this->internalMessage = gettext( 'The configuration contains manual overwrites, these may interfere with the settings configured here.' diff --git a/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf b/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf index 3723cf7d90..6a70ed69f2 100644 --- a/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf +++ b/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf @@ -37,5 +37,8 @@ allow {{ network }} confdir /usr/local/etc/chrony/conf.d +confdir /var/run/chrony/conf.d + sourcedir /usr/local/etc/chrony/sources.d +sourcedir /var/run/chrony/sources.d From 71f180dc1b5aed86cad719368c623f99376db741 Mon Sep 17 00:00:00 2001 From: BPplays Date: Fri, 14 Aug 2026 15:59:20 -0700 Subject: [PATCH 3/5] chrony changed setup.sh --- .../src/opnsense/scripts/OPNsense/Chrony/setup.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/net/chrony/src/opnsense/scripts/OPNsense/Chrony/setup.sh b/net/chrony/src/opnsense/scripts/OPNsense/Chrony/setup.sh index ad9060012e..27df50d91c 100755 --- a/net/chrony/src/opnsense/scripts/OPNsense/Chrony/setup.sh +++ b/net/chrony/src/opnsense/scripts/OPNsense/Chrony/setup.sh @@ -1,5 +1,13 @@ #!/bin/sh -mkdir -p /var/db/chrony /var/lib/chrony /var/run/chrony -chown -R chronyd:chronyd /var/db/chrony /var/lib/chrony /var/run/chrony -chmod 750 /var/db/chrony /var/lib/chrony /var/run/chrony +mkdir -p /var/db/chrony /var/lib/chrony /var/run/chrony \ + /usr/local/etc/chrony/conf.d /var/run/chrony/conf.d \ + /usr/local/etc/chrony/sources.d /var/run/chrony/sources.d + +chown -R chronyd:chronyd /var/db/chrony /var/lib/chrony /var/run/chrony \ + /usr/local/etc/chrony/conf.d /var/run/chrony/conf.d \ + /usr/local/etc/chrony/sources.d /var/run/chrony/sources.d + +chmod 750 /var/db/chrony /var/lib/chrony /var/run/chrony \ + /usr/local/etc/chrony/conf.d /var/run/chrony/conf.d \ + /usr/local/etc/chrony/sources.d /var/run/chrony/sources.d From cabb57ffb33ad1dd3d2b6058983f312abbd7f653 Mon Sep 17 00:00:00 2001 From: BPplays Date: Fri, 14 Aug 2026 16:18:20 -0700 Subject: [PATCH 4/5] allow no peers, or port, for overrides --- .../src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml | 6 +++--- .../opnsense/service/templates/OPNsense/Chrony/chrony.conf | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml b/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml index 08d29de0cf..1e5fb3b9dd 100644 --- a/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml +++ b/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml @@ -1,7 +1,7 @@ //OPNsense/chrony/general Chrony configuration - 0.0.2 + 0.0.3 0 @@ -9,7 +9,7 @@ 323 - Y + N 0 @@ -21,7 +21,7 @@ 0.opnsense.pool.ntp.org - Y + N , Y diff --git a/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf b/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf index 6a70ed69f2..a85c4b2b4f 100644 --- a/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf +++ b/net/chrony/src/opnsense/service/templates/OPNsense/Chrony/chrony.conf @@ -1,6 +1,8 @@ {% if helpers.exists('OPNsense.chrony.general.enabled') and OPNsense.chrony.general.enabled == '1' %} +{% if not helpers.empty('OPNsense.chrony.general.port') %} port {{ OPNsense.chrony.general.port }} +{% endif %} driftfile /var/db/chrony/drift pidfile /var/run/chrony/chronyd.pid makestep 1 3 From 47efeaad3c38cfcf0202e3db2f73d3c9975876c4 Mon Sep 17 00:00:00 2001 From: BPplays Date: Mon, 17 Aug 2026 23:10:56 -0700 Subject: [PATCH 5/5] set chrony peers to default to all opnsense pools, including 2. to support ipv6 --- .../src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml b/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml index 1e5fb3b9dd..88c008f53b 100644 --- a/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml +++ b/net/chrony/src/opnsense/mvc/app/models/OPNsense/Chrony/General.xml @@ -1,7 +1,7 @@ //OPNsense/chrony/general Chrony configuration - 0.0.3 + 0.0.4 0 @@ -20,7 +20,7 @@ Y - 0.opnsense.pool.ntp.org + 0.opnsense.pool.ntp.org,1.opnsense.pool.ntp.org,2.opnsense.pool.ntp.org,3.opnsense.pool.ntp.org N , Y