Live-verified against the real Technitium server: spot-checked caddy-only/local-only hosts and Postiz's zero-presence claim via direct DNS resolution, confirmed the forwarder list directly from the real dns.config (pfSense + Quad9 only, no Cloudflare), and confirmed the reverse zone's real /24 scope plus its sparse PTR content via live reverse lookups - fixed the KB stamp accordingly after an earlier version of it claimed these weren't re-checked. Replaced the mermaid zone-routing diagram with a real branch-shaped Nextcloud diagram. Real command output embedded throughout instead of paraphrased claims.
79 lines
8.6 KiB
Markdown
79 lines
8.6 KiB
Markdown
# 🌐 DNS Naming Model
|
|
|
|
> [!NOTE]
|
|
> DNS isn't just naming in this fleet — it's the mechanism that decides which trust boundary a request enters. Which zone a hostname resolves in determines whether a request gets mutual-TLS-and-SSO treatment, a lighter-weight trusted-IP path, or the public internet-facing edge entirely. Get the DNS answer wrong and you've effectively picked the wrong security posture for that request.
|
|
|
|
| | |
|
|
|---|---|
|
|
| **Server** | Technitium DNS Server — self-hosted, open-source, chosen over a managed/cloud DNS provider specifically so internal zone data never leaves the LAN |
|
|
| **Zones** | Two internal zones, deliberately never merged, plus one public exception |
|
|
| **Enforcement** | Every host's resolver is pointed at this server only — direct outbound DNS to anywhere else is blocked at the firewall |
|
|
| **Depends on** | Nothing upstream for internal resolution — it's the root of trust for internal naming |
|
|
| **Depended on by** | Every system in this repo that resolves a hostname — which is effectively all of them |
|
|
|
|
## Why self-hosted DNS at all
|
|
|
|
A homelab this size could get away with a shared hosts file or a single flat zone. Two things specifically ruled that out:
|
|
|
|
1. **The two-zone trust model needs a real answer to "which front door am I behind."** Splitting traffic into a mutual-TLS-enforced browser zone and a lighter trusted-IP internal zone (see [`docs/firewall-and-network.md`](firewall-and-network.md)) only works if something authoritative decides, per-hostname, which zone a request lands in. A hosts file can't do that at scale across a dozen-plus hosts; a real DNS server with two real zones can.
|
|
2. **Every other system needs one source of truth for internal names.** The secrets platform issues a certificate to the DNS server's own admin interface (see below); the orchestration engine resolves every fleet host by name before it can SSH anywhere; the observability pipeline ships DNS query logs as their own dedicated stream. Hand-rolling internal name resolution per-app would mean N inconsistent answers instead of one.
|
|
|
|
## The two zones
|
|
|
|

