[PR #6498] [MERGED] [management] fix: prevent reverse proxy domain from being pushed as DNS search domain #28316

Closed
opened 2026-08-05 08:06:09 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/6498
Author: @blaugrau90
Created: 6/21/2026
Status: Merged
Merged: 7/10/2026
Merged by: @mlsmaycon

Base: 0.74.4-branchHead: fix/reverse-proxy-search-domain


📝 Commits (1)

  • 3b83891 fix: prevent reverse proxy domain from being pushed as DNS search domain

📊 Changes

1 file changed (+2 additions, -1 deletions)

View changed files

📝 management/server/types/account.go (+2 -1)

📄 Description

Problem

SynthesizePrivateServiceZones creates CustomZone entries for private reverse proxy services without setting SearchDomainDisabled. Since Go defaults unset booleans to false, the reverse proxy domain gets pushed as a search domain suffix to all connected peers.

This causes short hostname resolution to break: a query for myserver gets expanded to myserver.app.example.com (the reverse proxy domain) and matched there — before the peer's local DNS search domains (e.g. pushed via DHCP) are tried. If a real DNS record exists under the reverse proxy domain with that name, it silently resolves to the wrong host.

The bug is hard to diagnose because it appears and disappears dynamically as reverse proxy services are toggled on/off.

Verified on macOS via scutil --dns — the reverse proxy domain appears at order 102801 (same range as Magic DNS nb.cloud at 102800), meaning it goes through a different, higher-priority path than nameserver groups (103xxx) and bypasses any user-controlled search domain toggle.

Fix

Set SearchDomainDisabled: true in the CustomZone created by SynthesizePrivateServiceZones, so the zone is registered only as a supplemental resolver (explicit *.app.example.com queries go through NetBird DNS) — but not as a search domain suffix appended to unqualified hostnames.

This is consistent with the NonAuthoritative: true already set on the same zone.

zone = &nbdns.CustomZone{
    Domain:               dns.Fqdn(serviceDomainZone),
    Records:              []nbdns.SimpleRecord{},
    NonAuthoritative:     true,
    SearchDomainDisabled: true, // ← added
}

Verification

Tested on a self-hosted NetBird stack with the patched binary (macOS peer, reverse proxy service active throughout):

Before:

resolver #1
  search domain[0] : nb.cloud
  search domain[1] : app.example.com    ← injected, breaks local resolution
  search domain[2] : internal.lan

After:

resolver #1
  search domain[0] : nb.cloud
  search domain[1] : internal.lan       ← reverse proxy domain gone

Short hostname resolution now correctly falls through to local DNS search domains.

Related discussion: https://github.com/netbirdio/netbird/discussions/6497

Documentation

  • Documentation is not needed

Summary by CodeRabbit

  • Bug Fixes
    • DNS custom zones for private services now have the search domain feature disabled, improving zone behavior for private service lookups.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/6498 **Author:** [@blaugrau90](https://github.com/blaugrau90) **Created:** 6/21/2026 **Status:** ✅ Merged **Merged:** 7/10/2026 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `0.74.4-branch` ← **Head:** `fix/reverse-proxy-search-domain` --- ### 📝 Commits (1) - [`3b83891`](https://github.com/netbirdio/netbird/commit/3b838912563f5125f31f92476109e4795dc9c14b) fix: prevent reverse proxy domain from being pushed as DNS search domain ### 📊 Changes **1 file changed** (+2 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `management/server/types/account.go` (+2 -1) </details> ### 📄 Description ## Problem `SynthesizePrivateServiceZones` creates `CustomZone` entries for private reverse proxy services without setting `SearchDomainDisabled`. Since Go defaults unset booleans to `false`, the reverse proxy domain gets pushed as a **search domain suffix** to all connected peers. This causes short hostname resolution to break: a query for `myserver` gets expanded to `myserver.app.example.com` (the reverse proxy domain) and matched there — before the peer's local DNS search domains (e.g. pushed via DHCP) are tried. If a real DNS record exists under the reverse proxy domain with that name, it silently resolves to the wrong host. The bug is hard to diagnose because it appears and disappears dynamically as reverse proxy services are toggled on/off. Verified on macOS via `scutil --dns` — the reverse proxy domain appears at order `102801` (same range as Magic DNS `nb.cloud` at `102800`), meaning it goes through a different, higher-priority path than nameserver groups (`103xxx`) and bypasses any user-controlled search domain toggle. ## Fix Set `SearchDomainDisabled: true` in the `CustomZone` created by `SynthesizePrivateServiceZones`, so the zone is registered only as a supplemental resolver (explicit `*.app.example.com` queries go through NetBird DNS) — but not as a search domain suffix appended to unqualified hostnames. This is consistent with the `NonAuthoritative: true` already set on the same zone. ```go zone = &nbdns.CustomZone{ Domain: dns.Fqdn(serviceDomainZone), Records: []nbdns.SimpleRecord{}, NonAuthoritative: true, SearchDomainDisabled: true, // ← added } ``` ## Verification Tested on a self-hosted NetBird stack with the patched binary (macOS peer, reverse proxy service active throughout): **Before:** ``` resolver #1 search domain[0] : nb.cloud search domain[1] : app.example.com ← injected, breaks local resolution search domain[2] : internal.lan ``` **After:** ``` resolver #1 search domain[0] : nb.cloud search domain[1] : internal.lan ← reverse proxy domain gone ``` Short hostname resolution now correctly falls through to local DNS search domains. Related discussion: https://github.com/netbirdio/netbird/discussions/6497 ## Documentation - [x] Documentation is **not needed** <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * DNS custom zones for private services now have the search domain feature disabled, improving zone behavior for private service lookups. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 08:06:09 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#28316