From 560411eae7be70e5ef44edbdb5000aa311fdae8f Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 15 May 2018 21:16:11 +0200 Subject: bugfix: DNS domain forward server syntax When generating a configuration for DNS domain forward to a local server with 'set service dns forwarding domain foo.com server 1.1.1.1' this resulted in # domain ... server ... forward-zones=bar.com = 2.1.1.1;2.1.1.2 forward-zones=foo.com = 1.1.1.1;1.1.1.2 On PowerDNS recursor restart the last line won and it totally forgot about 'bar.com'. This could be seen from the logfiles that only one domain was loaded: Redirecting queries for zone 'foo.com.' to: 1.1.1.1:53, 1.1.1.2:53 The manual at https://doc.powerdns.com/3/recursor/settings/#forward-zones shows that all domains have to be configured on one 'forward-zones=' line. In the above example this has to result in: forward-zones=bar.com=2.1.1.1;2.1.1.2, foo.com=1.1.1.1;1.1.1.2 A subsequent check within the logfiles reveal that it's now working: Redirecting queries for zone 'bar.com.' to: 2.2.2.2:53, 2.2.2.1:53 Redirecting queries for zone 'foo.com.' to: 1.1.1.1:53, 1.1.1.2:53 --- src/conf-mode/vyos-config-dns-forwarding.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/conf-mode/vyos-config-dns-forwarding.py b/src/conf-mode/vyos-config-dns-forwarding.py index 5494d07aa..be48cde60 100755 --- a/src/conf-mode/vyos-config-dns-forwarding.py +++ b/src/conf-mode/vyos-config-dns-forwarding.py @@ -51,9 +51,10 @@ local-address={{ listen_on | join(',') }} # domain ... server ... {% if domains -%} -{% for d in domains -%} -forward-zones={{ d.name }}={{ d.servers | join(";") }} -{% endfor -%} +forward-zones={% for d in domains %} +{{ d.name }}={{ d.servers | join(";") }} +{%- if loop.first %}, {% endif %} +{% endfor %} {% endif %} @@ -184,7 +185,7 @@ def generate(dns): if dns is None: return None - tmpl = jinja2.Template(config_tmpl) + tmpl = jinja2.Template(config_tmpl, trim_blocks=True) config_text = tmpl.render(dns) with open(config_file, 'w') as f: -- cgit v1.2.3