ssh
Real SSH, via libssh bound into the native larzscript interpreter - not a from-scratch reimplementation.
Real SSH key exchange needs big-integer/elliptic-curve math Larzscript's double-only numeric type can't honestly do. Rather than fake it, this binds a real, audited C library into the interpreter itself - the same relationship paramiko has with OpenSSL via Python's cryptography package. Talks to real sshd/OpenSSH/dropbear directly, no shelling out to the ssh binary. Every native target larzscript builds for - Linux (x86_64 + aarch64), macOS (x86_64 + arm64), and Windows x86_64 - client AND server role, all five CI-verified against a real independent sshd/ssh client. Only the web/wasm build has no real SSH, permanently (no raw TCP in that sandbox).
What you get
- ssh.connect / authenticate_with_password / authenticate_with_key
- ssh.run() - real command output + real exit status
- ssh.forward_remote_port() - the actual ssh -R equivalent, real channel forwarding
- ssh.listen()/ssh.serve() - a real SSH server, exec AND interactive shell (real pty)
- ssh.verify_host_trust_on_first_use() - real known_hosts checking, fails closed on a changed key
- statically linked (Linux/Windows) - zero runtime dependency, verified via ldd
- verified end-to-end in CI against a real live sshd/ssh client, not a stub - on all five targets
Try it
import "ssh" as ssh
let session = ssh.connect("myserver.com", 22)
ssh.authenticate_with_key(session, "root", "~/.ssh/id_ed25519")
let result = ssh.run(session, "whoami")
print(result["stdout"])
print(result["exit_status"])
# the real ssh -R equivalent - anyone hitting the relay's port 2200
# gets bridged to this machine's own sshd:
ssh.forward_remote_port(session, 2200, "127.0.0.1", 22)root 0 ssh: listening on the relay's port 2200 -> 127.0.0.1:22
The server role - real interactive shell, not just exec
This machine answers ssh user@this-machine cmd with real command output, AND ssh user@this-machine (no command) with a real interactive login shell - real pty, real job control - no OpenSSH/dropbear/anything external installed either way. Interactive shell is POSIX only (Linux, macOS) - Windows still answers exec commands correctly, but denies a shell request instead of crashing (needs ConPTY, not built yet).
import "ssh" as ssh
let server = ssh.listen(22, "/etc/ssh_host_key") # generates the key on first use
ssh.serve(server,
fn(user, password) { return password == "hunter2" }, # check_password
fn(cmd) { return capture(cmd + " 2>&1") }) # run_commandHost-key verification - never blindly trust a connection
Wraps libssh's own known_hosts implementation, not a hand-rolled comparison. Trusts a host the first time it's seen (no separate side-channel to verify a fingerprint against), but fails closed - throws, refuses to proceed - the moment a previously-trusted key changes, the real MITM-detection case.
import "ssh" as ssh
let session = ssh.connect("myserver.com", 22)
ssh.verify_host_trust_on_first_use(session, env("HOME", ".") + "/.ssh/known_hosts")
# throws if the key CHANGED since last connecting - never silently proceeds
ssh.authenticate_with_key(session, "root", "~/.ssh/id_ed25519")