engram-boot/secrets/README.md

47 lines
1.4 KiB
Markdown

# secrets
One encrypted bundle with everything a fresh machine needs to get online:
the SSH keys and the GPG export. It is locked with
[age](https://age-encryption.org/) and a passphrase - that passphrase is the
master key to all of it, so keep it outside this repo.
## What goes in
- `ssh/nevim42-desktop`, `ssh/nevim42-mikoshi`, ... - SSH private keys named
after machines (+ their `.pub`; `nevim42-mikoshi.pub` is registered as a
read-only deploy key on the engram repo)
- `ssh/known_hosts.gitea` - pinned gitea host key, no TOFU on first connect
- `gpg/nevim42.asc` - armored export of the GPG secret key
The bundle mirrors the `staging/` structure: the folders and markers are
tracked in git, the actual key material never is.
## Build (or update) the bundle
`staging/` is the local workbench - gitignored except for the structure.
Fill it first:
```shell
cp ~/.ssh/<desktop-key> staging/ssh/nevim42-desktop
cp ~/.ssh/<desktop-key>.pub staging/ssh/nevim42-desktop.pub
ssh-keyscan -t ed25519 gitea.nevim42.cz > staging/ssh/known_hosts.gitea
gpg --output staging/gpg/nevim42.asc --armor --export-options backup \
--export-secret-keys nevim42@gmail.com
```
Then pack it - `age` will ask for the passphrase:
```shell
cd staging
tar czf - . | age -p -a > ../secrets.age
```
Commit `secrets.age` after any change.
## Unlock
Normally `bootstrap.sh` does this, but by hand:
```shell
age -d secrets.age | tar xz -C /some/where
```