From 2b14bd20fa6800e38936a624b10a3212ba192e9e Mon Sep 17 00:00:00 2001 From: Pascal Vizeli Date: Sat, 13 Feb 2021 19:21:24 +0100 Subject: [PATCH] Revert "Support srv-host records (#1824)" (#1851) This reverts commit 18c939c546787c2225d77e4d486856dc2235dd0d. --- dnsmasq/CHANGELOG.md | 4 --- dnsmasq/DOCS.md | 30 ------------------- dnsmasq/apparmor.txt | 8 ----- dnsmasq/config.json | 14 ++------- dnsmasq/data/run.sh | 25 ++++++++++++---- .../rootfs/usr/share/tempio/dnsmasq.config | 22 -------------- 6 files changed, 22 insertions(+), 81 deletions(-) delete mode 100644 dnsmasq/rootfs/usr/share/tempio/dnsmasq.config diff --git a/dnsmasq/CHANGELOG.md b/dnsmasq/CHANGELOG.md index 8334af4..3c67c5e 100644 --- a/dnsmasq/CHANGELOG.md +++ b/dnsmasq/CHANGELOG.md @@ -1,9 +1,5 @@ # Changelog -## 1.4 - -- Adds support for srv-host records - ## 1.3 - Rewrites add-on onto Bashio diff --git a/dnsmasq/DOCS.md b/dnsmasq/DOCS.md index fb604bb..ac3f7da 100644 --- a/dnsmasq/DOCS.md +++ b/dnsmasq/DOCS.md @@ -32,12 +32,6 @@ forwards: hosts: - host: home.mydomain.io ip: 192.168.1.10 -services: - - srv: _ldap._tcp.pdc._msdcs.mydomain.io - host: dc.mydomain.io - port: 389 - priority: 0 - weight: 100 ``` ### Option: `defaults` (required) @@ -82,30 +76,6 @@ The hostname or domainname to resolve locally. The IP address Dnsmasq should respond with in its DNS answer. -### Option: `services` (optional) - -This option allows you to provide srv-host records. - -#### Option: `services.srv` - -The service to resolve. - -#### Option: `services.host` - -The host that contain the service. - -#### Option: `services.port` - -The port number for the service. - -#### Option: `services.priority` - -The priority for the service. - -#### Option: `services.weight` - -The weight for the service. - ## Support Got questions? diff --git a/dnsmasq/apparmor.txt b/dnsmasq/apparmor.txt index 667e6a0..47e961f 100644 --- a/dnsmasq/apparmor.txt +++ b/dnsmasq/apparmor.txt @@ -25,14 +25,6 @@ profile dnsmasq flags=(attach_disconnected,mediate_deleted) { /dev/tty rw, /tmp/* rw, - /etc/s6/** ix, - /run/s6/** ix, - /etc/services.d/** rwix, - /etc/cont-init.d/** rwix, - /etc/cont-finish.d/** rwix, - - /run/** rwk, - /run.sh rix, /data/** r, } diff --git a/dnsmasq/config.json b/dnsmasq/config.json index 731e55b..f3b2b73 100644 --- a/dnsmasq/config.json +++ b/dnsmasq/config.json @@ -1,6 +1,6 @@ { "name": "Dnsmasq", - "version": "1.4", + "version": "1.3", "slug": "dnsmasq", "description": "A simple DNS server", "url": "https://github.com/home-assistant/hassio-addons/tree/master/dnsmasq", @@ -14,8 +14,7 @@ "options": { "defaults": ["8.8.8.8", "8.8.4.4"], "forwards": [], - "hosts": [], - "services": [] + "hosts": [] }, "schema": { "defaults": ["str"], @@ -30,15 +29,6 @@ "host": "str", "ip": "str" } - ], - "services": [ - { - "srv": "str", - "host": "str", - "port": "str", - "priority": "int", - "weight": "int" - } ] }, "image": "homeassistant/{arch}-addon-dnsmasq" diff --git a/dnsmasq/data/run.sh b/dnsmasq/data/run.sh index f31ab66..1f5f9e2 100755 --- a/dnsmasq/data/run.sh +++ b/dnsmasq/data/run.sh @@ -5,12 +5,27 @@ CONFIG="/etc/dnsmasq.conf" bashio::log.info "Configuring dnsmasq..." -tempio \ - -conf /data/options.json \ - -template /usr/share/tempio/dnsmasq.config \ - -out "${CONFIG}" +# Add default forward servers +for server in $(bashio::config 'defaults'); do + echo "server=${server}" >> "${CONFIG}" +done + +# Create domain forwards +for forward in $(bashio::config 'forwards|keys'); do + DOMAIN=$(bashio::config "forwards[${forward}].domain") + SERVER=$(bashio::config "forwards[${forward}].server") + + echo "server=/${DOMAIN}/${SERVER}" >> "${CONFIG}" +done + +# Create static hosts +for host in $(bashio::config 'hosts|keys'); do + HOST=$(bashio::config "hosts[${host}].host") + IP=$(bashio::config "hosts[${host}].ip") + + echo "address=/${HOST}/${IP}" >> "${CONFIG}" +done # Run dnsmasq bashio::log.info "Starting dnsmasq..." exec dnsmasq -C "${CONFIG}" -z < /dev/null - diff --git a/dnsmasq/rootfs/usr/share/tempio/dnsmasq.config b/dnsmasq/rootfs/usr/share/tempio/dnsmasq.config deleted file mode 100644 index a3c23ea..0000000 --- a/dnsmasq/rootfs/usr/share/tempio/dnsmasq.config +++ /dev/null @@ -1,22 +0,0 @@ -# Automatically generated do not edit - -# Default forward servers -{{ range .defaults }} -server={{ . }} -{{ end }} - -# Domain forwards -{{ range .forwards }} -server=/{{ .domain }}/{{ .server }} -{{ end }} - -# Static hosts -{{ range .hosts }} -address=/{{ .host }}/{{ .ip }} -{{ end }} - -# Static srv-hosts -{{ range .services }} -srv-host={{ .srv }},{{ .host }},{{ .port }},{{ .priority }},{{ .weight }} -{{ end }} -