summaryrefslogtreecommitdiff
path: root/scripts/system/vyatta_update_resolv.pl
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2015-02-26 22:50:05 +0000
committerAlex Harpin <development@landsofshadow.co.uk>2015-02-26 22:50:05 +0000
commitb9e07101d6347c0359fc68eac62e049acdfdbb78 (patch)
tree1829823bf808c85df9d3eae49d910f5f55ff3196 /scripts/system/vyatta_update_resolv.pl
parent2bea0c31e1469bc5ac1b20fdb16598b6e0d11699 (diff)
downloadvyatta-cfg-system-b9e07101d6347c0359fc68eac62e049acdfdbb78.tar.gz
vyatta-cfg-system-b9e07101d6347c0359fc68eac62e049acdfdbb78.zip
vyatta-cfg-system: redesign the layout and updating of ntp
When NTP is configured on the system, it not only acts as a client for the configured servers, but also as a server. Although the server is only available as a time source, it still represents a service that the user hasn't specifically enabled. This commit sets the default configuration of NTP to disallow all external access, so the system acts purely as a client by default, and also introduces the ability to configure which addresses / subnets are allowed to both query and use it as a time source. If the servers configured are specified as host names, these are resolved to IP addresses before being added to ntp.conf, with the same process carried out after name server changes. syntax 'set system ntp client address' Bug #94 http://bugzilla.vyos.net/show_bug.cgi?id=94
Diffstat (limited to 'scripts/system/vyatta_update_resolv.pl')
-rwxr-xr-xscripts/system/vyatta_update_resolv.pl7
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/system/vyatta_update_resolv.pl b/scripts/system/vyatta_update_resolv.pl
index 0dfa4bec..5de1f789 100755
--- a/scripts/system/vyatta_update_resolv.pl
+++ b/scripts/system/vyatta_update_resolv.pl
@@ -227,8 +227,11 @@ if (($dhclient_script == 1) || ($config_mode == 1)) {
}
if ($restart_ntp == 1) {
# this corresponds to what is done in name-server/node.def as a fix for bug 1300
- my $cmd_ntp_restart = "if [ -f /etc/ntp.conf ] && grep -q '^server' /etc/ntp.conf; then /usr/sbin/invoke-rc.d ntp restart >&/dev/null; fi &";
- system($cmd_ntp_restart);
+ if ($vc->exists("system ntp server") || $vc->existsOrig("system ntp server")) {
+ system("sudo /opt/vyatta/sbin/vyatta_update_ntp.pl");
+ my $cmd_ntp_restart = "if [ -f /etc/ntp.conf ] && grep -q '^server' /etc/ntp.conf; then /usr/sbin/invoke-rc.d ntp restart >&/dev/null; fi &";
+ system($cmd_ntp_restart);
+ }
}
}