unbound: expand UCI to cover some popular dnsmasq features

Unbound+DHCP (server of your choice) should be able to replicate
a lot of what dnsmasq provides. With this change set Unbound
still works with dnsmasq, but also it can work with a plain
DHCP server. Features have been added within the UCI itself
to act like dnsmasq.

- alone: name each interface relative to router hostname
- alone: prevent upstream leakage of your domain and '.local'
- dnsmasq: use dnsmasq UCI to configure forwarding clauses
- dhcp: work with odhcpd as example of companion DHCP-DNS
- dhcp: convert DHCPv4 leases into EUI64 SLAAC for DNS records
- all: enable encrypted remote unbound-control using splice conf
- all: allow user spliced conf-files for hybrid UCI and manual conf
-- 'unbound_srv.conf' will be spliced into the 'server:' clause
-- 'unbound_ext.conf' will add clauses to the end, example 'forward:'

README HOW TO for dnsmasq-in-serial, dnsmasq-in-parallel, and
unbound-with-odhcpd have better/added UCI starters. HOW TO for
including unbound_srv.conf and unbound_ext.conf are added.
Document new UCI: add_local_fqdn, add_wan_fqdn, dhcp4_slaac6,
dhcp_link, domain, and domain_type

Signed-off-by: Eric Luehrsen <ericluehrsen@hotmail.com>
This commit is contained in:
Eric Luehrsen
2016-12-29 01:32:31 -05:00
parent 89e7bb8f38
commit de1198d54d
8 changed files with 455 additions and 173 deletions
+24 -24
View File
@@ -23,12 +23,19 @@
#
##############################################################################
create_local_zone() {
dnsmasq_local_zone() {
local cfg="$1"
local fwd_port fwd_domain
local fwd_port fwd_domain wan_fqdn
# dnsmasq domain and interface assignment settings will control config
config_get fwd_domain "$cfg" domain
config_get fwd_port "$cfg" port
config_get fwd_port "$cfg" port
config_get wan_fqdn "$cfg" add_wan_fqdn
if [ -n "$wan_fqdn" ] ; then
UNBOUND_D_WAN_FQDN=$wan_fqdn
fi
if [ -n "$fwd_domain" -a -n "$fwd_port" -a ! "$fwd_port" -eq 53 ] ; then
@@ -48,7 +55,7 @@ create_local_zone() {
##############################################################################
create_local_arpa() {
dnsmasq_local_arpa() {
local cfg="$1"
local logint dhcpv4 dhcpv6 ignore
local subnets subnets4 subnets6
@@ -78,7 +85,7 @@ create_local_arpa() {
forward=""
elif [ "$ignore" -gt 0 ] ; then
if [ "$UNBOUND_B_GATE_NAME" -gt 0 ] ; then
if [ "$UNBOUND_D_WAN_FQDN" -gt 0 ] ; then
# Only forward the one gateway host.
forward="host"
@@ -137,11 +144,11 @@ create_local_arpa() {
##############################################################################
forward_local_zone() {
dnsmasq_forward_zone() {
if [ -n "$UNBOUND_N_FWD_PORTS" -a -n "$UNBOUND_TXT_FWD_ZONE" ] ; then
for fwd_domain in $UNBOUND_TXT_FWD_ZONE ; do
{
# This is derived of create_local_zone/arpa
# This is derived of dnsmasq_local_zone/arpa
# but forward: clauses need to be seperate
echo "forward-zone:"
echo " name: \"$fwd_domain.\""
@@ -159,23 +166,16 @@ forward_local_zone() {
##############################################################################
dnsmasq_link() {
####################
# UCI @ dhcp #
####################
if [ "$UNBOUND_D_DHCP_LINK" = "dnsmasq" ] ; then
# Forward to dnsmasq on same host for DHCP lease hosts
echo " do-not-query-localhost: no" >> $UNBOUND_CONFFILE
# Look at dnsmasq settings
config_load dhcp
# Zone for DHCP / SLAAC-PING DOMAIN
config_foreach create_local_zone dnsmasq
# Zone for DHCP / SLAAC-PING ARPA
config_foreach create_local_arpa dhcp
# Now create ALL seperate forward: clauses
forward_local_zone
fi
# Forward to dnsmasq on same host for DHCP lease hosts
echo " do-not-query-localhost: no" >> $UNBOUND_CONFFILE
# Look at dnsmasq settings
config_load dhcp
# Zone for DHCP / SLAAC-PING DOMAIN
config_foreach dnsmasq_local_zone dnsmasq
# Zone for DHCP / SLAAC-PING ARPA
config_foreach dnsmasq_local_arpa dhcp
# Now create ALL seperate forward: clauses
dnsmasq_forward_zone
}
##############################################################################