Giter Site home page Giter Site logo

wssh's Introduction

wssh

Try to proxy SSH connection through Websocket (to use with nginx).

First attemp was using pair of requests (GET+POST), but nginx appeared to always buffering user request (server response can be send back unbuffered). So it is impractical :-(

So, next step was to use Websocket proxying, which is available in nginx since v1.3.13.

Data flow

Normal SSH session is very simple:

  • SSH Client
  • TCP Connection
  • SSH Server, listening on TCP port 22

WSSH session is:

  • SSH Client with -o ProxyCommand='node client.js WSSH-URI'
  • client.js listening to its stdin
  • Websocket (HTTP/HTTPS) connection to nginx
  • nginx configured to redirect connection to WSSH server
  • Another Websocket connection from nginx to WSSH server
  • WSSH server, listening to dedicated TCP port (4567 by default)
  • Normal TCP connection
  • Normal SSH Server, listening on TCP port 22

And nginx stage can be omited in development/testing scenarios.

In some scenarios this path can be even longer:

  • SSH Client, capable to connect via HTTP proxy (eg PuTTY/PLink)
  • TCP connection to local proxy
  • connect.js listening to dedicated port (3122 by default)
  • Websocket (HTTP/HTTPS) connection to nginx
  • nginx configured to redirect connection to WSSH server
  • Another Websocket connection from nginx to WSSH server
  • WSSH server, listening to dedicated TCP port (4567 by default)
  • Normal TCP connection
  • Normal SSH Server, listening on TCP port 22

Windows bugs

Node.js has some strange bug when working with MS Windows STDIN. Therefore client.js cannot be used as local proxy command for PuTTY/PLink.

So, on MS Windows, one should use connect.js and PuTTY/PLink via HTTP proxy (localhost:3122 by default).

See also

Credits

wssh's People

Contributors

ukoloff avatar

Stargazers

Ahmad Gani avatar Malik Al avatar  avatar D0Lim avatar Ralf M avatar Ivan Vučica avatar

Watchers

 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.