Dockerized SSH server that allows TCP local and remote port forwarding
ISC License
Dockerized SSH server that only allows TCP local and remote port forwarding. Image based on python:3-alpine
. The ssh-port-forward-client image can be used for connecting to the server.
This image is experimental and might have undesirable effects. Use it under your responsability!
Assuming you have a public key file sshkey.pub
within the current working directory:
docker run -d --name=ssh-portforwarding-server -p 2222:2222 -v "$(pwd)/sshkey.pub:/ssh_pubkey:ro" davidlor/ssh-port-forward-server:dev
Keep in mind that this image:
2222
by default/ssh_pubkey
by defaultssh
user to connect-N
option on the ssh clientAn example with all the steps involving a complete deployment of a SSH port forwarding server, client, upstream server and downstream client are available on the test script.
You can connect locally to a deployed SSH server, without a Docker client container, with the following command:
ssh -N -L <local port>:<target host>:<target port> ssh@<ssh server host> -i <private key> -p 2222
Currently, the settings are provided through environment variables, which are the following:
2222
)/ssh_pubkey
)host:port
can be forwarded through the server. Multiple mappings can be defined on a single variable splitting them with ;
(spaces ignored). If any of these variables are defined, all forwardings are allowed.The files required for the server to work are:
/ssh_pubkey
by default.