Skip to content

Support passphrase-protected keys for background SSH tunnels on Unix - #10

Merged
mirivlad merged 23 commits into
mainfrom
fix/background-passphrase-tunnels
Nov 11, 2026
Merged

mirivlad merged 23 commits into
mainfrom
fix/background-passphrase-tunnels

Conversation

@mirivlad

@mirivlad mirivlad commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Problem

Background tunnel launch rejects key_passphrase profiles, including the local Portainer forwarding scenario (127.0.0.1:9443 → 127.0.0.1:9443).

Changes

  • Allow key_passphrase in CLI, dashboard actions, and forwards screen on Linux/macOS.
  • Unlock the configured identity via the existing vault; load it into an isolated OpenSSH agent via its private Unix socket.
  • Start detached SSH in batch mode with no passphrase in process arguments, environment variables or plaintext files.
  • Track SSH agent PID/directory alongside each tunnel; remove on stop, stop-all, stale-state pruning. Validate agent directory before cleanup.
  • Lazily unlock the vault only for encrypted-key backgrounds; preserve no-prompt behavior for ordinary key/agent background tunnels.
  • Continue rejecting password-based detached auth and keep the Windows limitation explicit.
  • Update help and guide, and add CLI/TUI regressions and encrypted Ed25519 agent tests.

Verification

  • CI tests: Linux/macOS/Windows and cross-builds (see checks).
  • Linux with a real SSH server, passphrase-protected key, Portainer port, stop/restart sequence remains to be manually smoke-tested.
  • Current background launcher reports process creation, not verified end-to-end SSH readiness; that pre-existing behavior is unchanged.

Do not merge/release until checks and real SSH smoke test are complete.

@mirivlad
mirivlad merged commit 1b64261 into main Nov 11, 2026
4 checks passed
mirivlad added a commit that referenced this pull request Nov 15, 2026
…#10)

* feat(tunnel): add isolated agent for encrypted-key background tunnels

* feat(tunnel): add isolated agent for encrypted-key background tunnels

* feat(tunnel): manage encrypted-key agent lifecycle alongside SSH tunnels

* feat(model): track isolated SSH agent owned by background tunnel

* feat(tunnel): permit key+passphrase background starts in CLI and TUI

* feat(tunnel): permit key+passphrase background starts in CLI and TUI

* feat(tunnel): permit key+passphrase background starts in CLI and TUI

* fix(tui): enable encrypted-key background action on Unix and explain limitations

* fix(tui): enable encrypted-key background action on Unix and explain limitations

* test(tunnel): cover encrypted-key background tunnel availability and vault unlock

* test(tunnel): cover encrypted-key background tunnel availability and vault unlock

* test(tunnel): cover encrypted-key background tunnel availability and vault unlock

* test(tunnel): verify encrypted Ed25519 unlock in isolated ssh-agent

* docs: describe safe background tunnels for passphrase-protected SSH keys

* style: gofmt imports and regression test spacing

* style: gofmt imports and regression test spacing

* style: gofmt imports and regression test spacing

* fix(tunnel): unlock vault lazily only for encrypted-key background profiles

* fix(tunnel): unlock vault lazily only for encrypted-key background profiles

* fix(tunnel): unlock vault lazily only for encrypted-key background profiles

* security(tunnel): constrain stale agent cleanup to private temp dirs

* test(tunnel): exercise encrypted-key SSH forwarding end-to-end with local SSH server

* style: gofmt integration-test field alignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant