Skip to content

Commit 89a648c

Browse files
committed
Remove use_username_in_magic_dns option
Upgrade the use of dns.use_username_in_magic_dns or dns_config.use_username_in_magic_dns to a fatal error and remove the option from the example configuration and integration tests. Fixes: #2219
1 parent 697d80d commit 89a648c

7 files changed

+5
-21
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ This will also affect the way you [reference users in policies](https://github.c
7676

7777
### BREAKING
7878

79-
- Remove `dns.use_username_in_magic_dns` configuration option [#2020](https://github.com/juanfont/headscale/pull/2020)
79+
- Remove `dns.use_username_in_magic_dns` configuration option [#2020](https://github.com/juanfont/headscale/pull/2020), [#2279](https://github.com/juanfont/headscale/pull/2279)
8080
- Having usernames in magic DNS is no longer possible.
8181
- Remove versions older than 1.56 [#2149](https://github.com/juanfont/headscale/pull/2149)
8282
- Clean up old code required by old versions

config-example.yaml

-9
Original file line numberDiff line numberDiff line change
@@ -311,15 +311,6 @@ dns:
311311
# # you can also put it in one line
312312
# - { name: "prometheus.myvpn.example.com", type: "A", value: "100.64.0.3" }
313313

314-
# DEPRECATED
315-
# Use the username as part of the DNS name for nodes, with this option enabled:
316-
# node1.username.example.com
317-
# while when this is disabled:
318-
# node1.example.com
319-
# This is a legacy option as Headscale has have this wrongly implemented
320-
# while in upstream Tailscale, the username is not included.
321-
use_username_in_magic_dns: false
322-
323314
# Unix socket used for the CLI to connect without authentication
324315
# Note: for production you will want to set this to something like:
325316
unix_socket: /var/run/headscale/headscale.sock

hscontrol/types/config.go

+4-5
Original file line numberDiff line numberDiff line change
@@ -322,22 +322,21 @@ func validateServerConfig() error {
322322
depr.fatalIfNewKeyIsNotUsed("dns.nameservers.split", "dns_config.restricted_nameservers")
323323
depr.fatalIfNewKeyIsNotUsed("dns.search_domains", "dns_config.domains")
324324
depr.fatalIfNewKeyIsNotUsed("dns.extra_records", "dns_config.extra_records")
325-
depr.warn("dns_config.use_username_in_magic_dns")
326-
depr.warn("dns.use_username_in_magic_dns")
325+
depr.fatal("dns.use_username_in_magic_dns")
326+
depr.fatal("dns_config.use_username_in_magic_dns")
327327

328328
// TODO(kradalby): Reintroduce when strip_email_domain is removed
329329
// after #2170 is cleaned up
330330
// depr.fatal("oidc.strip_email_domain")
331-
depr.fatal("dns.use_username_in_musername_in_magic_dns")
332-
depr.fatal("dns_config.use_username_in_musername_in_magic_dns")
333331

334332
depr.Log()
335333

336334
for _, removed := range []string{
337335
// TODO(kradalby): Reintroduce when strip_email_domain is removed
338336
// after #2170 is cleaned up
339337
// "oidc.strip_email_domain",
340-
"dns_config.use_username_in_musername_in_magic_dns",
338+
"dns.use_username_in_magic_dns",
339+
"dns_config.use_username_in_magic_dns",
341340
} {
342341
if viper.IsSet(removed) {
343342
log.Fatal().

hscontrol/types/testdata/base-domain-in-server-url.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ server_url: "https://server.derp.no"
1313
dns:
1414
magic_dns: true
1515
base_domain: derp.no
16-
use_username_in_magic_dns: false

hscontrol/types/testdata/base-domain-not-in-server-url.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,3 @@ server_url: "https://derp.no"
1313
dns:
1414
magic_dns: true
1515
base_domain: clients.derp.no
16-
use_username_in_magic_dns: false

hscontrol/types/testdata/dns_full.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,3 @@ dns:
3333

3434
# you can also put it in one line
3535
- { name: "prometheus.myvpn.example.com", type: "A", value: "100.64.0.4" }
36-
37-
use_username_in_magic_dns: true

hscontrol/types/testdata/dns_full_no_magic.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,3 @@ dns:
3333

3434
# you can also put it in one line
3535
- { name: "prometheus.myvpn.example.com", type: "A", value: "100.64.0.4" }
36-
37-
use_username_in_magic_dns: true

0 commit comments

Comments
 (0)