added manual secrets

This commit is contained in:
ari committed 2026-06-26 16:07:47 -04:00
1 parent 672657c111
commit d9cacefa0f
34 files changed
+1428 -10

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
# modules/nixos/server/dns/
Local DNS and certificate infrastructure for the `*.lab.internal` / `*.internal` homelab.
`default.nix` imports the three independent submodules below.
## Structure
```
dns/
├── default.nix # imports routing/ + certbot/ + local-ca/
├── routing/ # skyg.server.dns.routing — dnsmasq resolver + static A records
├── certbot/ # skyg.server.dns.certbot — Let's Encrypt via certbot + nginx
└── local-ca/ # skyg.server.dns.local-ca — internal certificate authority scaffolding
```
## Notable details
- **`routing/`** runs dnsmasq, generating exact + wildcard `address=` entries from
`addresses`, forwarding the rest to `upstreamServers` (default 1.1.1.1/1.0.0.1). It can
also pull additional `address=` lines from an **agenix secret** named via
`addressesSecretName` (decrypted into a `conf-file`).
- **`certbot/`** wires up daily `certbot renew --nginx`, with a `testMode` dry-run option and
a `certbot-get-certs` shell alias built from `publicDomains` + `email`.
- **`local-ca/`** sets up the directory/structure for an internal CA; the actual key/cert
generation is currently scaffolded (commented openssl steps) rather than fully implemented.
## Option Namespace
```
skyg.server.dns.routing.{enable,addresses,addressesSecretName,upstreamServers,listenAddresses,openFirewall}
skyg.server.dns.certbot.{enable,publicDomains,email,testMode}
skyg.server.dns.local-ca.{enable,caCert,caKey,domain,organization,...}
```
## Conventions
- The three submodules are independent; enable only what a host needs.
- DNS records that must stay private should live in the agenix secret referenced by
`addressesSecretName`, not in plaintext `addresses`.
@@ -0,0 +1,33 @@
# modules/nixos/server/dns/certbot/
Let's Encrypt certificate management via **certbot** + the nginx plugin, for public-facing
domains.
## Files
```
certbot/
└── default.nix # skyg.server.dns.certbot.*
```
## Behaviour
- Installs `certbot` + `certbot-nginx` and enables nginx.
- Sets up a `certbot-renew` systemd service + daily timer (uses `renew --dry-run` when
`testMode = true`).
- Provides a `certbot-get-certs` shell alias that runs a non-interactive
`certonly --nginx` for every domain in `publicDomains`, registered with `email`.
## Option Namespace
```
skyg.server.dns.certbot.enable
skyg.server.dns.certbot.publicDomains # list of domains
skyg.server.dns.certbot.email # ACME account email
skyg.server.dns.certbot.testMode # dry-run renewals
```
## Conventions
- Initial issuance is manual (run `certbot-get-certs`); renewal is automated by the timer.
- For internal-only domains use the `local-ca` sibling module instead of Let's Encrypt.
@@ -0,0 +1,30 @@
# modules/nixos/server/dns/local-ca/
Scaffolding for an internal Certificate Authority used to issue certs for private
`*.internal` domains that should not go through Let's Encrypt.
## Files
```
local-ca/
└── default.nix # skyg.server.dns.local-ca.*
```
## Status & behaviour
- Creates `/etc/ssl/local-ca` and a `local-ca-setup` oneshot service.
- **The actual CA key/cert generation is currently scaffolded** — the openssl invocation in
`local-ca-setup` is commented out, and the `ca-certificates.crt` entry is a placeholder.
Treat this module as a structural stub to build on, not a working CA yet.
## Option Namespace
```
skyg.server.dns.local-ca.enable
skyg.server.dns.local-ca.{caCert,caKey,domain,organizationalUnit,organization,country,email,certificateLifetime}
```
## Conventions
- If you implement real key generation here, do **not** commit private keys; persist them
outside the Nix store and reference them by path (or manage with agenix).
@@ -0,0 +1,39 @@
# modules/nixos/server/dns/routing/
Local DNS resolver backed by **dnsmasq**. Serves static domain→IP mappings for the homelab
and forwards everything else upstream.
## Files
```
routing/
└── default.nix # skyg.server.dns.routing.*
```
## Behaviour
- Each `addresses` entry `{ domain, ip }` produces **both** an exact (`/domain/ip`) and a
wildcard (`/.domain/ip`) dnsmasq `address=` line.
- `addressesSecretName` points at an agenix secret (`secrets/<name>.age`) whose decrypted
contents are a dnsmasq fragment, included via `conf-file` — used for records that should
not live in the public repo.
- `upstreamServers` (default `1.1.1.1`, `1.0.0.1`) handle unresolved queries.
- `listenAddresses` (empty = all interfaces) and `openFirewall` (port 53 UDP/TCP) control
exposure.
## Option Namespace
```
skyg.server.dns.routing.enable
skyg.server.dns.routing.addresses # [{ domain, ip }]
skyg.server.dns.routing.addressesSecretName # agenix secret name, or null
skyg.server.dns.routing.upstreamServers
skyg.server.dns.routing.listenAddresses
skyg.server.dns.routing.openFirewall
```
## Conventions
- Put private/sensitive records in the agenix secret, not in `addresses`.
- The `age.secrets` reference resolves relative to the repo `secrets/` directory — manage
that file with `skyg secrets`, never by hand.