A simple, easy to use ngrok alternative (self hosted!)
Go to file
Tyler 1bb0440b9d
continuous-integration/drone/push Build is passing Details
continuous-integration/drone/tag Build is passing Details
Make key and passphrase global to all commands as intended
2022-01-31 19:55:23 -05:00
client Somewhat big rewrite, adds host registration and other improvements to structure 2021-12-22 23:32:59 -05:00
cmd Make key and passphrase global to all commands as intended 2022-01-31 19:55:23 -05:00
common Somewhat big rewrite, adds host registration and other improvements to structure 2021-12-22 23:32:59 -05:00
scripts Fix entrypoint, update license and readme 2021-12-20 22:15:36 -05:00
server Minor change to handler type checking to avoid second cast 2021-12-23 00:15:54 -05:00
.drone.yml Update packaging script/architectures 2021-12-20 20:17:01 -05:00
.gitignore Fix public key authentication/warnings, client loop, clean up log messages 2021-12-20 21:39:15 -05:00
Dockerfile Dockerfile, force go mod update, go mod download before build 2021-12-19 21:08:41 -05:00
LICENSE Fix entrypoint, update license and readme 2021-12-20 22:15:36 -05:00
README.md Somewhat big rewrite, adds host registration and other improvements to structure 2021-12-22 23:32:59 -05:00
go.mod Somewhat big rewrite, adds host registration and other improvements to structure 2021-12-22 23:32:59 -05:00
go.sum Somewhat big rewrite, adds host registration and other improvements to structure 2021-12-22 23:32:59 -05:00
main.go Initial commit 2021-12-19 21:02:34 -05:00

README.md

gogrok

Build Status

A simple, easy to use ngrok alternative (self hosted!)

The server and client can also be easily embedded into your applications, see the 'server' and 'client' directories.

Features

  • HTTP and HTTPS handling
  • Public key authentication
  • Authorized key whitelists
  • Registration of reserved hosts
  • Forwarding system that allows easy additions of other protocols (Coming soon: TCP and TCP+TLS, with host-based TLS support)

Example usage

By default, the first time you run gogrok it'll generate both a server and a client certificate. These will be stored in ~/.gogrok, but can be overridden with the gogrok.storageDir option (or GOGROK_STORAGE_DIR environment variable)

Server:

gogrok serve

Client:

gogrok --server=localhost:2222 http://localhost:3000

Server

$ ./gogrok serve --help
Start the gogrok server

Usage:
  gogrok serve [flags]

Flags:
      --bind string       SSH Server Bind Address (default ":2222")
      --domains strings   Domains to use for
  -h, --help              help for serve
      --http string       HTTP Server Bind Address (default ":8080")
      --keys string       Authorized keys file to control access

Global Flags:
      --config string   config file (default is $HOME/.gogrok.yaml)
      --viper           use Viper for configuration (default true)

Client

$ ./gogrok client --help
Start the gogrok client

Usage:
  gogrok client [flags]

Flags:
  -h, --help                help for client
      --key string          Client key file
      --passphrase string   Client key passphrase
      --server string       Gogrok Server Address (default "localhost:2222")

Global Flags:
      --config string   config file (default is $HOME/.gogrok.yaml)
      --viper           use Viper for configuration (default true)

Docker

Example docker compose file. Caddy is suggested as a frontend using dns via cloudflare and DNS-01 for wildcards.

version: '3.7'

services:
  gogrok:
    image: tystuyfzand/gogrok:latest
    ports:
    - 2222:2222
    - 8080:8080
    volumes:
    - /docker/gogrok/config:/config
    environment:
    - GOGROK_DOMAINS=gogrok.ccatss.dev
    - GOGROK_AUTHORIZED_KEY_FILE=/config/authorized_keys

Host Registration

Gogrok lets you register your own custom hosts that are attached to your public key.

On the server, make sure to run the server with the flag --store=PATH_TO_DB.db

Use gogrok register and gogrok unregister to manage registered hosts to your client key.