# 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=` | `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/` (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 ```