summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authorkhramshinr <khramshinr@gmail.com>2024-07-29 15:31:37 +0600
committerkhramshinr <khramshinr@gmail.com>2024-09-11 13:14:31 +0600
commit9e194ce895319683b877890ebb7d5da06b8e9b31 (patch)
treed122f1c034c026062b5612d35c617e48cfb7c863 /data
parent4bbd5c7c13f7ea72ba40813db0e6258ecf0a59f7 (diff)
downloadvyos-1x-9e194ce895319683b877890ebb7d5da06b8e9b31.tar.gz
vyos-1x-9e194ce895319683b877890ebb7d5da06b8e9b31.zip
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 %}