mirror of
https://github.com/juanfont/headscale.git
synced 2024-11-26 08:53:05 +00:00
Add support for "override local DNS" (#905)
* Add support for "override local DNS" Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> * Update changelog Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> * Update cli dump test Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com> Signed-off-by: Kristoffer Dalby <kristoffer@tailscale.com>
This commit is contained in:
parent
4e8b95e6cd
commit
ca8bca98ed
9 changed files with 19 additions and 1 deletions
|
@ -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)
|
- 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)
|
- 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)
|
- Remove `ip_prefix` configuration option and warning [#899](https://github.com/juanfont/headscale/pull/899)
|
||||||
|
- Add `dns_config.override_local_dns` option [#905](https://github.com/juanfont/headscale/pull/905)
|
||||||
- Fix some DNS config issues [#660](https://github.com/juanfont/headscale/issues/660)
|
- Fix some DNS config issues [#660](https://github.com/juanfont/headscale/issues/660)
|
||||||
|
|
||||||
## 0.16.4 (2022-08-21)
|
## 0.16.4 (2022-08-21)
|
||||||
|
|
|
@ -192,6 +192,9 @@ acl_policy_path: ""
|
||||||
# - https://tailscale.com/blog/2021-09-private-dns-with-magicdns/
|
# - https://tailscale.com/blog/2021-09-private-dns-with-magicdns/
|
||||||
#
|
#
|
||||||
dns_config:
|
dns_config:
|
||||||
|
# Whether to prefer using Headscale provided DNS or use local.
|
||||||
|
override_local_dns: true
|
||||||
|
|
||||||
# List of DNS servers to expose to clients.
|
# List of DNS servers to expose to clients.
|
||||||
nameservers:
|
nameservers:
|
||||||
- 1.1.1.1
|
- 1.1.1.1
|
||||||
|
|
10
config.go
10
config.go
|
@ -160,6 +160,7 @@ func LoadConfig(path string, isFile bool) error {
|
||||||
viper.SetDefault("log.format", TextLogFormat)
|
viper.SetDefault("log.format", TextLogFormat)
|
||||||
|
|
||||||
viper.SetDefault("dns_config", nil)
|
viper.SetDefault("dns_config", nil)
|
||||||
|
viper.SetDefault("dns_config.override_local_dns", true)
|
||||||
|
|
||||||
viper.SetDefault("derp.server.enabled", false)
|
viper.SetDefault("derp.server.enabled", false)
|
||||||
viper.SetDefault("derp.server.stun.enabled", true)
|
viper.SetDefault("derp.server.stun.enabled", true)
|
||||||
|
@ -377,6 +378,8 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) {
|
||||||
if viper.IsSet("dns_config") {
|
if viper.IsSet("dns_config") {
|
||||||
dnsConfig := &tailcfg.DNSConfig{}
|
dnsConfig := &tailcfg.DNSConfig{}
|
||||||
|
|
||||||
|
overrideLocalDNS := viper.GetBool("dns_config.override_local_dns")
|
||||||
|
|
||||||
if viper.IsSet("dns_config.nameservers") {
|
if viper.IsSet("dns_config.nameservers") {
|
||||||
nameserversStr := viper.GetStringSlice("dns_config.nameservers")
|
nameserversStr := viper.GetStringSlice("dns_config.nameservers")
|
||||||
|
|
||||||
|
@ -399,7 +402,12 @@ func GetDNSConfig() (*tailcfg.DNSConfig, string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
dnsConfig.Nameservers = nameservers
|
dnsConfig.Nameservers = nameservers
|
||||||
dnsConfig.Resolvers = resolvers
|
|
||||||
|
if overrideLocalDNS {
|
||||||
|
dnsConfig.Resolvers = resolvers
|
||||||
|
} else {
|
||||||
|
dnsConfig.FallbackResolvers = resolvers
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if viper.IsSet("dns_config.restricted_nameservers") {
|
if viper.IsSet("dns_config.restricted_nameservers") {
|
||||||
|
|
|
@ -14,6 +14,7 @@ derp:
|
||||||
urls:
|
urls:
|
||||||
- https://controlplane.tailscale.com/derpmap/default
|
- https://controlplane.tailscale.com/derpmap/default
|
||||||
dns_config:
|
dns_config:
|
||||||
|
override_local_dns: true
|
||||||
base_domain: headscale.net
|
base_domain: headscale.net
|
||||||
domains: []
|
domains: []
|
||||||
magic_dns: true
|
magic_dns: true
|
||||||
|
|
|
@ -8,6 +8,7 @@ ip_prefixes:
|
||||||
- fd7a:115c:a1e0::/48
|
- fd7a:115c:a1e0::/48
|
||||||
- 100.64.0.0/10
|
- 100.64.0.0/10
|
||||||
dns_config:
|
dns_config:
|
||||||
|
override_local_dns: true
|
||||||
base_domain: headscale.net
|
base_domain: headscale.net
|
||||||
magic_dns: true
|
magic_dns: true
|
||||||
domains: []
|
domains: []
|
||||||
|
|
|
@ -14,6 +14,7 @@ derp:
|
||||||
urls:
|
urls:
|
||||||
- https://controlplane.tailscale.com/derpmap/default
|
- https://controlplane.tailscale.com/derpmap/default
|
||||||
dns_config:
|
dns_config:
|
||||||
|
override_local_dns: true
|
||||||
base_domain: headscale.net
|
base_domain: headscale.net
|
||||||
domains: []
|
domains: []
|
||||||
magic_dns: true
|
magic_dns: true
|
||||||
|
|
|
@ -8,6 +8,7 @@ ip_prefixes:
|
||||||
- fd7a:115c:a1e0::/48
|
- fd7a:115c:a1e0::/48
|
||||||
- 100.64.0.0/10
|
- 100.64.0.0/10
|
||||||
dns_config:
|
dns_config:
|
||||||
|
override_local_dns: true
|
||||||
base_domain: headscale.net
|
base_domain: headscale.net
|
||||||
magic_dns: true
|
magic_dns: true
|
||||||
domains: []
|
domains: []
|
||||||
|
|
|
@ -14,6 +14,7 @@ derp:
|
||||||
urls:
|
urls:
|
||||||
- https://controlplane.tailscale.com/derpmap/default
|
- https://controlplane.tailscale.com/derpmap/default
|
||||||
dns_config:
|
dns_config:
|
||||||
|
override_local_dns: true
|
||||||
base_domain: headscale.net
|
base_domain: headscale.net
|
||||||
domains: []
|
domains: []
|
||||||
magic_dns: true
|
magic_dns: true
|
||||||
|
|
|
@ -8,6 +8,7 @@ ip_prefixes:
|
||||||
- fd7a:115c:a1e0::/48
|
- fd7a:115c:a1e0::/48
|
||||||
- 100.64.0.0/10
|
- 100.64.0.0/10
|
||||||
dns_config:
|
dns_config:
|
||||||
|
override_local_dns: true
|
||||||
base_domain: headscale.net
|
base_domain: headscale.net
|
||||||
magic_dns: true
|
magic_dns: true
|
||||||
domains: []
|
domains: []
|
||||||
|
|
Loading…
Reference in a new issue