Skip to content
Haskell library for creation of SSH tunnel (SOCKS proxy)
Haskell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src/Control/SSH
.gitignore
CHANGELOG.md
LICENSE
README.md
Setup.hs
ssh-tunnel.cabal
ssh-tunnel.sublime-project
stack.yaml

README.md

ssh-tunnel

Small library that allows to create SSH tunnel (SOCKS proxy) from Haskell and proxy http-client.

Tunnel is created with:

ssh -f -N -M -S <master-socket> -i <pemfile> -L <localport>:127.0.0.1:<remoteport> <user>@<host>

Note: that the tunnel is created in background (-f) without a shell on remote host (-N) and (-M -S ) defines special socket that is used to terminate the tunnel.

How to use in your code:

import Control.Monad.Managed
import Control.SSH.Tunnel
import Network.HTTP.Client
import Network.HTTP.Client.TLS

with (openSshTunnel config tlsManagerSettings) $ \settings -> do
 manager <- newManager settings
 -- do things with manager
 -- as soon you live the scope, tunnel will be down

Also, you can find addFingerprints function useful for adding fingerprints to known hosts on first connect.

You can’t perform that action at this time.