From 5960356e7b0e540ed49af17ec05a0ba608dfaae6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Fri, 10 Jul 2020 10:41:20 +0200 Subject: [PATCH] __unbound: add --local_data flag --- type/__unbound/files/unbound.conf.sh | 9 +++++++++ type/__unbound/man.rst | 4 ++++ type/__unbound/manifest | 5 +++++ type/__unbound/parameter/optional_multiple | 1 + 4 files changed, 19 insertions(+) diff --git a/type/__unbound/files/unbound.conf.sh b/type/__unbound/files/unbound.conf.sh index 46d2824..2f7ecff 100755 --- a/type/__unbound/files/unbound.conf.sh +++ b/type/__unbound/files/unbound.conf.sh @@ -18,6 +18,14 @@ generate_forward_addr() { done } +generate_local_data() { + IFS=' +' + for entry in $LOCAL_DATA; do + echo " local-data: \"$entry\"" + done +} + cat << EOF # # THIS FILE HAS BEEN GENERATED BY CDIST, DO NOT EDIT BY HAND. @@ -720,6 +728,7 @@ $(generate_access_control) # (this makes example.com, www.example.com, etc, all go to 192.0.2.3) # local-zone: "example.com" redirect # local-data: "example.com A 192.0.2.3" +$(generate_local_data) # # Shorthand to make PTR records, "IPv4 name" or "IPv6 name". # You can also add PTR records using local-data directly, but then diff --git a/type/__unbound/man.rst b/type/__unbound/man.rst index 679e601..316d011 100644 --- a/type/__unbound/man.rst +++ b/type/__unbound/man.rst @@ -34,6 +34,10 @@ access_control rc_interface Address or path to socket used for remote control (see `--enable_control`. Defaults to `127.0.0.1`). +local_data + Configure local data, which is served in reply to queries for it. Can be + specified multiple times. + BOOLEAN PARAMETERS ------------------ disable-ip4 diff --git a/type/__unbound/manifest b/type/__unbound/manifest index 346f30c..5d6b50f 100755 --- a/type/__unbound/manifest +++ b/type/__unbound/manifest @@ -54,6 +54,11 @@ if [ -f "$__object/parameter/rc_interface" ]; then export RC_INTERFACE fi +if [ -f "$__object/parameter/local_data" ]; then + LOCAL_DATA=$(cat "$__object/parameter/local_data") + export LOCAL_DATA +fi + # Boolean parameters: if [ -f "$__object/parameter/disable_ip4" ] && \ [ -f "$__object/parameter/disable_ip6" ]; then diff --git a/type/__unbound/parameter/optional_multiple b/type/__unbound/parameter/optional_multiple index ecacd1d..3fe7eca 100644 --- a/type/__unbound/parameter/optional_multiple +++ b/type/__unbound/parameter/optional_multiple @@ -1,2 +1,3 @@ access_control +local_data interface