summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2024-09-11 12:26:34 +0100
committerGitHub <noreply@github.com>2024-09-11 12:26:34 +0100
commitde8d388c9cf32eb9ef9f38abb2d6ba292f56069f (patch)
treed122f1c034c026062b5612d35c617e48cfb7c863 /data
parent4bbd5c7c13f7ea72ba40813db0e6258ecf0a59f7 (diff)
parent9e194ce895319683b877890ebb7d5da06b8e9b31 (diff)
downloadvyos-1x-de8d388c9cf32eb9ef9f38abb2d6ba292f56069f.tar.gz
vyos-1x-de8d388c9cf32eb9ef9f38abb2d6ba292f56069f.zip
Merge pull request #3896 from HollyGurza/T6294
T6294: Service dns forwarding add the ability to configure ZonetoCache
Diffstat (limited to 'data')
-rw-r--r--data/templates/dns-forwarding/recursor.conf.lua.j228
1 files changed, 28 insertions, 0 deletions
diff --git a/data/templates/dns-forwarding/recursor.conf.lua.j2 b/data/templates/dns-forwarding/recursor.conf.lua.j2
index 8026442c7..622283ad8 100644
--- a/data/templates/dns-forwarding/recursor.conf.lua.j2
+++ b/data/templates/dns-forwarding/recursor.conf.lua.j2
@@ -6,3 +6,31 @@ 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 %}