From 488a7629175804bfdce0560a7c7126c1b2eafe99 Mon Sep 17 00:00:00 2001 From: Qasim Mehmood <18313886+ThisIsQasim@users.noreply.github.com> Date: Sun, 6 Jun 2021 21:43:31 +0500 Subject: [PATCH] Allow extending dnsmasq by providing custom configuration. (#162) * Allow extending dnsmasq by providing custom configuration. * update README with optional dnsmasq config --- README.md | 11 +++++++---- entrypoint.sh | 3 +++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 2cba19ac..527c4e0a 100644 --- a/README.md +++ b/README.md @@ -167,18 +167,20 @@ docker create \ --network host \ --cap-add NET_ADMIN \ --volume /data:/data \ + # Optional directory for mounting dnsmasq configurations + --volume /etc/dnsmasq.d:/etc/dnsmasq.d \ --env SUBSPACE_HTTP_HOST="subspace.example.com" \ - # Optional variable to change upstream DNS provider + # Optional variable to change upstream DNS provider --env SUBSPACE_NAMESERVERS="1.1.1.1,8.8.8.8" \ - # Optional variable to change WireGuard Listenport + # Optional variable to change WireGuard Listenport --env SUBSPACE_LISTENPORT="51820" \ # Optional variables to change IPv4/v6 prefixes --env SUBSPACE_IPV4_POOL="10.99.97.0/24" \ --env SUBSPACE_IPV6_POOL="fd00::10:97:0/64" \ - # Optional variables to change IPv4/v6 Gateway + # Optional variables to change IPv4/v6 Gateway --env SUBSPACE_IPV4_GW="10.99.97.1" \ --env SUBSPACE_IPV6_GW="fd00::10:97:1" \ - # Optional variable to enable or disable IPv6 NAT + # Optional variable to enable or disable IPv6 NAT --env SUBSPACE_IPV6_NAT_ENABLED=1 \ # Optional variable to disable DNS server. Enabled by default. # consider disabling DNS server, if supporting international VPN clients @@ -203,6 +205,7 @@ services: container_name: subspace volumes: - /opt/docker/subspace:/data + - /opt/docker/dnsmasq:/etc/dnsmasq.d restart: always environment: - SUBSPACE_HTTP_HOST=subspace.example.org diff --git a/entrypoint.sh b/entrypoint.sh index 8d6b8b6f..9b1814b2 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -203,6 +203,9 @@ if [[ ${SUBSPACE_DISABLE_DNS} == "0" ]]; then # Never forward addresses in the non-routed address spaces. bogus-priv + + # Allow extending dnsmasq by providing custom configurations. + conf-dir=/etc/dnsmasq.d DNSMASQ mkdir -p /etc/service/dnsmasq