Giter Club home page Giter Club logo

tunnel's Introduction

Tunnel

AppleScript applet to open SSH tunnels.

Motivation

Feeling very reluctant to use screen sharing solutions by third parties like TeamViewer and Anydesk, I decided to automate the opening of SSH tunnels. This way anyone can start a connection to a server controlled by me, which I can then use to access their Macs.

Building the applet

  1. Download or clone this repository

  2. Run the build script

  3. When prompted, choose to save and edit the sample settings

  4. Fill out the settings

  5. Run the build script again

  6. When asked choose to generate a new key pair

  7. The built applet will be shown in the Finder

Running the applet

  1. A dialog is shown so the user can confirm the connection

  2. The SSH tunnel is opened

  3. When connected, a dialog shows the tunneled port number on the SSH server

  4. The applet stays open to monitor the SSH process and starts it again if necessary

  5. When the applet is quit regularly, the SSH connection is ended

Connecting through tunnel

If you left the local port set to 5900, you can connect via VNC like this:

  1. From the Finder’s Go menu, select the Connect to server

  2. Enter vnc:// followed by the SSH server’s address, a colon, and the tunneled port number (Example: vnc://ssh.mydomain.com:58834)

  3. Click Connect

Server requirements

  • SSH service turned on and accessible to the user name specified in the applet’s build settings

  • SSH service reachable at the address and port specified in the applet’s build settings

  • Ports 50000 through 59999 accessible to your Mac so you can connect back through the tunnel

  • Corresponding public key entered in authorized_keys file prefixed with command="/sbin/nologin" (note the space at the end that is necessary to delimit the prefix from the key). You will find the public key in ~/Library/Application Support/Tunnel/Keys/.

  • Suggested SSH server configuration options:

PermitEmptyPasswords no
ChallengeResponseAuthentication no
UsePAM no
GatewayPorts yes
  • The option GatewayPorts yes is particularly important so you can access tunneled ports (50000 through 59999) on the SSH server

Development notes

  • When running the tunnel script from your editor, you can prepare a settings file at the path ~/Library/Application Support/Tunnel/Settings/testing.applescript for testing purposes

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.