From a4aa6c7bf0dd1eb0603ea8e16095ecd2468c334d Mon Sep 17 00:00:00 2001 From: Jiang Zhu Date: Sat, 22 Oct 2022 04:01:22 +0800 Subject: [PATCH 1/2] fix issues related to DNS, hopefully this will fix issue 660 (by allow empty dns server with magic dns enabled) 1. inject search domain requires at least one DNS server https://tailscale.com/kb/1054/dns/#how-can-i-define-a-search-domain-without-a-nameserver 2. magic DNS doesn't require DNS server anymore(tailscale v1.20 or later) https://tailscale.com/kb/1081/magicdns/ --- config.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/config.go b/config.go index 494356d863..9ce39f26ca 100644 --- a/config.go +++ b/config.go @@ -434,19 +434,19 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) { } if viper.IsSet("dns_config.domains") { - dnsConfig.Domains = viper.GetStringSlice("dns_config.domains") - } - - if viper.IsSet("dns_config.magic_dns") { - magicDNS := viper.GetBool("dns_config.magic_dns") + domains := viper.GetStringSlice("dns_config.domains") if len(dnsConfig.Nameservers) > 0 { - dnsConfig.Proxied = magicDNS - } else if magicDNS { + dnsConfig.Domains = domains + } else if domains != nil { log.Warn(). - Msg("Warning: dns_config.magic_dns is set, but no nameservers are configured. Ignoring magic_dns.") + Msg("Warning: dns_config.domains is set, but no nameservers are configured. Ignoring domains.") } } + if viper.IsSet("dns_config.magic_dns") { + dnsConfig.Proxied = viper.GetBool("dns_config.magic_dns") + } + var baseDomain string if viper.IsSet("dns_config.base_domain") { baseDomain = viper.GetString("dns_config.base_domain") From 500e8993201a7a5bbb626a57945c2255861a2fb0 Mon Sep 17 00:00:00 2001 From: Jiang Zhu Date: Sat, 22 Oct 2022 04:06:19 +0800 Subject: [PATCH 2/2] update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66fbf98966..cbea979277 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ - Add support for evaluating `autoApprovers` ACL entries when a machine is registered [#763](https://github.com/juanfont/headscale/pull/763) - Add config flag to allow Headscale to start if OIDC provider is down [#829](https://github.com/juanfont/headscale/pull/829) - Random node DNS suffix only applied if names collide in namespace. [#766](https://github.com/juanfont/headscale/issues/766) +- Fix some DNS config issues [#660](https://github.com/juanfont/headscale/issues/660) ## 0.16.4 (2022-08-21)