diff --git a/dnsmasq/CHANGELOG.md b/dnsmasq/CHANGELOG.md index 3c67c5e..8334af4 100644 --- a/dnsmasq/CHANGELOG.md +++ b/dnsmasq/CHANGELOG.md @@ -1,5 +1,9 @@ # 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 ac3f7da..fb604bb 100644 --- a/dnsmasq/DOCS.md +++ b/dnsmasq/DOCS.md @@ -32,6 +32,12 @@ 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) @@ -76,6 +82,30 @@ 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 47e961f..667e6a0 100644 --- a/dnsmasq/apparmor.txt +++ b/dnsmasq/apparmor.txt @@ -25,6 +25,14 @@ 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 f3b2b73..731e55b 100644 --- a/dnsmasq/config.json +++ b/dnsmasq/config.json @@ -1,6 +1,6 @@ { "name": "Dnsmasq", - "version": "1.3", + "version": "1.4", "slug": "dnsmasq", "description": "A simple DNS server", "url": "https://github.com/home-assistant/hassio-addons/tree/master/dnsmasq", @@ -14,7 +14,8 @@ "options": { "defaults": ["8.8.8.8", "8.8.4.4"], "forwards": [], - "hosts": [] + "hosts": [], + "services": [] }, "schema": { "defaults": ["str"], @@ -29,6 +30,15 @@ "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 1f5f9e2..f31ab66 100755 --- a/dnsmasq/data/run.sh +++ b/dnsmasq/data/run.sh @@ -5,27 +5,12 @@ CONFIG="/etc/dnsmasq.conf" bashio::log.info "Configuring dnsmasq..." -# 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 +tempio \ + -conf /data/options.json \ + -template /usr/share/tempio/dnsmasq.config \ + -out "${CONFIG}" # 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 new file mode 100644 index 0000000..a3c23ea --- /dev/null +++ b/dnsmasq/rootfs/usr/share/tempio/dnsmasq.config @@ -0,0 +1,22 @@ +# 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 }} +