Giter Site home page Giter Site logo

ssh-tunnel's Introduction

ssh-tunnel

Local port forwarding with SSH. Access a service on private.server.tld:port through an ssh connection between your local/docker server and public.server.tld.

Requirements

You need to set up passwordless ssh access to your public.server.tld

Usage

Create a folder on your local/docker server (i.e. /some/local/folder) containing 2 files:

  • /some/local/folder/config
  • /some/local/folder/private_key (the one used for passwordless access)

Format for /some/local/folder/config

Host public.server.tld
    User sshusername
    HostName public.server.tld
    IdentityFile /root/.ssh/private_key  # (leave /root/.ssh/ as is)
    StrictHostKeyChecking no
    Port 22

Launch the container:

docker run -d -p 3306:3306 \
	-e PORT_EXPOSED=3306 \
	-e PORT_TO=3306 \
	-e ADDR_TO=private.mysql.server.tld \
	-e ADDR_TUNNEL=public.server.tld \
	-v /some/local/folder:/root/.ssh \
	--name ssh.tunnel \
	ndiazg/ssh-tunnel:latest

Now you can access the private service on the chosen port of your local/docker server

mysql -u mysqlusername -p -h local.server.tld -P 3306

Tip

Connect and alias your tunnel along with other containers in the same network.

docker network connect --alias some.endpoint somenetwork ssh.tunnel

Now your other containers can reach the remote/restricted service at some.endpoint

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.