Commit Graph
67 Commits
Author SHA1 Message Date
kurogeek 95b78b4d25 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-11 16:30:30 +07:00
kurogeek 28e3c3cb95 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-11 16:17:44 +07:00
kurogeek 1f45fff740 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/omada.nix
2026-08-11 13:59:26 +07:00
kurogeek 3f5ded44af mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/iperf.nix
2026-08-11 11:25:23 +07:00
kurogeek d1b9186b40 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/iperf.nix
2026-08-11 11:19:16 +07:00
kurogeek 2a8c29d36f mob next [ci-skip] [ci skip] [skip ci]
lastFile:clan.nix
2026-08-10 17:12:48 +07:00
kurogeek fdf53873cb mob next [ci-skip] [ci skip] [skip ci]
lastFile:clan.nix
2026-08-10 16:55:43 +07:00
kurogeek e9c8891cae mob next [ci-skip] [ci skip] [skip ci]
lastFile:clan.nix
2026-08-10 15:25:10 +07:00
kurogeek 1cadef7550 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/dns-dhcp.nix
2026-08-07 18:22:19 +07:00
kurogeek c0dc72176e mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-07 17:50:15 +07:00
kurogeek aef99a7ff3 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/dns-dhcp.nix
2026-08-07 17:50:04 +07:00
kurogeek 62ac5c7912 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/firewall.nix
2026-08-07 17:37:07 +07:00
kurogeek 48d7de24c5 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-07 17:32:38 +07:00
kurogeek d85844084c mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/firewall.nix
2026-08-07 17:32:11 +07:00
kurogeek 93ef72810d mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-07 17:18:13 +07:00
kurogeek 553f9a653d mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/crowdsec.nix
2026-08-07 17:03:30 +07:00
kurogeek 578632e828 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/crowdsec.nix
2026-08-07 16:23:49 +07:00
kurogeek d9a33d6aa7 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-07 14:52:27 +07:00
kurogeek b10343c194 mob next [ci-skip] [ci skip] [skip ci]
lastFile:clan.nix
2026-08-07 14:50:25 +07:00
kurogeek 73a2f737c3 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-06 18:17:44 +07:00
kurogeek 2e8fb9f1dc mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-06 16:47:24 +07:00
kurogeek 655c6331e9 mob next [ci-skip] [ci skip] [skip ci]
lastFile:clan.nix
2026-08-06 14:42:11 +07:00
kurogeek 17f3860f9b mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-06 14:01:25 +07:00
kurogeek a97f3f82e5 mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/default.nix
2026-08-06 11:56:42 +07:00
kurogeek 81626a75db mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/flake-module.nix
2026-08-06 11:23:14 +07:00
kurogeek 1a56a2d24b mob next [ci-skip] [ci skip] [skip ci]
lastFile:modules/clan/gw-router/flake-module.nix
2026-08-05 10:21:39 +07:00
Berwn fcd8e55024 Add untagged access ports and a staging uplink for gw-cnx-1
New cnx.router.accessPorts option pins a port untagged to one VLAN via
bridge PVID/EgressUntagged; convention is the last copper port as an
always-available mgmt recovery port. gw-cnx-1 port roles: enp1s0 WAN,
enp2s0 trunk, enp3s0 temporary DHCP uplink into the old OPNsense LAN
(back to trunk at cutover), enp4s0 untagged mgmt.
2026-07-31 12:57:34 +07:00
Berwn 19e1acda51 Renumber gw-cnx-1 to the fleet addressing scheme (OPNsense replacement)
The newedge.house site adopts the 10.1.<vlanId>.0/24 convention: mgmt 10
(the old untagged LAN), lan 20, iot 40, voip 50, dmz 60, unit1-5 110-150.
PPPoE is untagged at this site. Static leases move to a new per-VLAN
dhcp.reservations option rendered into Kea host reservations.
2026-07-31 11:39:54 +07:00
Berwn f5b6b4b55e Serve newedge.house from the fleet nameservers 2026-07-31 11:39:54 +07:00
Berwn 3646d43ac5 Add CNX WAN Speed dashboard for the gateway speed tests
Per-gateway download/upload/ping from the hourly librespeed runs, with
each link's 7-day median overlaid so the WANSpeedDegraded alert
condition is visible at a glance. Label-driven — new sites appear
automatically once scraped.
2026-07-31 11:03:31 +07:00
Berwn d8d4a686eb Add gateway diagnostics: iperf3, CLI toolkit, periodic WAN speed test
iperf3 serves throughput tests from every VLAN and the mesh; an hourly
librespeed run feeds speedtest_* metrics through node_exporter's textfile
collector, and vmalert flags download rates below half the link's own
7-day median so ISP degradation surfaces without per-site thresholds.
2026-07-31 10:44:52 +07:00
Berwn b11ff75ca6 Add internal reverse proxy for gateways (Caddy, wildcard via DNS-01)
cnx.router.proxy serves <service>.<site><n>.cnx.network with a real Let's
Encrypt wildcard obtained via a gateway-scoped TSIG key against ns1; Blocky
resolves the names to the router's LAN address, so they exist only
internally. First user: Omada UI on gw-cnx-1 (omada.cnx1.cnx.network).
2026-07-31 10:09:08 +07:00
Berwn 158252323f Add site gateway role (modules/router) and gw-cnx-1
Reusable cnx.router.* module for the Topton 1U boxes replacing OPNsense:
PPPoE WAN (optionally VLAN-tagged, AIS: 10, secret credentials incl.
username), VLAN-filtering bridge, nftables NAT/firewall with MSS clamp,
Kea DHCP with per-VLAN lease time, Blocky DNS, DHCPv6-PD, CrowdSec with
the ZeroTier mesh whitelisted, optional Omada controller, ZFS disk.

