Files
public/docs/dns-naming.md
T
thesabear 12e69acde7 docs: deepen security/hardening batch to real deep-dive standard
Names real technology throughout (Vault, Authentik, pfSense,
firewalld, Wazuh) instead of staying generic, adds a 'why this
approach vs the alternative' section to every doc, cross-links
heavily between docs instead of treating each system in isolation.
2026-08-22 08:04:26 +03:00

64 lines
6.2 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
```mermaid
flowchart TD
Client["Anything on the LAN"] --> DNS["Technitium DNS"]
DNS --> ZoneA["Zone A: browser-facing"]
DNS --> ZoneB["Zone B: app-to-app"]
DNS -.unresolved.-> Forward["Forwards to the edge firewall<br/>+ a couple of public resolvers"]
ZoneA --> EdgeProxy["User-facing reverse proxy<br/>mTLS + SSO enforced"]
ZoneB --> InternalProxy["Internal reverse proxy<br/>trusted-IP allowlist, no mTLS"]
```
| 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.
> [!TIP]
> **The public exception, and why it's a real exception and not a bug**: one app in this fleet ([`docs/content-pipeline.md`](content-pipeline.md)'s social-publishing tool) is genuinely meant to be reached from the open internet, and its own frontend/backend URLs are baked in at configuration time to one specific public hostname. It has **zero presence in either internal zone** — 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, and the app itself would reject requests arriving under any other hostname anyway (CORS). 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.
## 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/)