diff options
| -rw-r--r-- | data/templates/dns-dynamic/ddclient.conf.j2 | 10 | ||||
| -rwxr-xr-x | src/conf_mode/service_dns_dynamic.py | 7 |
2 files changed, 11 insertions, 6 deletions
diff --git a/data/templates/dns-dynamic/ddclient.conf.j2 b/data/templates/dns-dynamic/ddclient.conf.j2 index 98d1584a1..fd50a529d 100644 --- a/data/templates/dns-dynamic/ddclient.conf.j2 +++ b/data/templates/dns-dynamic/ddclient.conf.j2 @@ -29,19 +29,17 @@ if{{ ipv }}={{ address }}, \ # {{ config.description }} {% endif %} {% for host in config.host_name if config.host_name is vyos_defined %} -{# ip_suffixes can be either of ['v4'], ['v6'], ['v4', 'v6'] for all protocols #} -{% set ip_suffixes = ['v4', 'v6'] if config.ip_version == 'both' - else [config.ip_version[2:]] %} -{% set password = config.key if config.protocol == 'nsupdate' - else config.password %} {% set address = 'web' if config.address.web is vyos_defined else config.address.interface %} {% set web_options = config.address.web | default({}) %} +{# ip_suffixes can be either of ['v4'], ['v6'], ['v4', 'v6'] for all protocols #} +{% set ip_suffixes = ['v4', 'v6'] if config.ip_version == 'both' + else [config.ip_version[2:]] %} # Web service dynamic DNS configuration for {{ service }}: [{{ config.protocol }}, {{ host }}] {{ render_config(host, address, web_options, ip_suffixes, protocol=config.protocol, server=config.server, zone=config.zone, - login=config.username, password=password, ttl=config.ttl, + login=config.username, password=config.password, ttl=config.ttl, min_interval=config.wait_time, max_interval=config.expiry_time) }} {% endfor %} {% endfor %} diff --git a/src/conf_mode/service_dns_dynamic.py b/src/conf_mode/service_dns_dynamic.py index 08ee80a6b..682daa8a2 100755 --- a/src/conf_mode/service_dns_dynamic.py +++ b/src/conf_mode/service_dns_dynamic.py @@ -156,6 +156,13 @@ def generate(dyndns): if not dyndns or 'name' not in dyndns: return None + # Adjust protocol specific keys + for name in dyndns['name']: + # nsupdate (RFC2136) uses: + # - 'password' in ddclient.conf instead of 'key' in vyos conf + if dyndns['name'][name]['protocol'] == 'nsupdate': + dyndns['name'][name]['password'] = dyndns['name'][name].pop('key') + render(config_file, 'dns-dynamic/ddclient.conf.j2', dyndns, permission=0o600) render(systemd_override, 'dns-dynamic/override.conf.j2', dyndns) return None |
