diff options
author | Christian Poessinger <christian@poessinger.com> | 2018-05-15 21:16:11 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2018-05-15 21:20:21 +0200 |
commit | 560411eae7be70e5ef44edbdb5000aa311fdae8f (patch) | |
tree | 9efaf80419d77dbcf488cb46c5f0b4e0d2d1f974 /src/conf-mode | |
parent | d34591809104df052d2706edec3ee3f8428cf55e (diff) | |
download | vyos-1x-560411eae7be70e5ef44edbdb5000aa311fdae8f.tar.gz vyos-1x-560411eae7be70e5ef44edbdb5000aa311fdae8f.zip |
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
Diffstat (limited to 'src/conf-mode')
-rwxr-xr-x | src/conf-mode/vyos-config-dns-forwarding.py | 9 |
1 files changed, 5 insertions, 4 deletions
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: |