Fleet baseline rides along: admins sops group is now derived for every
machine in clan.nix (secrets encrypt to it from the first vars generate)
and time sync is chrony everywhere instead of systemd-timesyncd.
2026-07-28 17:06:07 +07:00
Berwn 4bafc64b84 fix(monitoring): restore DMARC dashboard under Grafana 13
Grafana 13 externalised its core data sources; nixpkgs no longer bundles
the Elasticsearch datasource, so every DMARC panel failed with "Plugin not
registered". Load the official Grafana-signed elasticsearch plugin via
declarativePlugins, pin the dmarc-ag/dmarc-fo datasource UIDs (Grafana 11+
resolves datasource template variables by UID, not name), and clear stale
uid-less records left by an earlier deploy.
2026-06-26 11:34:08 +07:00
Berwn 48fcc3058b Upgrade clan to 26.05
Bump clan-core and nixos-mailserver to 26.05 (NixOS 26.05) and adapt to
the breaking changes surfaced by nix flake check:

- mesh-hosts/clan.nix: read the new shared, instance-scoped zerotier vars
  (zerotier-ip-<machine>-zerotier, zerotier-network-zerotier); admit
  external members via the controller's native allowedIds.
- monitoring/server.nix: Grafana lost its built-in secret_key default;
  mint one via a clan generator and pass it with $__file{}.
- dns/authoritative.nix: services.resolved.extraConfig removed -> settings.
- mail.nix: SNM cert API change (x509.useACMEHost + acme extraDomainNames)
  and accounts/dkim option renames.
- docs: mesh runbook updated for the new var paths and allowedIds.
2026-06-25 10:17:32 +07:00
Berwn 60db8c60b0 Add parsedmarc DMARC report analyzer on control
Deliver cnx.email DMARC aggregate/forensic reports to a dedicated dmarc@cnx.email
mailbox on mx1 and analyze them with parsedmarc on control, storing parsed
reports in a local loopback Elasticsearch and visualizing via the auto-provisioned
Grafana dashboard. parsedmarc fetches the mailbox over IMAPS across the mesh
(mx1.cnx.email pinned to its mesh address so TLS still validates), using a shared
mail-dmarc-cred clan var so mx1's mailserver and control see the same password.
2026-06-21 03:27:23 +07:00
Berwn 415a050f6a Scrape web01 node_exporter into VictoriaMetrics
Add web01 to the mesh map and the node scrape job so it appears on the
uptime/host dashboards alongside the other hosts.
2026-06-21 03:08:56 +07:00
Berwn 48bf7fb250 Add web01 public reverse proxy with DNS-01 wildcard TLS
web01 terminates TLS for grafana.cnx.network and proxies to Grafana on
control over the mesh. Caddy serves a *.cnx.network wildcard cert obtained
via ACME DNS-01, using a dedicated acme_web01 TSIG key scoped on ns1 to
_acme-challenge on the cnx.network zone only. Ports 80/443 are the only
public exposure (80 just redirects); admin and the backend ride ZeroTier.

Also reload Caddy on cert renewal for both web01 and mx1, since both
reference the cert via explicit tls file paths and would otherwise keep
serving a stale cert after a silent renewal.
2026-06-21 03:05:54 +07:00
Berwn f42569e992 Add provisioned Grafana uptime dashboard for all hosts 2026-06-21 01:57:08 +07:00
Berwn 1dd3aadb97 Add mail.cnx.email client alias as a cert SAN
A mail.cnx.email CNAME (-> mx1.cnx.email) lets clients (Thunderbird etc.)
use a friendly hostname for submission/IMAP. To avoid a TLS name
mismatch the cert now carries mail.cnx.email as a SAN, so the acme_mx1
key is authorized to write _acme-challenge.mail too. The MX still points
at mx1.cnx.email and --reuse-key keeps the DANE TLSA digest valid across
the re-issue.
2026-06-18 15:01:03 +07:00
Berwn dc21348727 Format drifted files to satisfy the treefmt flake-check gate
Pure formatting (nixfmt/prettier/yamlfmt); no behavior change. These
files predate the current treefmt config and were failing nix flake
check; reformatting them makes the gate green again.
2026-06-18 14:49:48 +07:00
Berwn 1cb6f39ea2 Add declarative SNM mail stack on mx1 with DNS-01, DANE, MTA-STS
mx1 runs Simple NixOS Mailserver (Postfix/Dovecot/Rspamd/OpenDKIM) for
cnx.email. The TLS cert is obtained via ACME DNS-01 using a dedicated,
scoped TSIG key (acme_mx1) that ns1 authorizes for only
_acme-challenge.mx1 and _acme-challenge.mta-sts on the cnx.email zone, so
the credential can write nothing else. Mailbox passwords are auto-minted
by a clan vars generator (four-word passphrase + number).

