SSH (remote) port-forwarding client.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Bit 6766fc5b31 created run script 6 months ago
Dockerfile created run script 6 months ago
README.md changed container name 6 months ago
run.sh created run script 6 months ago

README.md

SSHPortForwarder

A SSH client for (remote) portforwarding.

Add your private key as a volume or as a secret [recommended] (requires at least docker-compose version 3.1). Source address and tunnel address are set by environment variables. One should set the restart policy to “unless-stopped” to ensure that the connection becomes reestablished automatically.

An example is:

version: "3.1"

services:
    ssh_forwarder:
        image: ssh_forwarder:latest
        build: https://git.darknebu.la/bit/SSHPortForwarder.git
        environment:
            SOURCE_ADDRESS: SourceIpOrDomainName
            SSH_TUNNEL_ADDRESS: example.server.com
        secrets:
            - source: ssh_key
              target: /root/.ssh/id_rsa
        restart: unless-stopped

secrets:
    ssh_key:
      file: /path/to/my/key/id_rsa

Where SourceIpOrDomainName is the ip address or domain of the source, example.server.com is the domain of the server you want to connect to via ssh and /path/to/my/key/id_rsa is the path to your private key on the host.

There are several environment variables that can be set:

ENVIRONMENT VARIABLE Default Description
PUBLISH_PORT 80 The port on which the source will be published on the destination server
SOURCE_ADDRESS localhost The ip address or domain of the source that should be forwarded
SOURCE_PORT 80 The port of the source that should be forwarded
SSH_TUNNEL_USER root The username that is used for the ssh connection
SSH_TUNNEL_ADDRESS localhost The target address to which a ssh connection is established to
SSH_TUNNEL_PORT 22 The ssh port of the target server
SSH_KEY_PATH /root/.ssh/id_rsa The container internal path to the private key (not just rsa)