Code Monkey home page Code Monkey logo

pytunnel's Introduction

pytunnel

SSH reverse tunneling system

This system is used to connet to a remote server behind a firewall using reverse ssh tunnel.

System structure

  • client machine
  • server machine
  • shared queue

The client (publicly accessible) will send a request for tunnel creation to a shared queue (Amazon SQS queue) since it cant access the server directly.

The server listens forever to the shared queue. when a request received, the server creates a reverse SSH tunnel to the client and will map one of its TCP ports to the client machine.

The client can then connect to that port using localhost:port

Prerequisites:

The server can access the client (ie. it can authenticate using ssh keys).

$ ssh user@client_ip

Running the server side:

set environment variables by edit config file. Those vars used by the server to fetch messages from a shared queue

export AWS_ACCESS_KEY_ID=XXX
export AWS_SECRET_ACCESS_KEY=XXX
export AWS_DEFAULT_REGION=XXX
export QUEUE_URL=XXX

source the config file and run the server side. the servers will start poll the queue

$ . config
$ ./pytunnel.py --d

running the client side:

Edit the request file chen-work.json NOTE:

  • ip can be 'dynamic'. this allow the requester host to inject its own public ip

source config and request a tunnel

$ . config
$ ./pytunnel.py --r chen-work.json

TODO:

  1. change server side --d to accept chen-dev39.json and not pnly chen-dev39 (then bash completion helps.)

pytunnel's People

Contributors

chenchuk77 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.