|
|
|
|
| Zone | Resolves to | Enforcement | Used by |
|
|
|---|---|---|---|
|
|
| Browser-facing | The user-facing reverse proxy | Mutual TLS (client cert required) + SSO | Anything a human opens in a browser |
|
|
| App-to-app | The internal reverse proxy | Trusted-IP allowlist bypass, or SSO forward-auth for anything not on that allowlist | Webhooks, API integrations, service-to-service calls |
|
|
|
|
Most apps that need both human and machine access get **one hostname per zone** — same app, two different front doors, chosen by which zone the caller resolves it in. Not every app needs both: a purely internal API integration might only ever get the app-to-app hostname; an app nobody automates against might only get the browser-facing one. The two zones aren't kept in lockstep by policy — a periodic audit is what actually catches when they drift, not an assumption that they match. As of the last audit, the app-to-app zone actually runs slightly ahead — 58 records versus 56 — with three apps present only there and one present only on the browser-facing side, real drift a policy alone wouldn't have caught:
|
|
|
|
```
|
|
$ python3 -c "import socket; print(socket.gethostbyname('joplin.caddy.thesabear.net'))"
|
|
[rocky-docker's IP]
|
|
$ python3 -c "import socket; print(socket.gethostbyname('joplin.local.thesabear.net'))"
|
|
socket.gaierror: [Errno -2] Name or service not known
|
|
```
|
|
|
|
Same result for `loki` and `wazuh-indexer` (caddy-zone only), and the reverse for `calibre` (browser-facing zone only).
|
|
|
|
> [!TIP]
|
|
> **The public exception, and why it's a real exception and not a bug**: a social-media scheduling tool in this fleet is genuinely meant to be reached from the open internet, routed through the edge firewall's own public reverse-proxy layer (see [`docs/firewall-and-network.md`](firewall-and-network.md)). It has **zero presence in either internal zone** — confirmed live, `NXDOMAIN` on both — not because it was forgotten, but because a third DNS entry pointing at an app that already has its own public-facing edge route would just be redundant. Apps meant for the public internet skip the internal model entirely rather than being forced into it.
|
|
|
|
## DNS as an enforced boundary, not just a convenience
|
|
|
|
> [!IMPORTANT]
|
|
> Every host on the LAN has its resolver pointed at this one internal DNS server — and that's enforced, not just configured. Direct outbound DNS queries to anywhere else (a public resolver, another host acting as its own resolver) are blocked at the firewall level, covered in [`docs/firewall-and-network.md`](firewall-and-network.md). This closes a real bypass: without it, any host could sidestep the internal zones entirely by just asking a public resolver instead, which would quietly undermine the whole two-zone trust model above. DNS enforcement is what makes the rest of this architecture actually load-bearing instead of advisory.
|
|
|
|
## Two things live-checking found the documentation had wrong
|
|
|
|
Trusting the KB without re-checking it against the running server would have kept both of these wrong indefinitely — so both got checked directly against the real config and the real zone data, not taken on the KB's word:
|
|
|
|
- **A reverse zone that wasn't scoped the way it was documented.** It was described as covering just the observability host's own subnet slice. The zone's own name on the real server settles that on its own — it's the reverse zone for the entire `/24`, not a narrower delegation, which only a different naming pattern could express. Reverse-lookups spot-checked across 7 IPs in that range came back with only 2 real PTR records — and the observability host's own IP wasn't one of them, despite the zone supposedly being scoped around it. That's stale leftovers from an earlier setup, not a deliberate monitoring-scoped zone, and the documentation had simply never been re-checked against what the server was actually doing.
|
|
- **A forwarder that was documented but never actually configured.** Technitium's upstream forwarding was written up as including a well-known public DNS-over-HTTPS provider. Reading the real config directly shows exactly two forwarders: the edge firewall and one other public resolver — the documented provider's IP and name appear nowhere in the file. It looks like it was documented as a plan and never actually implemented, then never revisited to catch the mismatch.
|
|
|
|
```
|
|
$ strings /etc/dns/dns.config | grep -E '^\d+\.\d+\.\d+\.\d+$'
|
|
[pfSense's IP]
|
|
9.9.9.9
|
|
```
|
|
|
|
Neither is a security problem — the reverse zone being broader than described doesn't leak anything, and the missing forwarder just means one less redundant upstream. What they have in common is more useful than either fact alone: documentation describing what a system does isn't the same as verifying it, and the gap between the two doesn't announce itself until something actually goes and checks.
|
|
|
|
## Where DNS shows up in every other system
|
|
|
|
DNS isn't a standalone concern in this fleet — it's a dependency almost everything else sits on top of:
|
|
|
|
| System | How it depends on DNS |
|
|
|---|---|
|
|
| [Secrets & PKI](secrets-and-pki.md) | The secrets platform issues the DNS server's own admin-UI certificate; separately, every Vault Agent across the fleet has to resolve its target before it can even open a connection |
|
|
| [SSO & Identity](sso-and-identity.md) | The OIDC redirect dance depends on the identity provider's hostname resolving correctly on the internal zone, even when the app being logged into lives on the browser-facing one |
|
|
| [Firewall & Network Segmentation](firewall-and-network.md) | DNS-bypass prevention (above) is enforced as an explicit firewall rule, not a DNS-server-side restriction |
|
|
| [Observability](observability.md) | DNS query logs are their own dedicated ingestion pipeline into the log aggregator, kept separate from general system/container logs |
|
|
| [Orchestration](orchestration.md) | Every scheduled maintenance flow resolves its target hosts by name before it can reach them over SSH |
|
|
| [Architecture Overview](architecture-overview.md) | DNS resolution is explicitly the mechanism that determines which of the fleet's routing/trust planes a given request enters |
|
|
|
|
---
|
|
Related stacks: [`stacks/platform/caddy/`](../stacks/platform/caddy/), [`stacks/platform/caddy-internal/`](../stacks/platform/caddy-internal/)
|