DANE TLSA (3 1 1) is published for _25._tcp.mx1; --reuse-key keeps the
key digest stable across renewals. MTA-STS is enforced via a Caddy vhost
serving the policy on :443 from the same cert (mta-sts SAN). Firewall
opens 25/587/465/143/993/443; 80 stays closed.
2026-06-18 14:47:20 +07:00
Berwn d1b24017aa Use no-store for docs: epoch mtimes make revalidation serve stale 2026-06-18 12:24:38 +07:00
Berwn 77a18df257 Stop browsers serving stale docs by forcing revalidation 2026-06-18 12:19:42 +07:00
Berwn 6e4178df04 Onboard mx1 mail host and factor out per-host public IPs
- Register mx1 in the inventory and as a direct-SSH `internet` host; give it
  a static public IPv6 (2a01:4ff:2f0:1963::1).
- Point the cnx.email MX (plus SPF/DMARC) at mx1 and add its A record.
- Bring mx1 into monitoring: import exporters, add it to the mesh map and the
  node scrape job so its host metrics and journald reach control.
- Add a clan-mx1 Hetzner firewall: inbound SMTP + ZeroTier + ICMP, no public
  SSH (admin rides the mesh like the other hosts). 587/465/993 held for now.
- Extract per-host public IPv4/IPv6 into modules/hosts.nix, consumed by
  clan.nix's internet hosts and each machine's cnx.staticIPv6, so each address
  is declared once instead of being duplicated across configs.
- docs: add mx1 to the machines table.
2026-06-18 11:53:14 +07:00
Berwn 9c8a2abf3f Bind VictoriaLogs on IPv6 so the mesh can ship journald to it
VictoriaLogs, like the VM scraper, is IPv4-only by default: ":9428" binds
0.0.0.0 only, so ns1/ns2 pushing journald over the IPv6 mesh got "connection
refused" while control's own loopback (v4) upload worked. Add -enableTCP6 so it
binds [::] (dual-stack), matching the flag already used for the scraper.

Also simplify the systemd-journal-upload override to just startLimitIntervalSec=0
(retry forever / self-heal) and drop the SuccessExitStatus masking: a persistent
sink failure should stay loud rather than be hidden behind a green deploy.
2026-06-17 17:27:56 +07:00
Berwn 0eb883061b Keep systemd-journal-upload retrying instead of failing a deploy
The uploader exits when VictoriaLogs is unreachable. Upstream already sets
Restart=always/RestartSec=3sec, but the default start-rate limit lets the unit
give up permanently and trip switch-to-configuration when the sink is briefly
down. Disable the limit (startLimitIntervalSec=0) so logging stays best-effort
and never wedges a host or a deploy.
2026-06-17 17:09:30 +07:00
Berwn d4a171640b Add VictoriaLogs for centralized journald across all hosts
control runs VictoriaLogs (:9428, 30d, mesh-scoped) with a matching
Grafana datasource. Each host ships journald via systemd's own
journald.upload to the /insert/journald endpoint -- no extra agent.
control uploads over loopback so its logs survive a mesh outage; ns1
and ns2 push over the mesh.
2026-06-17 16:53:52 +07:00
Berwn c7b0f206c8 Alert on and chart blackbox DNS probe failures
DNSResolutionProbeFailed and DNSSECProbeFailed fire when an SOA or
DNSKEY probe to a public nameserver address stays down for 5m. The CNX
DNS dashboard gains a "DNS probes (outside-in)" row: per-zone/server
status table, probe success, and probe latency.
2026-06-17 15:42:13 +07:00
Berwn 54f607d063 Add blackbox exporter for outside-in DNS probes
control runs blackbox_exporter on loopback, probing each nameserver's
public v4+v6 address for every zone: SOA (zone served) and DNSKEY (still
signed, since blackbox has no DO-bit option). Probe definitions are
shared between the exporter config and the VictoriaMetrics scrape jobs
so they can't drift. Verified live against ns1/ns2 over v4 and v6.
2026-06-17 15:37:45 +07:00