Repository navigation
feat: share this machine's network with a host from its session - #175
Merged
Merged
Conversation
added 2 commits
October 27, 2026 23:32
A host without DNS or a way out could not install anything. Alt+Shift+N in a session starts a second ssh connection to the host that carries only a reverse dynamic forward (`-R 127.0.0.1:0`): the host gets a SOCKS5 proxy on its loopback whose traffic leaves from this machine, so `apt -o Acquire::http::Proxy=socks5h://127.0.0.1:PORT` works there. The session itself is never touched; the key stops it again, and so do closing the tab, the session ending and quitting. On Linux the connection also dies with sshub however sshub ends. It logs in with the saved host's stored password or key, looked up again because the session drops its copy once authenticated. The proxy may open ports 80 and 443 only (PermitRemoteOpen, its first entry passed twice because OpenSSH 8.8 to 9.1 skip it, bz3515), it never rides a ControlMaster, and the allocated port is read from the second connection's own -E log, where a server banner cannot reach. The session footer shows the state and the host's ssh log the ready-to-paste apt and curl lines. `sshub connect <host> --share-net` does the same for the CLI.
The test's ControlPath was the sshd tempdir plus `cm-%C`. Under macOS's long per-user TMPDIR the 40-character hash and the suffix ssh adds while binding passed the ~104 byte limit of a Unix socket path, so the master never started and the test failed on CI. `cm-%p` names its one master.
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.
Closes #174.
What changed
Alt+Shift+Nin an ssh session (rebindable) starts a second ssh connection to the same host, the "sidecar" (src/session/share_net.rs).-R 127.0.0.1:0), so the host gets a SOCKS5 proxy on its loopback whose traffic leaves from this machine.Alt+Shift+N share net,⇄ net ...,⇄ net :PORT · Alt+Shift+N stopor⇄ net failed · Alt+Shift+N retry. It stays visible while scrolled back.aptandcurlcommands.PermitRemoteOpenallows ports 80 and 443 only. The first entry is passed twice because OpenSSH 8.8 to 9.1 skip it (bz3515); checked on real 8.9 and 9.6 clients.ControlMaster=noandControlPath=none, because a mux master applies no limit.StrictHostKeyChecking=yes, andExitOnForwardFailure=noso the user's own ssh_config forwards cannot stop the share.PR_SET_PDEATHSIGends the sidecar with sshub however sshub ends.-Elog in a private 0700 dir; stderr, where a server banner lands, is never parsed.sshub connect <host> --share-netadds the same options inline.### Added), README feature and session key table, help, man page (--share-net), openwikisessions-sftp.mdandcli.md. All state the security trade-off: while sharing, any user on the host can reach what this machine reaches on ports 80/443.How tested
cargo fmt --check,cargo clippy --all-targets -D warnings, andjust test(1740 + 127 + 127) are green.AllowTcpForwarding noshows Failed and the session goes on;https://example.comreturned 200 through the proxy, and a non-web port was refused.Ctrl+W, closing the terminal, andkill -9of sshub.Not changed
/tmp.Alt+Shift+N share nethint takes the place ofShift+drag in mouse apps.Written by Claude Opus 5.5 (Oh My Pi) on behalf of the maintainer.