Repository navigation
ssh: host editor and keychain passwords - #2
Conversation
…lias A RedShell host whose name matches an alias from ~/.ssh/config now runs `ssh <alias>` with the fields set in RedShell passed on top (-p, -l, -o HostName=), so the alias keeps its IdentityFile, ProxyJump and other options. Hosts only listed in ~/.ssh/config still pass nothing.
The sidebar's "+" and empty-state hint, and the new Add SSH Host and Edit SSH Host commands, open a host editor with every [[ssh.hosts]] field, inline errors, Delete, Save and Save & Connect. ssh_hosts is the one place hosts are checked, saved, renamed and deleted. A host only in ~/.ssh/config is saved as an entry of the same name holding just the fields the user changed; one that overrides an alias can be reset to the file.
…o connect, edit, duplicate or delete
RedShell will be the program ssh runs for passwords, passphrases and host key confirmations (SSH_ASKPASS with SSH_ASKPASS_REQUIRE=force). This adds the wire protocol between the helper and the app, the helper client, the classification of real OpenSSH prompt texts and parsing of ssh -V to tell clients that honour SSH_ASKPASS_REQUIRE (8.4+) from older ones.
SshProfile carries an optional askpass broker. Batch runs (listings, kills, uploads) get its environment in background mode and replace BatchMode with NumberOfPasswordPrompts=1; without a stored password they also turn password logins off, and they never try keyboard-interactive, so polling never shows a server an empty password. How a run ended goes back to the broker, so a stored password the host refused is not sent again. The tmux control attach is user-initiated and asks interactively, with time for the user to answer. Without askpass, or with ssh older than 8.4, every command is as before.
A SecretStore over keyring-core with the native stores (Windows Credential Manager, the macOS keychain, the Secret Service through zbus), opened on first use; without a keychain nothing is remembered. Secrets reads through a cache, tracks passwords a host refused, and moves or deletes a host's password when the host is renamed or deleted. An in-memory store serves the tests.
ssh started with RedShell as SSH_ASKPASS runs it as a helper, which main now handles before anything else starts. The helper asks the broker, a loopback listener that issues a 128-bit token per ssh process naming the host it was pointed at and whether the user may be asked. A pure Policy decides: a stored password goes only to a prompt naming that user and host (never to a ProxyJump hop), a passphrase to a prompt naming its key, each at most once per process; a repeat means it was refused and marks it stale. Background tokens never ask; interactive ones send the question to the UI as an AskpassEvent with a responder and a remember flag, and withdraw it when ssh goes away. An integration test runs the built executable from a path with spaces as the helper for ssh-keygen opening an encrypted key.
AppState owns the keychain (Secrets) and starts the broker with RedShell's own executable as the helper. SSH hosts get the broker while ssh.askpass is on, and changing the ssh settings now rebuilds them. A tab running ssh to a configured host (an SSH tab, or a tmux or screen session on one) gets the askpass environment at spawn time, so restored tabs never carry a stale token; local shells never get it. Until the dialogs exist, questions for the user are cancelled.
A keychain read can block on an unlock prompt. The policy now names the account first and decides with the secret looked up between the two steps, and the secrets cache is not held during the read, so issuing a token for a new tab on the UI thread never waits for the keychain.
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
| cx.spawn(async move |_| { | ||
| while let Some(event) = events.next().await { | ||
| if let AskpassEvent::Request(request) = event { | ||
| request.cancel(); |
There was a problem hiding this comment.
Custom agent: Impeccable Design Review (Beta)
Suggestion: Route incoming SSH requests to a dialog that can collect or confirm an answer, reserving cancellation for an explicit user dismissal.
Severity Level: Major Ui
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** crates/redshell-app/src/main.rs
**Line:** 67:67
**Comment:**
*Ui: Route incoming SSH requests to a dialog that can collect or confirm an answer, reserving cancellation for an explicit user dismissal.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| With `askpass` on, RedShell is the program ssh asks for passwords, key passphrases and new host | ||
| keys (`SSH_ASKPASS`), so it can fill in what it remembers and ask in its own dialog instead of the | ||
| terminal. Secrets you choose to remember are kept in the operating system's keychain, never in |
There was a problem hiding this comment.
Suggestion: The app currently cancels every askpass request until dialogs exist, so SSH connections fail at password, passphrase, and host-key prompts instead of showing this dialog.
Assessment: 🟠 Major · 🔁 Occurrence: Sometimes · 🏷️ Comment mismatch
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** docs/CONFIG.md
**Line:** 205:207
**Comment:**
*Comment Mismatch: The app currently cancels every askpass request until dialogs exist, so SSH connections fail at password, passphrase, and host-key prompts instead of showing this dialog.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix| /// Saves the host, or shows what is wrong and focuses the first such field. | ||
| fn save(&mut self, connect: bool, window: &mut Window, cx: &mut Context<Self>) { | ||
| let form = self.form(cx); | ||
| match ssh_hosts::save(cx, &self.book, &self.source, &form) { |
There was a problem hiding this comment.
Suggestion: self.book is a snapshot from when this dialog opened. If another window saves the same name first, this stale check still passes and both hosts are saved under one name.
Assessment: 🟠 Major · 🔁 Occurrence: Rarely · 🏷️ Race condition
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** crates/redshell-app/src/host_editor.rs
**Line:** 172:172
**Comment:**
*Race Condition: `self.book` is a snapshot from when this dialog opened. If another window saves the same name first, this stale check still passes and both hosts are saved under one name.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fixMerge the duplicated SSH hosts paragraphs and the pre- and post-hardening notes into one guide ordered from install to resource use. Add the .deb, tarball and source installs, the per-user systemd unit, and RedShell Remote on the phone. The proxy samples drop trusted_proxies, which the server assumes for a TLS proxy on loopback, and the guide now says that a restart or package upgrade ends every session.
Turn Unreleased into 0.0.3 with a lead paragraph and an upgrading note (ssh.askpass on by default, hosts named after a ~/.ssh/config alias, the new key order in config.toml). Fixes of features new in this release fold into their Added entries, the server's hardening reads as what ships, and the stray duplicated askpass line is gone.
Split the long SSH paragraph, rewrite the RedShell Remote paragraph as connected prose, list Answer in terminal with the desktop's approval buttons, move the update check back beside the desktop installers, and refresh the project layout. The Russian summary mentions the SSH tools and the server.
The [server] table now says what public_url does (pairing links, passkeys, HSTS) and when loopback proxies are trusted, as REMOTE.md does. Document ssh.ssh_config_path and tidy two merged paragraphs.
The server section predated passkeys, pairing, re-authentication, push, the hosts API and the request guards. Pane ratios are saved with a tab's layout now, and the terminal crate depends on the theme crate.
The askpass default, alias connections and key order move into Changed as well as the upgrading note, which now says aliases need import_ssh_config. The [server] section, the hosts API, trusted loopback proxies and the pairing address check get their entries back.
Adding or removing a passkey, passkey-only on or off, approving a pairing and signing out another browser or device answer reauth_required unless the user re-authenticated in the last five minutes. The HTTP layer now asks for that in one place: it opens "Confirm it's you" (a passkey, or the password unless the account is passkey-only), and sends the change once more when the user confirmed. Closing it counts as a cancel, which the screens don't report as a failure. Adding a passkey asks first when the last re-authentication has lapsed, before the ceremony starts.
|
Skipping CodeAnt AI review — this PR changes more than 100 files, which usually means a migration, codemod, or vendored drop. Line-level review on diffs this large produces duplicate findings on the same rewrite pattern and drowns out anything that actually matters. If you still want a review, comment |
SSH hosts could only be added by editing config.toml, passwords had to be typed into the terminal on every connection, and there was no port forwarding or file browser.
~/.ssh/confighosts without touching the file. A host named after an alias connects through that alias.ssh-copy-id.