summaryrefslogtreecommitdiff
path: root/data/templates/dns-forwarding/recursor.conf.lua.j2
blob: 622283ad85a1d0d3ebed790c6c172f4bb5cae2fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
-- Autogenerated by VyOS (service_dns_forwarding.py) --
-- Do not edit, your changes will get overwritten --

-- Load DNSSEC root keys from dns-root-data package.
dofile("/usr/share/pdns-recursor/lua-config/rootkeys.lua")

-- Load lua from vyos-hostsd --
dofile("{{ config_dir }}/recursor.vyos-hostsd.conf.lua")

-- ZoneToCache --
{% if zone_cache is vyos_defined %}
{%     set option_mapping = {
    'refresh': 'refreshPeriod',
    'retry_interval': 'retryOnErrorPeriod',
    'max_zone_size': 'maxReceivedMBytes'
} %}
{%     for name, conf in zone_cache.items() %}
{%         set source = conf.source.items() | first %}
{%         set settings = [] %}
{%         for key, val in conf.options.items() %}
{%             set mapped_key = option_mapping.get(key, key) %}
{%             if key == 'refresh' %}
{%                 set val = val['interval'] %}
{%             endif %}
{%             if key in ['dnssec', 'zonemd'] %}
{%                 set _ = settings.append(mapped_key ~ ' = "' ~ val ~ '"') %}
{%             else %}
{%                 set _ = settings.append(mapped_key ~ ' = ' ~ val) %}
{%             endif %}
{%         endfor %}

zoneToCache("{{ name }}", "{{ source[0] }}", "{{ source[1] }}", { {{ settings | join(', ') }} })

{%     endfor %}

{% endif %}