Git Product home page Git Product logo

tunneller's Introduction

Go Report Card license Release

Table of Contents

tunneller

Tunneller allows you to expose services which are running on localhost, or on your local network, to the public internet.

This is very useful for testing webhooks, the generation of static-site compilers, and similar things.

NOTE: There is a public end-point I host, you SHOULD NOT rely upon it. It might come and go. It is not secure.

There is a basic GUI present to allow you to view status-codes, and the most recent few requests:

Screenshot

Overview

Assuming you have a service running within your local network, perhaps a HTTP server you could access via http://localhost:8080/, you can expose that to the public-internet by running:

$ tunneller client -expose localhost:8080

This will show you initial page of the GUI, letting you know how you can access your resource externally:

Screenshot

As the name implies there is a central-host involved which is in charge of routing/proxying to your local network - in this case that central host is tunnel.steve.fi - the reason this project exists is not to host a general-purpose end-point, but instead to allow you to host your own.

In short this project is designed to be a self-hosted alternative to software such as ngrok.

So remember:

NOTE: There is a public end-point I host, you SHOULD NOT rely upon it. You should configure your own server, and use it.

How it works

When a client is launched it creates a connection to a message-bus running on the default remote end-point, tunnel.steve.fi, it keeps that connection alive waiting for instructions.

When a request comes in for foo.tunnel.steve.fi the server will submit a command for the client to make the appropriate request by publishing a message upon the topic the client is listening to. (Each client has a name, and listens to its own topic).

In short:

  • The server sends a "Fetch this URL" request to the client.
  • The client makes the request to fetch the URL
    • This will succeed, because the client is running inside your network and can access localhost, and any other "internal" resources.
  • The response is sent back to the server.
    • And from there it is routed back to the requested web-browser.

Because the client connects directly to a message-bus there is always the risk that malicious actors will inject fake requests, attempting to scan, probe, and otherwise abuse your local network.

Installation

There are two ways to install this project from source, which depend on the version of the go version you're using.

NOTE: If you prefer you can find binary releases upon our release page

Source Installation go <= 1.11

If you're using go before 1.11 then the following command should fetch/update tunneller, and install it upon your system:

 $ go get -u github.com/skx/tunneller

Source installation go >= 1.12

If you're using a more recent version of go (which is highly recommended), you need to clone to a directory which is not present upon your GOPATH:

git clone https://github.com/skx/tunneller
cd tunneller
go install

If you don't have a golang environment setup you should be able to download a binary for GNU/Linux from our release page.

Installation of your self-hosted Server

If you wish to host your own central-server this is how to do it:

  • Create a DNS-entry tunnel.example.com, pointing to your host.
  • Create a wildcard DNS entry for *.tunnel.example.com to point to the same host.
  • Setup and configure mosquitto queue running on that same host.
    • See mq/ for details there.
    • Don't forget to ensure that the MQ-service is publicly visible, by opening a firewall hole for port 1883 if required.

Of course security is important, so you should ensure that your message-bus is only reachable by clients you trust to expose their services. (i.e. Your VPN and office range(s).)

Github Setup

This repository is configured to run tests upon every commit, and when pull-requests are created/updated. The testing is carried out via .github/run-tests.sh which is used by the github-action-tester action.

Releases are automated in a similar fashion via .github/build, and the github-action-publish-binaries action.

tunneller's People

Contributors

dmlittle avatar fabfurnari avatar skx avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tunneller's Issues

If the server goes away ..

If you launch a simple webserver:

python -m SimpleHTTPServer 8000

Then make it available:

 tunneller  client -expose localhost:8000 -name skx

You can access the contents via http://skx.tunneller.steve.fi/, however if you kill the python-server and restart it the client dies. I'd expect it to keep working - after all the back-end host is only polled on-demand.

goroutine 1 [running]:
main.(*clientCmd).Execute(0xc00005c3c0, 0x7833a0, 0xc000018118, 0xc000012360, 0x0, 0x0, 0x0, 0x0)
/home/skx/go/src/github.com/skx/tunneller/cmd_client.go:155 +0x987
github.com/google/subcommands.(*Commander).Execute(0xc000094000, 0x7833a0, 0xc000018118, 0x0, 0x0, 0x0, 0xc0000220b8)
/home/skx/go/src/github.com/google/subcommands/subcommands.go:142 +0x2fb
github.com/google/subcommands.Execute(...)
/home/skx/go/src/github.com/google/subcommands/subcommands.go:420
main.main()
/home/skx/go/src/github.com/skx/tunneller/main.go:28 +0x1b5

Tunnel not working

Every time we run tunneler expose its works and connected also return the URL, when we trying to access the URL it's always showing NGINX default page. In the instruction we just simply pointing the domain to the hosts, can you please explain why it's not working?

Failed to connect to the MQ-host Network Error : %!s(<nil>)

I'm using a little self-hosted instance and things worked fine for a long time. Right now, I can't connect to the server any more, as I receive the error Failed to connect to the MQ-host Network Error : %!s(<nil>)..
I restarted the server already, without any success..
Any idea on how to debug this problem?

make the tunnel port selectable

I was just trying to setup tunneller in our Kubernetes environment. Unfortunately, I can't expose the port 1883 for the mosquitto endpoint directly, but instead need to use higher, random ports (which makes it more save as well I think). Unfortunately, the port 1883 for "tunnel" is hard-coded.
Wouldn't it be an idea to make it selectable as well?

Our client is ugly.

Remove the fmt.printf and write a simple GUI.

I've used termui in the past, that will suffice as a quick hack. I can spend an hour on this tonight, and then do the 0MQ stuff next.

Move towards mosquitto / rabbitmq ?

I'm increasingly thinking that I should move towards using MQ / mosquitto as the transport for communication, so I'll file this issue to sollicate feedback.

In my view the point of this software is not to offer a service that people can use, but instead to share software that users can host themselves. If people wanted something "free" and seamless they could use ngrok itself. It offers a nice console-based GUI, a decent set of stats, and similar.

I'm running my own instance here so that users can demo the tool, and try it out in a simple fashion. Not because I want to run a service that users can rely upon directly. If I'm committing to run a service myself it will become a support-burden, and the only way that will be eased is if people throw piles of shiny notes at me.

If I use MQ then setup for self-hosting users is still simple; instead of using apache/nginx they just apt-get install mosquitto (or the local equivilent).

I can stil allow users to demo it, by defaulting to the test install of mosquitto, available online

Of course anybody could be listening ..

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.