mirror of
https://github.com/aljazceru/addons.git
synced 2025-12-19 06:04:21 +01:00
Support srv-host records (#1824)
* Support srv-host records * Fix syntax error * Update docs * Update ver * Add support for extra options * Update docs * Apply PR feedback * Use tempio * Rename extra-options to extra_options * Fix stupid mistake * Fix docs * Fix mistake * Remove extra_options * Apply PR feedback * Update change log
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 1.4
|
||||||
|
|
||||||
|
- Adds support for srv-host records
|
||||||
|
|
||||||
## 1.3
|
## 1.3
|
||||||
|
|
||||||
- Rewrites add-on onto Bashio
|
- Rewrites add-on onto Bashio
|
||||||
|
|||||||
@@ -32,6 +32,12 @@ forwards:
|
|||||||
hosts:
|
hosts:
|
||||||
- host: home.mydomain.io
|
- host: home.mydomain.io
|
||||||
ip: 192.168.1.10
|
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)
|
### 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.
|
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
|
## Support
|
||||||
|
|
||||||
Got questions?
|
Got questions?
|
||||||
|
|||||||
@@ -25,6 +25,14 @@ profile dnsmasq flags=(attach_disconnected,mediate_deleted) {
|
|||||||
/dev/tty rw,
|
/dev/tty rw,
|
||||||
/tmp/* 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,
|
/run.sh rix,
|
||||||
/data/** r,
|
/data/** r,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Dnsmasq",
|
"name": "Dnsmasq",
|
||||||
"version": "1.3",
|
"version": "1.4",
|
||||||
"slug": "dnsmasq",
|
"slug": "dnsmasq",
|
||||||
"description": "A simple DNS server",
|
"description": "A simple DNS server",
|
||||||
"url": "https://github.com/home-assistant/hassio-addons/tree/master/dnsmasq",
|
"url": "https://github.com/home-assistant/hassio-addons/tree/master/dnsmasq",
|
||||||
@@ -14,7 +14,8 @@
|
|||||||
"options": {
|
"options": {
|
||||||
"defaults": ["8.8.8.8", "8.8.4.4"],
|
"defaults": ["8.8.8.8", "8.8.4.4"],
|
||||||
"forwards": [],
|
"forwards": [],
|
||||||
"hosts": []
|
"hosts": [],
|
||||||
|
"services": []
|
||||||
},
|
},
|
||||||
"schema": {
|
"schema": {
|
||||||
"defaults": ["str"],
|
"defaults": ["str"],
|
||||||
@@ -29,6 +30,15 @@
|
|||||||
"host": "str",
|
"host": "str",
|
||||||
"ip": "str"
|
"ip": "str"
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"services": [
|
||||||
|
{
|
||||||
|
"srv": "str",
|
||||||
|
"host": "str",
|
||||||
|
"port": "str",
|
||||||
|
"priority": "int",
|
||||||
|
"weight": "int"
|
||||||
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"image": "homeassistant/{arch}-addon-dnsmasq"
|
"image": "homeassistant/{arch}-addon-dnsmasq"
|
||||||
|
|||||||
@@ -5,27 +5,12 @@ CONFIG="/etc/dnsmasq.conf"
|
|||||||
|
|
||||||
bashio::log.info "Configuring dnsmasq..."
|
bashio::log.info "Configuring dnsmasq..."
|
||||||
|
|
||||||
# Add default forward servers
|
tempio \
|
||||||
for server in $(bashio::config 'defaults'); do
|
-conf /data/options.json \
|
||||||
echo "server=${server}" >> "${CONFIG}"
|
-template /usr/share/tempio/dnsmasq.config \
|
||||||
done
|
-out "${CONFIG}"
|
||||||
|
|
||||||
# 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
|
# Run dnsmasq
|
||||||
bashio::log.info "Starting dnsmasq..."
|
bashio::log.info "Starting dnsmasq..."
|
||||||
exec dnsmasq -C "${CONFIG}" -z < /dev/null
|
exec dnsmasq -C "${CONFIG}" -z < /dev/null
|
||||||
|
|
||||||
|
|||||||
22
dnsmasq/rootfs/usr/share/tempio/dnsmasq.config
Normal file
22
dnsmasq/rootfs/usr/share/tempio/dnsmasq.config
Normal file
@@ -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 }}
|
||||||
|
|
||||||
Reference in New Issue
Block a user