Giter VIP home page Giter VIP logo

autossh-reverse-tunnel's Introduction

autossh-reverse-tunnel

I've set this up a few times from scratch so I figured I would automate the process and share. This is a set of shell scripts to make a linux server accessible when it is behind a firewall and/or NAT device without opening inbound network access. It uses the ssh remote port forwarding feature to open a port on a bastion server that forwards back to sshd on the target machine. It also uses autossh to make the connection persistent and upstart to start autossh at boot.

Requirements

This setup requires ssh network connectivity outbound from the target machine to the bastion server.

This has been tested on Ubuntu 12.04 and 14.04. Use at your own risk!

Setup

Open a new terminal session on the bastion machine. Execute the following command.

curl -s https://raw.githubusercontent.com/billmoritz/autossh-reverse-tunnel/master/bastion.sh | sudo bash 

Open a new terminal session on the target machine. Replace the bastion.example.com hostname in the following command and execute it.

curl -s https://raw.githubusercontent.com/billmoritz/autossh-reverse-tunnel/master/target.sh | sudo bash -s bastion.example.com

Go back the bastion terminal and delete the temporate password by running: sudo passwd -d autossh

Connection

To ssh to the target from the bastion ssh to localhost on port 10022.

ssh localhost -p 10022

autossh-reverse-tunnel's People

Contributors

billmoritz avatar

Stargazers

Sam Mingo avatar

Watchers

James Cloos avatar  avatar

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.