Want a stdio capable client to connect to a tor service but socat doesn't
accept unix addresses and you've configured your tor client to serve local
clients over a unix socket? This is your tool!
If your tor service is exposing a unix socket to your user at
/run/tor/behind-nat/users.sock and has the tor address
a2bg8me3awc9x8zb.onion which accepts connections on 700 and forwards those
to a remote ssh server started on demand, your ssh config in ~/.ssh/config
will contain entries like this:
Host behind-nat-ssh-server
Hostname a2bg8me3awc9x8zb.onion
ProxyCommand unixsocks --port 700 --socket-path /run/tor/behind-nat/users.sock --remote-host a2bg8me3awc9x8zb.onion
IdentityFile ~/.ssh/behind-nat-ssh-server-git
User git
Host behind-nat-ssh-server
Hostname a2bg8me3awc9x8zb.onion
ProxyCommand unixsocks --port 700 --socket-path /run/tor/behind-nat/users.sock --remote-host a2bg8me3awc9x8zb.onion
IdentityFile ~/.ssh/behind-nat-ssh-server-backdoor
User backdoor-user
There are four ways to obtain a binary:
-
You can build using cargo if you have a Rust toolchain installed by
cargo build --releaseand just point yourProxyCommandtounixsocks/target/bin/unixsocks -
To use an ephemeral environment with
unixsocksavailable, you can run thedefaultAppdirectly off of the flake withnix run github:positron-solutions/unixsocks --command "unisocks" "arg" "arg" "arg" -
Also using nix flakes, you can run
nix buildand pointProxyCommandtounixsocks/result-bin/bin/unixsocks -
On legacy nix, use plain
nix-buildon the above. -
If you use home manager, you can include this repo in your inputs as either a flake input path or as a path to a locally checked out copy.
{ pkgs, ... }:
let
unixsocks = (import ./unixsocks/); # this is defaultPackage from the flake
in {
home.packages = [
unixsocks
];
} Build & activate this updated profile with home-manager switch and now
unixsocks will be available on your path.
This repository provides a shell that can be used with nix develop or by
direnv activate. See cargo2nix for more information on debugging crate
builds.
The environment includes all dependencies and state configuration to
successfully build this repository with just cargo build. There are some
differences between the actual sanboxed build and the build in the development
shell, but they are minimized.