Repository navigation
SSH on libssh for iOS and Android (sshj and SwiftNIO SSH gone) - #48
Merged
Merged
Conversation
native-ssh is the desktop apps' SSH engine (D-Modem/gui's ssh/), built here from libssh's and mbedTLS's release tarballs for the host, Android and Apple's systems. ios/build-native.sh makes it DModemSSHNative.xcframework, each arch linked into one object whose only globals are dmc_ssh_*, so its mbedTLS never meets the engine's. DModemSSH's SSHShell keeps its API on it (SwiftNIO SSH goes), adding RSA, keyboard-interactive and private keys; CI runs its tests and the engine's against a real sshd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
The SSH client is the same as iOS's and the GUI's now: native-ssh, on libssh, loaded as libdmodem_ssh_jni.so (NativeSsh.kt). SshLink polls it on its own thread; its channels carry the shell, commands, the port forwards (-L, -R, -D) and the forwarded agent's requests. Keys stay the app's: SSH's wire form (SshWire.kt), OpenSSH's and PEM keys read through the engine, PuTTY's .ppk read here, all on BouncyCastle. The engine: commands can forward the agent, a write tells what's still kept for the server (forwards hold back a fast sender), libssh built WITH_SERVER (its callbacks for the agent's channels need it), and its remote listen on port 0 patched to take the port from its own reply. The unit tests build the JNI library for the host (buildHostSsh) and run against it: OpenSSH's sshd, puttygen and Apache MINA's server. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
…sal per slice Both XCFrameworks' headers land in the app's one include/, so CDModemSSH's module.modulemap goes in include/CDModemSSH/; each slice's archive is lipo'd from one archive per arch. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by Sydney · project thread
What
Both apps' SSH now runs on the same client as the desktop GUI (D-Modem/gui#10): libdmodemssh (
native-ssh/), on libssh 0.11 with its own Mbed TLS. Both are built from release tarballs pinned by SHA-256.iOS:
DModemSSHwraps the engine, built as theDModemSSHNativeXCFramework byios/build-native.sh. Onlydmc_ssh_*is exported, so its Mbed TLS can't clash with libre's. SwiftNIO SSH is gone. Password, keyboard-interactive and key logins work, with Ed25519, ECDSA and RSA keys.Android: the engine loads through JNI as
libdmodem_ssh_jni.so(NativeSsh.kt), and sshj is gone. The features carry over:BouncyCastle stays for the key maths.
Engine changes, mirrored on gui#10:
WITH_SERVER, because its client-side callbacks for server-opened channels (the agent's) only run then.PatchLibssh.cmakefixes libssh's remote listen on port 0. libssh read the bound port from the last packet received, so a listen the server had accepted could fail at random.Tests
native-ssh/testpasses against a real sshd: password, key, shell, exec, -L, -R and refused host keys. CI's native job runs it, then the DModemSSH Swift tests.buildHostSsh) and run the SSH tests against it. All of these pass locally: SshLinkTest (MINA), OpenSshInteropTest (OpenSSH's sshd and puttygen: forwards, agent hop with RSA, ssh-copy-id, keys both ways), and the SSH UI tests. The fulltestDebugUnitTestrun passes too.libdmodem_ssh_jni.soexports only theJava_*entry points and is 16 KB-page aligned.Generated by Claude Code