[Bug] dns.use_username_in_magic_dns configuration key is deprecated warning #767

Closed
opened 2025-12-29 02:23:45 +01:00 by adam · 6 comments
Owner

Originally created by @mitchellkellett on GitHub (Aug 20, 2024).

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Since upgrading to 0.23.0-beta2, I'm now seeing the following in the startup log. I don't have use_username_in_magic_dns in the DNS section of the config.yaml file.

2024-08-20T21:13:50Z WRN
WARN: The "dns.use_username_in_magic_dns" configuration key is deprecated and has been removed. Please see the changelog for more details.

Expected Behavior

I'm only warned of the deprecation if I use use_username_in_magic_dns in the DNS section of the config.yaml file.

Steps To Reproduce

  1. Upgrade to 0.23.0-beta2.
  2. Start Headscale
  3. Observe Logs

Environment

- OS: Ubuntu 22.04
- Headscale version: 0.23.0-beta2
- Tailscale version: 1.70.0

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Anything else?

config.yaml

~~~
dns:
  magic_dns: true
  base_domain: hs.net
  nameservers:
    global:
      - https://dns.nextdns.io/abc123
  search_domains: []
  extra_records: []
~~~
Originally created by @mitchellkellett on GitHub (Aug 20, 2024). ### Is this a support request? - [X] This is not a support request ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current Behavior Since upgrading to 0.23.0-beta2, I'm now seeing the following in the startup log. I don't have use_username_in_magic_dns in the DNS section of the config.yaml file. 2024-08-20T21:13:50Z WRN WARN: The "dns.use_username_in_magic_dns" configuration key is deprecated and has been removed. Please see the changelog for more details. ### Expected Behavior I'm only warned of the deprecation if I use use_username_in_magic_dns in the DNS section of the config.yaml file. ### Steps To Reproduce 1. Upgrade to 0.23.0-beta2. 2. Start Headscale 3. Observe Logs ### Environment ```markdown - OS: Ubuntu 22.04 - Headscale version: 0.23.0-beta2 - Tailscale version: 1.70.0 ``` ### Runtime environment - [X] Headscale is behind a (reverse) proxy - [X] Headscale runs in a container ### Anything else? config.yaml ``` ~~~ dns: magic_dns: true base_domain: hs.net nameservers: global: - https://dns.nextdns.io/abc123 search_domains: [] extra_records: [] ~~~ ```
adam added the bug label 2025-12-29 02:23:45 +01:00
adam closed this issue 2025-12-29 02:23:45 +01:00
Author
Owner

@gperez2000 commented on GitHub (Aug 21, 2024):

The DNS configuration I have set up is as follows: I am not receiving any messages since I implemented it, and it functions well.

dns:

  nameservers:
    global:

    - 1.1.1.3
    - 9.9.9.9
    - 8.8.8.8


    split:
      yourdomain.com:
        - x.x.x.x
        - x.x.x.x
  domains: []
  extra_records:
    - name: "gitlab.yourdomain.dev"
      type: "A"
      value: "x.x.x.x"
    - name: "headscale.yourdomain.com"
      type: "A"
      value: "x.x.x.x"


  magic_dns: true


  base_domain: yourdomain.net
  use_username_in_magic_dns: false
@gperez2000 commented on GitHub (Aug 21, 2024): The DNS configuration I have set up is as follows: I am not receiving any messages since I implemented it, and it functions well. ``` dns: nameservers: global: - 1.1.1.3 - 9.9.9.9 - 8.8.8.8 split: yourdomain.com: - x.x.x.x - x.x.x.x domains: [] extra_records: - name: "gitlab.yourdomain.dev" type: "A" value: "x.x.x.x" - name: "headscale.yourdomain.com" type: "A" value: "x.x.x.x" magic_dns: true base_domain: yourdomain.net use_username_in_magic_dns: false ```
Author
Owner

@kradalby commented on GitHub (Aug 21, 2024):

please use markdown formatting, this is impossible to read.

@kradalby commented on GitHub (Aug 21, 2024): please use markdown formatting, this is impossible to read.
Author
Owner

@Zeashh commented on GitHub (Aug 21, 2024):

I got the same warning on the v.0.23.0-beta2 Docker image:

2024-08-21T07:39:56Z WRN
WARN: The "dns.use_username_in_magic_dns" configuration key is deprecated and has been removed. Please see the changelog for more details.

