Repository navigation
feat(ios): add a PC over SSH from the iPhone, as the Android app does - #4450
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the
|
|
Hold: the full add-a-PC flow in the iOS Simulator (WebDriverAgent) is still to run; eamac's Xcode needs an administrator to install its CoreSimulator update first. Security review by security-triage (t13r) requested. |
…s every port's to each
…el, an SSH PC saved when set up, a broken command output is a failure
…cale login, its PCs) after the first
c34534e to
bcb4fa6
Compare
… a Tailscale check stops until Try again; review follow-ups
What
The iPhone app adds a PC over SSH, the twin of the Android app's phone SSH (#3862): the same screens, steps,
words, failure kinds, shell commands and Manage actions, and
app/web/connect.jsdrives it through the sameOvisSshplugin methods. Nothing inserver/orshared/changes.app/ios/OvisSshCore(new local Swift package, over apple/swift-nio-ssh, Apache-2.0, CryptoKit): the SSHclient (host-key check, key or one-time password sign-in, exec, direct-tcpip), the key store (
SshPcs,secrets sealed with AES-GCM under a Keychain key, this device only), pasted key parsing (OpenSSH ed25519 and
ECDSA, with a passphrase via bcrypt_pbkdf, PEM ECDSA), the loopback tunnel with Android's lifetime rules
(
SshTunnel), and the PC-side commands, byte for byte Android's.app/ios/App/App:OvisSshPlugin(add, setUp, list, phoneKey, copy, share, rename, forgetHostKey,remove), the SwiftUI setup screen (
SshSetupView),SshWords(made from Android's ssh_strings.xml en/ko),HerdrShell.openSshSetup/takeSshSetup(hosted Direct tab handoff), the failure kind and command forerror.html, foreground wake and network-change drop.Security (for t13r)
only shows the SHA-256 fingerprint); a saved key is pinned with its algorithm and any other fails closed;
only Manage → Forget host key lets a new one in.
for the port (
ovis_ssh_gate_<port>, 256 random bits, HttpOnly, SameSite=Strict, host-only); everyovis_ssh_gate_*cookie (the WebView sends all PCs' gates to each port) is stripped before the request goes on, compared in constant time. Because cookies do not separate ports, the tunnelalso refuses any request with a foreign
Originor aSec-Fetch-Siteother thansame-origin/none(another SSH PC's page is same-site). The app never opens or navigates to 127.0.0.1 at a port no SSH PC
listens on, and the tunnel refuses a redirect there.
DirectCallGatedrops everyOvisSshmessage not from themain frame of
capacitor://localhost; the plugin also refuses calls while a PC page is up.kSecAttrAccessibleAfterFirstUnlockThisDeviceOnly); a password is used once and never stored; the key itregisters is proven by signing in with it before the screen finishes.
Also in this PR (owner, 0.5.10, both apps)
nonesign-in; Tailscale's check-mode banner link(only
https://login.tailscale.com/...) is shown with Open the link during setup (10 min wait); a reconnect thatneeds a check fails with
tailscale-checkand error.html offers the link. Host key still confirmed and pinned.OvisSsh.knownreads an SSH PC's own/api/machines/ssh-candidatesand/api/machinesover its tunnel (local access); the SSH tab lists them (knownLogins) with Add, which opensthe SSH setup prefilled. Nothing connects by itself.
Differences from Android
passwordmethod only (no keyboard-interactive). No FLAG_SECURE equivalent on the setup screen.
Validation
swift testin app/ios/OvisSshCore on eamac: 62 tests pass (unit + a real user sshd fixture incl. a Tailscale-stylebanner + one against a real Tailscale SSH server, which handed over its check link).
./gradlew :app:testDebugUnitTest --tests 'sh.ovis.app.Ssh*' :app:assembleDebugon eamac: 58 pass, build OK.bun test scripts/app-shell.test.ts: 31 pass.bun run check fast: typecheck, build, generated ok; unit 22717 pass,1 fail = server/ssh-account-add.test.ts, which fails only with a long TMPDIR (socket path > 108 bytes) and passes
with a short one (3/3), untouched here.
fingerprint matches ssh-keygen → PC page opens over the tunnel (no gate cookie reached the PC, Connection: close)
→ relaunch reopens it; SSH tab lists the PCs the first PC knows; Add → Tailscale SSH preselected → real Tailscale
check link shown.
four LOWs) fixed.