Feature #8794 » system.inc.ntp-auth.23.01.patch
/etc/inc/system.inc 2023-02-20 20:05:49.538823000 -0500 | ||
---|---|---|
1828 | 1828 |
$driftfile = "/var/db/ntpd.drift"; |
1829 | 1829 |
$statsdir = "/var/log/ntp"; |
1830 | 1830 |
$gps_device = '/dev/gps0'; |
1831 |
$ntp_key = "1"; |
|
1831 | 1832 | |
1832 | 1833 |
safe_mkdir($statsdir); |
1833 | 1834 | |
... | ... | |
1857 | 1858 | |
1858 | 1859 |
/* set NTP server authentication key */ |
1859 | 1860 |
if (config_get_path('ntpd/serverauth') == 'yes') { |
1860 |
$ntpkeyscfg = "1 " . strtoupper(config_get_path('ntpd/serverauthalgo')) . " " . base64_decode(config_get_path('ntpd/serverauthkey')) . "\n"; |
|
1861 |
$ntp_key = "12345"; |
|
1862 |
$ntpkeyscfg = $ntp_key . " " . strtoupper(config_get_path('ntpd/serverauthalgo')) . " " . base64_decode(config_get_path('ntpd/serverauthkey')) . "\n"; |
|
1861 | 1863 |
if (!@file_put_contents("{$g['varetc_path']}/ntp.keys", $ntpkeyscfg)) { |
1862 | 1864 |
log_error(sprintf(gettext("Could not open %s/ntp.keys for writing"), g_get('varetc_path'))); |
1863 | 1865 |
return; |
... | ... | |
1874 | 1876 |
if (config_get_path('ntpd/serverauth') == 'yes') { |
1875 | 1877 |
$ntpcfg .= "# Authentication settings \n"; |
1876 | 1878 |
$ntpcfg .= "keys /var/etc/ntp.keys \n"; |
1877 |
$ntpcfg .= "trustedkey 1 \n";
|
|
1878 |
$ntpcfg .= "requestkey 1 \n";
|
|
1879 |
$ntpcfg .= "controlkey 1 \n";
|
|
1879 |
$ntpcfg .= "trustedkey " . $ntp_key . " \n";
|
|
1880 |
$ntpcfg .= "requestkey " . $ntp_key . " \n";
|
|
1881 |
$ntpcfg .= "controlkey " . $ntp_key . " \n";
|
|
1880 | 1882 |
$ntpcfg .= "\n"; |
1881 | 1883 |
} |
1882 | 1884 | |
... | ... | |
2049 | 2051 |
} |
2050 | 2052 |
if (substr_count(config_get_path('ntpd/noselect'), $ts)) { |
2051 | 2053 |
$ntpcfg .= ' noselect'; |
2054 |
} |
|
2055 |
if (config_get_path('ntpd/serverauth') == 'yes') { |
|
2056 |
$ntpcfg .= " key " . $ntp_key . " "; |
|
2052 | 2057 |
} |
2053 | 2058 |
$ntpcfg .= "\n"; |
2054 | 2059 |
} |