holt

command
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

holt CLI

The operator CLI for a reverse-tunnel hub: run the hub, enroll peers, and manage live tunnels. Peers authenticate with a JWT; the tunnel transport is encrypted with the hub's self-signed certificate, which the client pins (it travels in the join token). Reach a peer's tunneled service through the hub by naming it in a header.

go build -o holt ./cmd/holt

State

The hub keeps everything under ~/.holt (override with --state):

  • hub-cert.pem / hub-key.pem / jwt-secret — the hub identity, as files, reused across restarts so old tokens keep working.
  • holt.db — a SQLite database holding the peer blocklist and the tunnel-presence directory (via hub/sqldir).

Run a hub

holt hub
# hub up   tunnel=127.0.0.1:7000  admin=127.0.0.1:7001  proxy=127.0.0.1:7002
Listener Default Purpose
--tunnel-addr 127.0.0.1:7000 TLS + JWT; peers attach here
--admin-addr 127.0.0.1:7001 the Admin gRPC service (list / stop / block); serves the web console with --ui
--proxy-addr 127.0.0.1:7002 reach a peer's service via the x-tunnel-peer header
Web console (optional)

holt hub --ui serves a React console on the admin listener (http://127.0.0.1:7001/) — list tunnels, kill/block/unblock a peer, and enroll a new one (with the run command to copy). It's built from ui/ and embedded in the binary (task ui:build); pass --ui-path DIR to serve a local build instead. The console calls the same Admin gRPC service the CLI uses, over Connect-JSON from the browser.

Enroll a peer

enroll mints a token offline, signing it with the hub's stored identity (run it on the hub machine):

holt enroll alice --hub-addr 127.0.0.1:7000
#   Join token for "alice" — run your peer with it, e.g.:
#     starter-client --token eyJ...

The token bundles the peer's JWT, the hub's address, and the hub's certificate to pin — so the client encrypts the tunnel and verifies the hub, while the JWT authenticates the client.

Two ready-made peers consume the token:

  • holt expose — tunnel an existing local HTTP service (holt expose localhost:3000 --token …), ngrok-style.
  • cmd/starter-client — a minimal template that serves a built-in demo; copy it to write your own.

Reach the peer through the hub

Address a peer's service by its id in the x-tunnel-peer header; the hub proxies the request down that peer's tunnel:

curl -H 'x-tunnel-peer: alice' http://localhost:7002/

Whatever the peer serves over the tunnel (HTTP, gRPC — see the grpc-tunnel example) is reachable this way.

Manage tunnels

holt ls                 # list live tunnels (Admin gRPC)
holt kill alice         # disconnect the tunnel — the peer MAY reconnect
holt block alice        # disconnect AND ban the peer id — the peer CANNOT reconnect
holt unblock alice      # lift the ban

A block bans the peer id (the JWT subject), not one specific token: while blocked, every token for that id is refused, even a freshly enrolled one. Unblocking re-admits the peer — including tokens minted before the block that have not expired yet, since blocking never invalidates the tokens themselves.

Output modes

The CLI is friendly by default: a welcome banner when the hub or expose starts, readable logs, tables and checkmarks. For production (systemd, containers, log collectors), switch back to the classic structured JSON logs:

holt hub --log-format json      # or HOLT_LOG_FORMAT=json

-D enables debug-level logging in either mode.

Renew the certificate

The hub's self-signed certificate is pinned by peers through their join token. Renewing it generates a fresh one and invalidates every token already handed out — peers must be re-enrolled.

holt renew                 # asks for confirmation first
holt renew --yes           # skip the prompt (automation)

From the CLI you renew the files, then restart the hub to serve the new cert. The web console's Danger zone does both at once: it renews and hot-swaps the serving certificate immediately (no restart), then you re-enroll your peers.

  • kill sends a terminal GoAway; the running peer stops redialing, but the same token still works if it re-runs.
  • block additionally denies the peer's JWT subject at the door. The block is persisted in SQLite, so it survives a hub restart, until you unblock.

ls / kill / block / unblock call the hub's Admin gRPC service (openotters.holt.v1.Admin), reusable from grpcurl or any gRPC client.

Security notes

Demo defaults are permissive: the admin and proxy listeners are unauthenticated — keep them on loopback (the default) or front them with your own auth. Join tokens are bearer credentials; deliver them over a secure channel and keep --token-ttl short.

Documentation

Overview

Command holt is the operator CLI for a reverse-tunnel hub: run the hub, enroll peers, and manage live tunnels. Peers authenticate with a JWT and the tunnel transport is encrypted with the hub's self-signed certificate, which the client pins.

The peer side is a separate program — see cmd/starter-client, or write your own; both consume the enroll token.

holt hub                     # run the hub
holt enroll <peer>           # mint a join token for a peer
holt renew                   # regenerate the hub cert (invalidates tokens)
holt expose <addr> --token … # expose a local HTTP service through the hub
holt ls                      # list live tunnels
holt kill <peer>             # disconnect a tunnel (peer may reconnect)
holt block <peer>            # disconnect + ban the peer id
holt unblock <peer>          # lift a block

Directories

Path Synopsis
internal
clog
Package clog builds the CLI logger.
Package clog builds the CLI logger.
jwtauth
Package jwtauth issues and verifies the HMAC-SHA256 JWTs peers present when attaching to the hub.
Package jwtauth issues and verifies the HMAC-SHA256 JWTs peers present when attaching to the hub.
selfsigned
Package selfsigned generates and persists the hub's self-signed TLS certificate — used to encrypt the tunnel transport — and its JWT secret, as files in the config folder.
Package selfsigned generates and persists the hub's self-signed TLS certificate — used to encrypt the tunnel transport — and its JWT secret, as files in the config folder.
store
Package store is the hub's durable non-secret state: a single SQLite database under the config directory (~/.holt/holt.db).
Package store is the hub's durable non-secret state: a single SQLite database under the config directory (~/.holt/holt.db).
style
Package style is the CLI's small output vocabulary: a success mark, a dim note, and a bordered table.
Package style is the CLI's small output vocabulary: a success mark, a dim note, and a bordered table.
token
Package token is the copy-paste enrollment token that carries everything a peer needs to join: the hub's tunnel address, the JWT that authenticates it, and the hub's self-signed cert to pin (so the TLS-encrypted tunnel is verified, not blindly trusted).
Package token is the copy-paste enrollment token that carries everything a peer needs to join: the hub's tunnel address, the JWT that authenticates it, and the hub's self-signed cert to pin (so the TLS-encrypted tunnel is verified, not blindly trusted).
webui
Package webui owns the hub's embedded web console.
Package webui owns the hub's embedded web console.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL