mars: bearer-gated tailnet door to Honcho on :8099 (Caddy), limited to luna's workspace; Honcho itself stays on loopback with auth off, so Hermes and honcho-console are unchanged. terra: config for the claude-honcho plugin (installed via /plugin) plus a SessionStart hook that adds luna as an observer of each Claude session, so Hermes' directional recall sees what is learned here. HONCHO_* env in settings.json pins the server: the plugin's config migration otherwise drops baseUrl and falls back to Plastic Labs' cloud. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
46 lines
1.5 KiB
Nix
46 lines
1.5 KiB
Nix
{ config, ... }:
|
|
|
|
# Tailnet door to luna's Honcho (honcho.nix) for Claude Code on terra
|
|
# (hosts/terra/claude-honcho.nix). Honcho itself stays on loopback with auth
|
|
# off, so Hermes and honcho-console need no key; this bearer token is the only
|
|
# credential, and it reaches luna's workspace only. 8099 stays closed in the
|
|
# firewall: tailscale0 only, like honcho-console.
|
|
let
|
|
port = 8099;
|
|
in
|
|
{
|
|
imports = [ ../../services/network/caddy.nix ];
|
|
|
|
# Fails closed: an unset token must not turn "Bearer " into the password.
|
|
services.caddy.virtualHosts.":${toString port}".extraConfig = ''
|
|
@allowed {
|
|
expression `{env.HONCHO_GATE_TOKEN} != "" && {http.request.header.Authorization} == "Bearer " + {env.HONCHO_GATE_TOKEN}`
|
|
path /v3/workspaces /v3/workspaces/luna/*
|
|
not path /v3/workspaces/luna/webhooks*
|
|
}
|
|
# Workspace get-or-create only; listing, keys and other workspaces stay out.
|
|
@workspaceCreate {
|
|
path /v3/workspaces
|
|
not method POST
|
|
}
|
|
handle @workspaceCreate {
|
|
respond 403
|
|
}
|
|
handle @allowed {
|
|
reverse_proxy 127.0.0.1:8000
|
|
}
|
|
handle {
|
|
respond 403
|
|
}
|
|
'';
|
|
|
|
services.caddy.environmentFile = config.sops.templates."honcho-gate.env".path;
|
|
|
|
# Same value in secrets/terra.yaml, where the Claude Code plugin sends it.
|
|
sops.secrets.honcho_gate_token.restartUnits = [ "caddy.service" ];
|
|
sops.templates."honcho-gate.env" = {
|
|
content = "HONCHO_GATE_TOKEN=${config.sops.placeholder.honcho_gate_token}\n";
|
|
restartUnits = [ "caddy.service" ];
|
|
};
|
|
}
|