From ec911981c217dea05564e47e9eb70c9e4cc40a09 Mon Sep 17 00:00:00 2001 From: Juan Font Alonso Date: Mon, 4 Oct 2021 19:43:58 +0200 Subject: [PATCH] Do not allow magicdns if not nameservers set up --- cmd/headscale/cli/utils.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cmd/headscale/cli/utils.go b/cmd/headscale/cli/utils.go index 53f96055..8f2fbdf1 100644 --- a/cmd/headscale/cli/utils.go +++ b/cmd/headscale/cli/utils.go @@ -108,8 +108,10 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) { dnsConfig.Domains = viper.GetStringSlice("dns_config.domains") } - if viper.IsSet("dns_config.magic_dns") { - dnsConfig.Proxied = viper.GetBool("dns_config.magic_dns") + if len(dnsConfig.Nameservers) > 0 { + if viper.IsSet("dns_config.magic_dns") { + dnsConfig.Proxied = viper.GetBool("dns_config.magic_dns") + } } var baseDomain string