infra/stacks/terminal
Viktor Barzin f63f10f7fa terminal: per-Authentik-user OS-user isolation; deny unmapped users
Restores the kernel-level isolation the pre-cutover ttyd-session.sh had,
but keeps the multi-session lobby UX:

- ttyd.service gets `-H X-authentik-username` back. `tmux-attach.sh` reads
  $TTYD_USER, looks up the local part in /etc/ttyd-user-map, denies the
  connection (no fallback to wizard) if there's no mapping, otherwise
  `sudo -n -H -u <os_user> tmux …`. Each Authentik identity → its own
  Unix user → its own `/tmp/tmux-<uid>/default` socket.
- tmux-api scopes every request to the same OS user via the same header.
  Adds /whoami so the lobby HTML can preflight access and render
  "logged in as <os_user> (<authentik>)" instead of leaving the user to
  discover the deny via a reconnect loop.
- Commits /etc/ttyd-user-map and the matching /etc/sudoers.d/ttyd-users
  fragment under files/devvm/ so future operators see one canonical
  source of truth. Current mappings: vbarzin → wizard, emil.barzin → emo.

Adding a user is now: append a line to ttyd-user-map + a NOPASSWD
sudoers line + `useradd -m`. README walks through it.

No Terraform changes — this is all DevVM-side + lobby JS.
2026-05-13 19:25:55 +00:00
..
clipboard-upload feat(terminal): add clipboard paste support for text and images 2026-04-06 16:57:18 +03:00
files terminal: per-Authentik-user OS-user isolation; deny unmapped users 2026-05-13 19:25:55 +00:00
tmux-api terminal: per-Authentik-user OS-user isolation; deny unmapped users 2026-05-13 19:25:55 +00:00
backend.tf Woodpecker CI deploy [CI SKIP] 2026-05-13 15:25:01 +00:00
main.tf terminal: cut over to multi-session lobby on terminal.viktorbarzin.me 2026-05-13 16:34:36 +00:00
providers.tf Woodpecker CI deploy [CI SKIP] 2026-05-13 15:25:01 +00:00
secrets Add broker-sync Terraform stack (#7) 2026-04-17 21:17:45 +01:00
terragrunt.hcl Add terminal stack - reverse proxy to ttyd behind authentik 2026-03-10 23:46:01 +00:00