SSH Tunnel with Autossh and Docker: Difference between revisions

From EnigmaGuy Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
Line 22: Line 22:
== Installation ==
== Installation ==


[[File:Sshtunnel.jpg|thumb|Basic diagram]]
[[File:Sshtunnel4.png|thumb|Basic diagram]]


# Download on [https://github.com/koss822/misc/tree/master/Linux/Projects/sshtunnel-daemon GitHub]
# Download on [https://github.com/koss822/misc/tree/master/Linux/Projects/sshtunnel-daemon GitHub]

Latest revision as of 11:22, 31 May 2020

SSH Tunnel Gateway with Autossh and Docker

What is this tool for?

  • Allow you to tunnel remote targets through multiple ssh servers
  • Clients can connect to your ssh tunnel gateway on your local network
  • Easy configuration (YAML)
  • Easy and secure installation (Docker)
Big overview

YAML sample

main:
 listen: 0.0.0.0
tunnels:
 - remote: username@remote_ip
   ports:
     # ssh
     - local: 2000 # This has to match docker-compose file
       remote_target: localhost
       remote_port: 22

Installation

Basic diagram
  1. Download on GitHub
  2. Install Ubuntu (or other Linux)
  3. Install docker
  4. sudo apt install docker.io
  5. Add your user to docker group (do not forget to relogin) - sudo usermod -a -G docker your_username
  6. Install docker compose
  7. sudo apt install curl
  8. sudo curl -L "https://github.com/docker/compose/releases/download/1.22.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
  9. sudo chmod +x /usr/local/bin/docker-compose
  10. Generate ssh-keys
  11. cd settings
  12. ssh-keygen -f ./id_rsa
  13. Edit settings/sshtunnel.yml
  14. Edit docker-compose.yml
  15. Run docker-compose build
  16. Try docker-compose up (after CTRL-C)
  17. Run docker-compose up -d (it should start after restart)