diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-06-01 23:16:57 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-06-01 23:16:57 +0200 |
commit | 28db29e42fca939f8157041cbedc52378ce3622e (patch) | |
tree | ef569cff6d1da9fb6f2e619d87975ee536f14c70 | |
parent | 6be3c1fad01744beae74f5753685a4e5a936bf54 (diff) | |
parent | 69577e72a7a88de96d44dcc30ae1822d92309361 (diff) | |
download | vyos-1x-28db29e42fca939f8157041cbedc52378ce3622e.tar.gz vyos-1x-28db29e42fca939f8157041cbedc52378ce3622e.zip |
Merge branch 'current' of github.com:vyos/vyos-1x into current
-rw-r--r-- | interface-definitions/ntp.xml | 20 | ||||
-rwxr-xr-x | src/conf_mode/ntp.py | 14 |
2 files changed, 31 insertions, 3 deletions
diff --git a/interface-definitions/ntp.xml b/interface-definitions/ntp.xml index 4688454c3..d324404da 100644 --- a/interface-definitions/ntp.xml +++ b/interface-definitions/ntp.xml @@ -1,7 +1,5 @@ <?xml version="1.0"?> - <!-- NTP configuration --> - <interfaceDefinition> <node name="system"> <children> @@ -66,6 +64,24 @@ </leafNode> </children> </node> + <leafNode name="listen-address"> + <properties> + <help>Addresses to listen for NTP queries</help> + <valueHelp> + <format>ipv4</format> + <description>Network Time Protocol (NTP) IPv4 address</description> + </valueHelp> + <valueHelp> + <format>ipv6</format> + <description>Network Time Protocol (NTP) IPv6 address</description> + </valueHelp> + <multi/> + <constraint> + <validator name="ipv4-address"/> + <validator name="ipv6-address"/> + </constraint> + </properties> + </leafNode> </children> </node> </children> diff --git a/src/conf_mode/ntp.py b/src/conf_mode/ntp.py index 9a4846bdf..2a6088575 100755 --- a/src/conf_mode/ntp.py +++ b/src/conf_mode/ntp.py @@ -62,11 +62,20 @@ restrict {{ n.address }} mask {{ n.netmask }} nomodify notrap nopeer {% endfor -%} {% endif %} +{% if listen_address -%} +# NTP should listen on configured addresses only +interface ignore wildcard +{% for a in listen_address -%} +interface listen {{ a }} +{% endfor -%} +{% endif %} + """ default_config_data = { 'servers': [], - 'allowed_networks': [] + 'allowed_networks': [], + 'listen_address': [] } def get_config(): @@ -89,6 +98,9 @@ def get_config(): ntp['allowed_networks'].append(net) + if conf.exists('listen-address'): + ntp['listen_address'] = conf.return_values('listen-address') + if conf.exists('server'): for node in conf.list_nodes('server'): options = [] |