diff --git a/CHANGELOG.md b/CHANGELOG.md index 870c88caa5..cb90e9572c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ - 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) - Remove `ip_prefix` configuration option and warning [#899](https://github.com/juanfont/headscale/pull/899) +- Fix some DNS config issues [#660](https://github.com/juanfont/headscale/issues/660) ## 0.16.4 (2022-08-21) diff --git a/config.go b/config.go index 1a9d0af46a..056d93f062 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")