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..50277f4af1 --- /dev/null +++ b/net/chrony/src/opnsense/mvc/app/library/OPNsense/System/Status/ChronyOverrideStatus.php @@ -0,0 +1,63 @@ +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('/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.' + ); + $this->internalStatus = SystemStatusCode::NOTICE; + } + } +} 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..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.2 + 0.0.4 0 @@ -9,7 +9,7 @@ 323 - Y + N 0 @@ -20,8 +20,8 @@ Y - 0.opnsense.pool.ntp.org - Y + 0.opnsense.pool.ntp.org,1.opnsense.pool.ntp.org,2.opnsense.pool.ntp.org,3.opnsense.pool.ntp.org + N , Y 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 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..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 @@ -34,3 +36,11 @@ allow {{ network }} {% endif %} {% endif %} + + +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 +