A herdr plugin that exposes the local herdr API socket
(~/.config/herdr/herdr.sock) through a tailcat
tunnel — WireGuard end-to-end encryption, DERP-relay NAT traversal, no control
plane, no root, and no listening ports on your machine.
Use case: drive this machine's herdr from another device — with
herdrm, herdr api, or your own scripts —
without SSH port forwarding.
┌─ remote client ─┐ WireGuard/DERP ┌─ herdr-tailcatd (this plugin) ─┐
│ tailcat CLI │ ═══════════════▶ │ tailcat.Server │
│ or socat bridge │ ◂═══════════════ │ OnTCP :6464 ──dial──▶ herdr.sock │
└─────────────────┘ encrypted, NAT └────────────────────────────────┘
traversal
- The
herdr-tailcatddaemon (Go, built on the tailcat library) serves a single virtual port, 6464, inside the tunnel and byte-forwards every connection to the local herdr unix socket (the herdr protocol is newline-delimited JSON-RPC, so plain byte proxying is all it takes). - tailcat's packet filter is tightened to port 6464 only — the tunnel cannot reach anything else on the machine.
- The token carries a WireGuard pre-shared key (post-quantum confidentiality, and a DERP relay operator can't join the tunnel even if it observes the handshake).
# local development
herdr plugin link /path/to/herdr_tc
sh scripts/build.sh # `link` does not run build commands
# or from GitHub once published
herdr plugin install <owner>/<repo>Once enabled, herdr runs the [[startup]] hook on every server start (and
after a live handoff), which launches the daemon; it is idempotent when an
instance is already running.
herdr plugin action invoke herdr.tailcat.token # show token + client instructions
herdr plugin action invoke herdr.tailcat.restart # restart the exposure
herdr plugin action invoke herdr.tailcat.stop # stop; the token dies immediately
herdr plugin log list --plugin herdr.tailcat # hook execution logsOne-off session (stdin/stdout is the herdr socket byte stream):
printf '{"id":"1","method":"plugin.list","params":{}}\n' | tailcat <token> 6464Persistent local bridge for clients that expect a unix socket (e.g. herdrm):
socat UNIX-LISTEN:/tmp/herdr-remote.sock,fork EXEC:'tailcat <token> 6464'
# then point the client at /tmp/herdr-remote.sockClients need tailcat v0.6.0 or newer (the address format gained a disco key and pre-shared key in v0.6.0).
The token is derived from the server identity: same key, same token. The daemon guarantees this:
- The key is generated exactly once, stored as
server.private.json(mode 0600) in the plugin state dir, and loaded on every subsequent start — herdr restarts, live handoffs, and daemon crashes all keep the token. - The DERP region is probed once at first run and baked into the key file; restarts never re-probe (re-probing could change the region, which would change the token).
- To pin the identity permanently (surviving even a plugin reinstall or
a wiped state dir): copy
server.private.jsoninto the plugin config dir (herdr plugin config-dir herdr.tailcat). A key in the config dir takes precedence over the state dir and is never overwritten. A key file fromtailcat genkeyworks too (a missing region is resolved and written back). - To rotate: delete the key file(s) in both dirs and restart — a fresh identity and token are generated.
- The short token references a region ID in tailcat's public DERP map; if an
upstream map change ever breaks it, use
token.full(embeds the relay info, immune to map changes) or regenerate the key.
herdr's plugin model has no sandbox, and the socket this plugin exposes grants full control of the herdr server (send keystrokes to any pane, start agents, call every API). Treat this like putting a shell on the network:
- The token is a credential. Anyone holding it can connect. Token files are stored mode 0600 in the plugin state dir; never paste them in public.
- Use the client allow-list. Create
allow.listin the plugin config dir (herdr plugin config-dir herdr.tailcat) with one clientnodekey:...per line (clients generate one withtailcat genkey --client), then restart. Non-matching clients are silently dropped at the WireGuard handshake — they can't even learn the service exists. stopthe exposure when you don't need it; afterherdr plugin unlink herdr.tailcat, make sure the daemon is stopped.- Transport is always WireGuard end-to-end encrypted with a pre-shared key; DERP relays only ever see ciphertext.
herdr-plugin.toml manifest (startup hook + token/stop/restart actions)
cmd/herdr-tailcatd/ the daemon (Go + tailcat library v0.6.0)
scripts/build.sh go build → bin/herdr-tailcatd
scripts/start.sh idempotent start (startup hook)
scripts/stop.sh stop
scripts/restart.sh restart
scripts/token.sh print token and client instructions
sh scripts/build.sh # build
HERDR_SOCKET_PATH=~/.config/herdr/herdr.sock \
HERDR_PLUGIN_STATE_DIR=.state \
./bin/herdr-tailcatd # run in foreground for debuggingRequires Go ≥ 1.27.1 (inherited from tailcat v0.6.0); older Go toolchains with toolchain auto-download enabled work too.