Files
NixOsConfig/secrets/README.md
T
Claude 9407c0e453 Harden secret recipes, document Serena/REA caveats, overwrite stale home-manager backups
The Telegram secret recipes no longer depend on openssl (the host does not
install it): they read 16 bytes from /dev/urandom with od and check the
length before anything is encrypted, so a failure cannot store an empty
secret. README, secrets/README.md and the proxy-suite header and warning
agree.

README: Serena's dashboard is started but not opened and listens on
127.0.0.1 only; the nix-ld note for REA now distinguishes standalone npm
executables from .node add-ons; the Serena pin notes mention the
stdenv.isLinux/isDarwin warnings.

home-manager.overwriteBackup = true so a rewritten gtk.css or qt6ct.conf
does not make a later switch fail on an existing .hm-backup.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JZ16yf4acmaSiHq81vyQ6Z
2026-10-13 01:43:30 +00:00

64 lines
3.3 KiB
Markdown

# secrets
Encrypted with [agenix](https://github.com/ryantm/agenix). Nothing here is
required: a secret is only used when its `.age` file exists.
| File | Purpose |
| ----------------------- | -------------------------------------------------------------- |
| `faumaray-password.age` | Hashed login password (`mkpasswd -m yescrypt`) |
| `ssh-id_ed25519.age` | Private SSH key for the user |
| `ssh-id_ed25519.pub` | Matching public key, plaintext (optional) |
1. Replace the placeholder public keys in `secrets.nix` (host key and your own).
2. `cd secrets && agenix -e faumaray-password.age`
3. `git add` the new `.age` files: flakes only see tracked files.
Decryption on the machine uses `/etc/ssh/ssh_host_ed25519_key`.
## Service secrets
Two more optional secrets belong to services. Without them the service is
switched off, and the build prints a warning that names the missing file.
| File | Content | Used by | Without the file |
| ------------------------ | --------------------------------------- | ------------------------------------------------ | ------------------------------------------ |
| `gitea-runner-token.age` | One line `TOKEN=<registration token>` | `modules/dev/gitea-runner.nix` (`tokenFile`) | The runner "performance" is not configured |
| `tg-ws-proxy-secret.age` | The hex secret (32 hex digits) | `modules/network/proxy-suite.nix` (`secretFile`) | `services.proxy-suite.tgWsProxy` stays off |
Both are decrypted to `/run/agenix/<name>` (root, mode `0400`) and read by the
service units. No `.nix` file contains a secret value.
Create them from the repository root (`-i` checks that your key can decrypt the
result; `secret-from-file` also runs `git add` on the new file). The values go
through a pipe, so they never touch the disk or a command line:
```sh
# Registration token: Gitea -> Site Administration -> Actions -> Runners.
printf 'Registration token: '; read -rs t; echo
printf 'TOKEN=%s\n' "$t" | nix run .#secret-from-file -- gitea-runner-token.age - -i ~/.ssh/id_ed25519
unset t
# Telegram proxy secret: a fresh random value.
s=$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n') && [ "${#s}" -eq 32 ] && echo "$s" >&2 \
&& printf '%s\n' "$s" | nix run .#secret-from-file -- tg-ws-proxy-secret.age - -i ~/.ssh/id_ed25519
unset s
```
The second command also prints the secret once, because the Telegram clients
need it. Then switch (`nix run .#switch`).
### Rotation
Earlier versions of this repository (up to commit `030e97e`) kept the runner
token and the Telegram proxy secret as plaintext in the networking
configuration; both are still in the git history. Treat them as leaked: create
a new registration token in Gitea (and remove the old runner there), generate a
new Telegram secret, and store the new values with the commands above. To
replace an existing file later, add `--force`:
```sh
s=$(od -An -N16 -tx1 /dev/urandom | tr -d ' \n') && [ "${#s}" -eq 32 ] \
&& printf '%s\n' "$s" | nix run .#secret-from-file -- tg-ws-proxy-secret.age - --force -i ~/.ssh/id_ed25519
unset s
```