Add sessions-ctl keygen to create prod's key on the dev box

keygen generates an ed25519 pair in RAM, writes the public half to
config.toml and authorized_keys (replacing the previous sessions-manager
line) and prints the web app's environment - dev host, port, user, pinned
host key and the private key as one base64 line - then deletes the private
key, so the pasted copy is the only one. Refuses to replace an existing key
without --rotate. Local only, never reachable over SSH.

Also make load_config() read CONFIG_PATH at call time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KKYfRST9cTJYae3f7Jf3ac
This commit is contained in:
agent 2026-09-30 14:39:56 +00:00
parent 08636ddc25
commit ca66db3aeb
4 changed files with 165 additions and 7 deletions

View file

@ -21,5 +21,10 @@ sessions = "ssh://git@git.reudy.net:14922/reudy-net/sessions.git"
# prod's key may only connect from the address(es) this name resolves to.
# Re-resolved hourly by sessions-access-refresh.timer.
allow_from_host = "reudy.net"
# The public half of the key the web app container uses.
public_key = "ssh-ed25519 AAAA… comment"
# The public half of the key the web app container uses. Written by
# `sessions-ctl keygen`; you don't need to edit it by hand.
# public_key = "ssh-ed25519 AAAA… sessions-web"
# Printed by keygen as SESSIONS_DEV_HOST / SESSIONS_DEV_PORT. By default it's
# the address this box uses to reach the internet, and 14922.
# advertise_host = "2.28.100.223"
# port = 14922