Repository navigation
Built-in SSH on libssh for every desktop app - #10
Merged
Merged
Conversation
One engine in C on libssh 0.11 (with mbedTLS, both built from their release tarballs where the system has no libssh 0.11): host keys for the caller to trust (and OpenSSH's known_hosts when asked), logins by password, keyboard-interactive, a key, the agent or OpenSSH's defaults, a shell on a pty, commands, direct channels, remote listens and the server's agent channels; keys made, read and re-encrypted. Its tests log in to a real sshd when DMODEM_SSH_TEST names one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
The Remote page's SSH runs libdmodemssh on a thread of its own: OpenSSH's config, known_hosts, keys and agent are read; a new server's key is asked about and remembered, a changed one refused; passwords and the server's questions are asked in dialogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
The Windows app runs libdmodemssh on a thread that posts its events to the main window, with a login dialog that fits its questions; the Windows 95 build keeps Windows' ssh.exe in a pseudo console. The macOS app's SSHConnection polls it on a thread for the main queue, with SwiftUI alerts for a new host, a password or the server's questions; PtySpawn goes. libssh and mbedTLS are built universal for macOS by the repository's CMake. Linux CI logs in to a real sshd; docs follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
dmc_ssh_exec() takes ssh -A as the shell does, and dmc_ssh_write() gives back how many bytes wait for the server's window, so a forward can hold back a fast sender. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
libssh runs a client's callbacks for the channels the server opens (the forwarded agent's) only when it's built WITH_SERVER, so it now is. Its remote listen on port 0 read the port the server picked from the last packet in, often another one, and failed a listen the server had taken: PatchLibssh.cmake keeps the port from the reply itself. Each of the engine's functions has its comment. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRSV65geuGd6zMt2V6r
SSH's shell asks for the terminal type the picker has, as Telnet and rlogin do. 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
SSH on the Remote page no longer depends on a system
ssh. It goes through libdmodemssh (ssh/), D-Modem's own SSH client on libssh 0.11. The Android and iOS apps will use the same engine, so SSH works the same on every platform.libdmodemssh (
ssh/include/dmodemssh.h,ssh/src/dmodemssh.c)known_hosts, and it can read~/.ssh/config.-L/-D), remote listens (-R), and agent channels from the server (-A).Apps
g_main_context_invoke. A new server's key is shown with its SHA256 fingerprint in an AdwAlertDialog and added toknown_hostsif accepted. A changed key is refused with a warning. Passwords and the server's questions are asked in dialogs. The forkpty and systemsshcode is removed.WM_APP_SSH. There is a newIDD_ASKlogin dialog that sizes itself to the number of questions. Known hosts are kept in the profile's.ssh. The Open Watcom (Windows 95) build has no libssh, so it keeps the ConPTY +ssh.exepath.SSHConnection.swiftpolls on a thread and hands events to the main queue, with SwiftUI alerts for the questions.PtySpawn.cis removed. The repository's CMake builds libssh universal (arm64 and x86_64) for the Xcode project.CI: the Linux job now starts a real sshd and runs the SSH tests against it (password, key, shell, command,
-L,-R). The macOS job builds libssh universal.Tested
dmodemssh_testagainst a local OpenSSH server, on Linux and as the MinGW build under Wine. Covered: host key refusal, a wrong then a right password, an RSA key login, keyboard-interactive (on a PAM sshd), a shell'sstty size/TERM/exit status, a command with stdin, EOF and exit status, a direct channel, and a remote listen on a port the server picks, with data both ways. valgrind reports nothing.known_hostswritten, the password dialog, a login with the right size and TERM, and "the shell exited with status 3".Generated by Claude Code