1
0
Fork 0
mirror of https://github.com/Luzifer/shareport.git synced 2024-11-08 14:20:09 +00:00
Kept simple self-hosted alternative to ngrok to share local development webservers through a remote SSH connection
Find a file
dependabot[bot] e1879b9359
Bump golang.org/x/crypto from 0.0.0-20191122220453-ac88ee75c92c to 0.1.0
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.0.0-20191122220453-ac88ee75c92c to 0.1.0.
- [Release notes](https://github.com/golang/crypto/releases)
- [Commits](https://github.com/golang/crypto/commits/v0.1.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-25 01:12:21 +00:00
example Add example script 2019-11-28 22:48:23 +01:00
.gitignore Initial version 2019-11-28 18:09:18 +01:00
.repo-runner.yaml Add auto-building 2019-11-28 22:52:41 +01:00
go.mod Bump golang.org/x/crypto from 0.0.0-20191122220453-ac88ee75c92c to 0.1.0 2023-02-25 01:12:21 +00:00
go.sum Bump golang.org/x/crypto from 0.0.0-20191122220453-ac88ee75c92c to 0.1.0 2023-02-25 01:12:21 +00:00
History.md prepare release v0.1.0 2019-11-29 00:05:47 +01:00
LICENSE Add META 2019-11-28 23:39:53 +01:00
main.go Lint: Fix several linter advices 2019-11-29 00:02:48 +01:00
Makefile Add auto-building 2019-11-28 22:52:41 +01:00
README.md Add META 2019-11-28 23:39:53 +01:00
ssh_key.go Lint: Fix several linter advices 2019-11-29 00:02:48 +01:00

Go Report Card

Luzifer / shareport

shareport is a kept simple self-hosted alternative to ngrok to share local development webservers through a remote SSH connection.

The only feature supported is to forward the port: All other features like analysing, introspecting or replaying the HTTP traffic are not supported. If you need them you should go with ngrok (and its payed plan for custom domain support).

How to use it

  • Prepare your setup including webserver, SSH key and so on (see below for my setup)
  • Start a webserver for your development and note the port
  • Execute shareport: It then will
    • Create a SSH connection
    • By default listen on a random port on the remote machine
    • Execute the given script or command on the remote machine
  • After you're done just quit the shareport command and it will
    • Terminate the remote script
    • Stop listening on the port
    • Close the connection

My Setup

  • The server
    • Small Hetzner Cloud CX11 machine
    • Ubuntu 19.04 and nginx
    • Domain knut.dev with a LetsEncrypt wildcard certificate mapped to the machine
    • Extra user for for shareport with a SSH key deployed
    • A directory in users home to house nginx server configuration
    • sudoers file to allow systemctl reload nginx.service on the unprivileged user
  • The script: See example/remote-script.bash

In this setup Ubuntu 19.04 is a quite important part: For the script to properly being shut down the SSH connection needs to be able to transmit a TERM signal. This was implemented somewhere between OpenSSL 7.6 and 7.9 and Ubuntu 19.04 is the first version to ship OpenSSL 7.9. Every other Linux system with a recent OpenSSL version also should work.

As an example lets take a Python webserver and expose it:

# echo "Ohai" >hello.txt
# python -m http.server --bind localhost 3000
Serving HTTP on 127.0.0.1 port 3000 (http://127.0.0.1:3000/) ...

# cat .env
IDENTITY_FILE=id_rsa
IDENTITY_FILE_PASSWORD=password
REMOTE_HOST=knut.dev:22
REMOTE_SCRIPT=example/remote-script.bash
REMOTE_USER=shareport

# envrun -- shareport --local-addr localhost:3000
Listening on https://4neg7kj4.knut.dev/

# curl https://4neg7kj4.knut.dev/hello.txt
Ohai