Skip to content

Upterm sharing: host key preflight + proxy session#3

Merged
cgraf78 merged 1 commit intomainfrom
argus/fix-upterm-known-hosts-reauth
Mar 27, 2026
Merged

Upterm sharing: host key preflight + proxy session#3
cgraf78 merged 1 commit intomainfrom
argus/fix-upterm-known-hosts-reauth

Conversation

@argusbot78
Copy link
Copy Markdown
Collaborator

@argusbot78 argusbot78 commented Mar 26, 2026

Summary

Two improvements to ds --share (upterm backend).

1. Pre-flight uptermd host key check

Upterm is launched fully detached (</dev/null), so any SSH host-key prompt hangs forever with no way to respond. This PR adds a preflight check before detaching, while a TTY is still available.

  • Uses ssh-keyscan + fingerprint comparison (handles @cert-authority trust model)
  • On mismatch: shows current vs stored fingerprint, prompts [y/N] to auto-update known-hosts
  • On y: strips old entries for the host:port and appends freshly scanned keys with @cert-authority prefix
  • On n: aborts with a helpful hint

2. Proxy session — clients no longer mirror into your real session

Previously, --force-command attached connecting clients directly into the shared tmux session. This caused the client's terminal size to resize the session pane (smallest-client-wins in tmux).

Now a dedicated proxy tmux session (default: _share) is created at share time. Clients land there instead. They can interact with real sessions non-destructively via:

tmux capture-pane -t <session> -p      # read without attaching
tmux send-keys -t <session> "..." Enter # write keystrokes

The proxy session is created on --share and destroyed on --unshare. A bash -l fallback is included if the proxy session is killed externally.

New config option: proxy-session / DS_UPTERM_PROXY_SESSION (default: _share).

Changes

  • Pre-flight host key check with interactive re-auth prompt
  • @cert-authority prefix support in known-hosts auto-update
  • Proxy tmux session (_share) — clients connect here instead of real session
  • bash -l fallback in --force-command if proxy session is unavailable
  • Proxy session cleanup in _share_stop
  • README: proxy-session config option + proxy behavior documented

Testing

  • Verified end-to-end: ds --share on macOS, connected via upterm, landed in _share proxy session
  • Confirmed capture-pane and send-keys work against real sessions without resolution change
  • Verified ds --unshare cleans up proxy session
  • Reviewed known-hosts fingerprint logic for both port-22 and non-22 formats

@argusbot78 argusbot78 changed the title Pre-flight uptermd host key check before detaching Upterm sharing improvements: host key preflight + proxy session Mar 27, 2026
@argusbot78 argusbot78 force-pushed the argus/fix-upterm-known-hosts-reauth branch from 0952350 to 9e2dfe6 Compare March 27, 2026 00:36
@argusbot78 argusbot78 changed the title Upterm sharing improvements: host key preflight + proxy session Upterm sharing: host key preflight + proxy session Mar 27, 2026
## Pre-flight uptermd host key check

Upterm is launched fully detached (</dev/null), so any SSH host-key
prompt hangs forever with no way to respond. Add a preflight check
before detaching, while a TTY is still available.

- Uses ssh-keyscan + fingerprint comparison (handles @cert-authority
  trust model correctly)
- On mismatch: shows current vs stored fingerprint, prompts [y/N] to
  auto-update known-hosts
- On y: strips old entries for the host:port and appends freshly
  scanned keys with @cert-authority prefix
- On n: aborts with a helpful hint

## Proxy session — clients no longer mirror into your real session

Previously --force-command attached connecting clients directly into
the shared tmux session, causing the client terminal size to resize
the session pane (smallest-client-wins in tmux).

Now a dedicated proxy tmux session (default: _share) is created at
share time. Clients land there instead and can interact with real
sessions non-destructively via:
  tmux capture-pane -t <session> -p   # read without attaching
  tmux send-keys -t <session> '...' Enter  # write keystrokes

The proxy session is created on --share and destroyed on --unshare.
A bash -l fallback is included if the proxy session is killed externally.

New config option: proxy-session / DS_UPTERM_PROXY_SESSION (default: _share).

README updated to document the new config option and proxy behavior.
@argusbot78 argusbot78 force-pushed the argus/fix-upterm-known-hosts-reauth branch from 9e2dfe6 to 8e745ac Compare March 27, 2026 00:39
@cgraf78 cgraf78 merged commit 5246e38 into main Mar 27, 2026
3 checks passed
@cgraf78 cgraf78 deleted the argus/fix-upterm-known-hosts-reauth branch March 27, 2026 00:40
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.

2 participants