From cb0e59f7c8c72c244d177d339084c93b2b20f605 Mon Sep 17 00:00:00 2001
From: Robin Sonnabend <robin@fsmpi.rwth-aachen.de>
Date: Wed, 4 Mar 2020 16:21:13 +0100
Subject: [PATCH] Optionally make unbound recursive if no forward is configured

---
 unbound/templates/unbound.conf.j2 | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/unbound/templates/unbound.conf.j2 b/unbound/templates/unbound.conf.j2
index 3c40228..ff7cb81 100644
--- a/unbound/templates/unbound.conf.j2
+++ b/unbound/templates/unbound.conf.j2
@@ -6,8 +6,10 @@ server:
 	access-control: {{i}} allow
 	{% endfor %}
 
+{% if unbound_upstream_hosts is defined and unbound_upstream_hosts %}
 forward-zone:
 	name: "."
 	{% for i in unbound_upstream_hosts %}
 	forward-addr: {{i}}
 	{% endfor %}
+{% endif %}
-- 
GitLab