Config:

    server_url: https://domain.com:443
    listen_addr: 0.0.0.0:8080
    metrics_listen_addr: 0.0.0.0:9090
    grpc_listen_addr: 127.0.0.1:50443
    grpc_allow_insecure: false
    private_key_path: "/var/lib/headscale/private.key"
    noise:
      private_key_path: "/var/lib/headscale/noise_private.key"
    prefixes:
      v4: 100.64.0.0/10
      v6: fd7a:115c:a1e0::/48
      allocation: sequential
    derp:
      server:
        enabled: true
        region_id: 999
        region_code: "headscale"
        region_name: "Headscale Embedded DERP"
        stun_listen_addr: "0.0.0.0:3478"
        private_key_path: "/var/lib/headscale/derp_server_private.key"
        automatically_add_embedded_derp_region: true
      urls: []
      paths:
        - /etc/headscale/derp.yaml
      auto_update_enabled: true
      update_frequency: 24h
    disable_check_updates: true
    ephemeral_node_inactivity_timeout: 1h
    database:
      type: postgres
      postgres:
        host: ...
        port: 5432
        name: headscale
        user: headscale
        pass: "..."
        max_open_conns: 10
        max_idle_conns: 10
        conn_max_idle_time_secs: 3600
        ssl: true
    log:
      format: text
      level: debug
    dns:
      magic_dns: true
      base_domain: clients.domain.com
      nameservers:
        global:
          - 192.168.100.20
          #        - 1.1.1.1
          #        - 9.9.9.9
      split: {}
      search_domains:
        - clients.domain.com
      extra_records: []
    unix_socket: /var/run/headscale/headscale.sock
    unix_socket_permission: "0770"
    logtail:
      enabled: true
    randomize_client_port: false
@Zeashh commented on GitHub (Aug 21, 2024): I got the same warning on the v.0.23.0-beta2 Docker image: ``` 2024-08-21T07:39:56Z WRN WARN: The "dns.use_username_in_magic_dns" configuration key is deprecated and has been removed. Please see the changelog for more details. ``` Config: ``` yaml server_url: https://domain.com:443 listen_addr: 0.0.0.0:8080 metrics_listen_addr: 0.0.0.0:9090 grpc_listen_addr: 127.0.0.1:50443 grpc_allow_insecure: false private_key_path: "/var/lib/headscale/private.key" noise: private_key_path: "/var/lib/headscale/noise_private.key" prefixes: v4: 100.64.0.0/10 v6: fd7a:115c:a1e0::/48 allocation: sequential derp: server: enabled: true region_id: 999 region_code: "headscale" region_name: "Headscale Embedded DERP" stun_listen_addr: "0.0.0.0:3478" private_key_path: "/var/lib/headscale/derp_server_private.key" automatically_add_embedded_derp_region: true urls: [] paths: - /etc/headscale/derp.yaml auto_update_enabled: true update_frequency: 24h disable_check_updates: true ephemeral_node_inactivity_timeout: 1h database: type: postgres postgres: host: ... port: 5432 name: headscale user: headscale pass: "..." max_open_conns: 10 max_idle_conns: 10 conn_max_idle_time_secs: 3600 ssl: true log: format: text level: debug dns: magic_dns: true base_domain: clients.domain.com nameservers: global: - 192.168.100.20 # - 1.1.1.1 # - 9.9.9.9 split: {} search_domains: - clients.domain.com extra_records: [] unix_socket: /var/run/headscale/headscale.sock unix_socket_permission: "0770" logtail: enabled: true randomize_client_port: false ```
Author
Owner

@kradalby commented on GitHub (Aug 23, 2024):

I think its because I use viper to set it default false, should be fixed shortly.

@kradalby commented on GitHub (Aug 23, 2024): I think its because I use viper to set it default false, should be fixed shortly.
Author
Owner

@cg31 commented on GitHub (Aug 23, 2024):

This warning is bogus. Even we remove use_username_in_magic_dns in config.yaml, it still shows up.

Because LoadConfig() set a default and later warns about it:

https://github.com/juanfont/headscale/blob/main/hscontrol/types/config.go#L249

viper.SetDefault("dns.use_username_in_magic_dns", false)
// later
depr.warn("dns.use_username_in_magic_dns")

@cg31 commented on GitHub (Aug 23, 2024): This warning is bogus. Even we remove use_username_in_magic_dns in config.yaml, it still shows up. Because LoadConfig() set a default and later warns about it: https://github.com/juanfont/headscale/blob/main/hscontrol/types/config.go#L249 viper.SetDefault("dns.use_username_in_magic_dns", false) // later depr.warn("dns.use_username_in_magic_dns")
Author
Owner

@kradalby commented on GitHub (Aug 23, 2024):

Yes, just mentioned that in the previous comment, its fixed in #2075

@kradalby commented on GitHub (Aug 23, 2024): Yes, just mentioned that in the previous comment, its fixed in #2075
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#767