Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ keys remain all-access.

- `headscale users rename` now sends the identifier of the matched user instead of the raw `--identifier` flag value, so renaming by name works again [#3442](https://github.com/juanfont/headscale/pull/3442)

## 0.29.4 (202x-xx-xx)

**Minimum supported Tailscale client version: v1.80.0**

### Changes

- Lowercase DNS extra record names so mixed-case records resolve [#3366](https://github.com/juanfont/headscale/pull/3366)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets link the PR here in the changelog to follow the same style. Can you move it to under 0.29.4 and we get it out quicker.

## 0.29.3 (2026-07-29)

**Minimum supported Tailscale client version: v1.80.0**
Expand Down
20 changes: 18 additions & 2 deletions hscontrol/types/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ func dnsToTailcfgDNS(dns DNSConfig) *tailcfg.DNSConfig {

cfg.Proxied = dns.MagicDNS

cfg.ExtraRecords = dns.ExtraRecords
cfg.ExtraRecords = lowercaseRecordNames(dns.ExtraRecords)
if dns.OverrideLocalDNS {
cfg.Resolvers = dns.globalResolvers()
} else {
Expand Down Expand Up @@ -1475,6 +1475,22 @@ func (c *Config) SetExtraRecords(records []tailcfg.DNSRecord) {
defer tailcfgDNSMu.Unlock()

if c.TailcfgDNSConfig != nil {
c.TailcfgDNSConfig.ExtraRecords = records
c.TailcfgDNSConfig.ExtraRecords = lowercaseRecordNames(records)
}
}

// lowercaseRecordNames normalizes DNS record names to lowercase, as DNS names
// are case-insensitive and clients match extra records by exact name.
func lowercaseRecordNames(records []tailcfg.DNSRecord) []tailcfg.DNSRecord {
if len(records) == 0 {
return records
}

normalized := make([]tailcfg.DNSRecord, len(records))
for i, record := range records {
record.Name = strings.ToLower(record.Name)
normalized[i] = record
}

return normalized
}
29 changes: 29 additions & 0 deletions hscontrol/types/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,3 +741,32 @@ func TestTrustedProxies(t *testing.T) {
})
}
}

// DNS names are case-insensitive, but MagicDNS resolution in clients matches
// extra records by exact name, so mixed-case record names never resolve.
func TestExtraRecordsAreLowercased(t *testing.T) {
mixed := []tailcfg.DNSRecord{
{Name: "Printer.fritz.box", Type: "A", Value: "192.168.1.2"},
{Name: "NAS.FRITZ.BOX", Type: "A", Value: "192.168.1.3"},
}
want := []tailcfg.DNSRecord{
{Name: "printer.fritz.box", Type: "A", Value: "192.168.1.2"},
{Name: "nas.fritz.box", Type: "A", Value: "192.168.1.3"},
}

tcfg := dnsToTailcfgDNS(DNSConfig{
MagicDNS: true,
BaseDomain: "example.com",
ExtraRecords: mixed,
})
if diff := cmp.Diff(want, tcfg.ExtraRecords); diff != "" {
t.Errorf("dnsToTailcfgDNS extra records mismatch (-want +got):\n%s", diff)
}

cfg := &Config{TailcfgDNSConfig: &tailcfg.DNSConfig{}}
cfg.SetExtraRecords(mixed)

if diff := cmp.Diff(want, cfg.TailcfgDNSConfig.ExtraRecords); diff != "" {
t.Errorf("SetExtraRecords mismatch (-want +got):\n%s", diff)
}
}
Loading