juanfont / headscale

An open source, self-hosted implementation of the Tailscale control server
BSD 3-Clause "New" or "Revised" License
22.09k stars 1.23k forks source link

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

Closed mitchellkellett closed 2 weeks ago

mitchellkellett commented 3 weeks ago

Is this a support request?

Is there an existing issue for this?

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

Anything else?

config.yaml

~~~
dns:
  magic_dns: true
  base_domain: hs.net
  nameservers:
    global:
      - https://dns.nextdns.io/abc123
  search_domains: []
  extra_records: []
~~~
gperez2000 commented 3 weeks ago

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
kradalby commented 3 weeks ago

please use markdown formatting, this is impossible to read.

Zeashh commented 3 weeks ago

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
kradalby commented 2 weeks ago

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

cg31 commented 2 weeks ago

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")

kradalby commented 2 weeks ago

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