Every host runs node_exporter, cAdvisor (now against Podman), Alloy and the security-metrics script, on its private address. Each service declares its own expected ports, users and privileged containers next to its definition, so the security baseline follows the config instead of a separate inventory list. On ops: Prometheus, Loki, Grafana, the blackbox prober and the Postgres exporter, with the same scrape jobs, probes, retention, dashboards and 33 alert rules. Two rules matched container-era names and now match the native ones: Forgejo's log is unit forgejo.service, Grafana's route is grafana@file. Grafana keeps its default secret_key on production, because its database was written with it; rotating it is a separate step. Prometheus, Grafana and Alloy come from nixos-unstable: their data is from newer versions than 26.05 ships. LLMNR and mDNS are off: the baseline flagged them as public listeners. Tried on the rehearsal pair: all 28 scrape targets up, logs from both hosts in Loki, Grafana WireGuard-only, no unexpected port, user or container on either host. Assisted-by: Claude:opus-5-5
69 lines
2.1 KiB
Nix
69 lines
2.1 KiB
Nix
# asxpio-ops on a throwaway server: the same system with its own keys,
|
|
# its own addresses and SSH open to the world. Pairs with ./services.nix
|
|
# on a private network with the production addresses (10.10.0.10/.20).
|
|
{ lib, ... }:
|
|
{
|
|
networking.hostName = "rehearsal-ops";
|
|
sops.defaultSopsFile = ../../secrets/rehearsal-ops.yaml;
|
|
asxpio.sshFrom = [ "*" ];
|
|
|
|
# Same script and schedule, into repositories on its own disk
|
|
asxpio.backup.repositories = lib.mkForce {
|
|
hel1 = "/var/backups/test-repo-hel1";
|
|
fsn1 = "/var/backups/test-repo-fsn1";
|
|
};
|
|
systemd.network.networks."10-public".address = lib.mkForce [ "2a01:4f9:c015:f949::1/64" ];
|
|
|
|
# A restored copy of production must not mail anyone, sync mirrors or
|
|
# call webhooks
|
|
services.forgejo.settings = {
|
|
mailer.ENABLED = false;
|
|
service.ENABLE_NOTIFY_MAIL = lib.mkForce false;
|
|
mirror.ENABLED = false;
|
|
webhook.ALLOWED_HOST_LIST = "loopback";
|
|
"cron.update_mirrors".ENABLED = false;
|
|
};
|
|
|
|
# The names point at production, so no challenge can succeed here:
|
|
# ask the staging CA, and expect Traefik's self-signed certificate
|
|
asxpio.letsencryptCA = "https://acme-staging-v02.api.letsencrypt.org/directory";
|
|
|
|
# No alert mail from a test pair
|
|
asxpio.alertEmail = "nobody@example.invalid";
|
|
services.grafana.settings.smtp.enabled = lib.mkForce false;
|
|
services.loki.configuration = {
|
|
# No Object Storage keys here: everything on local disk
|
|
schema_config.configs = lib.mkForce [
|
|
{
|
|
from = "2026-11-01";
|
|
store = "tsdb";
|
|
object_store = "filesystem";
|
|
schema = "v13";
|
|
index = {
|
|
prefix = "index_";
|
|
period = "24h";
|
|
};
|
|
}
|
|
];
|
|
compactor.delete_request_store = lib.mkForce "filesystem";
|
|
};
|
|
|
|
asxpio.wireguard.peers = [
|
|
{
|
|
name = "asxpio-services";
|
|
publicKey = "DwCNEfzgV1fU2ZPwEwkxun/s8vMZYrzdp74ZDrrSTD4=";
|
|
allowedIPs = [
|
|
"10.20.0.20/32"
|
|
"fd69:69:69::20/128"
|
|
];
|
|
}
|
|
{
|
|
name = "laptop";
|
|
publicKey = "iTY+NChSd8pcm/vke8s8EqsxjwEJpBEc07PfEg1Q0zQ=";
|
|
allowedIPs = [
|
|
"10.20.0.2/32"
|
|
"fd69:69:69::2/128"
|
|
];
|
|
}
|
|
];
|
|
}
|