尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
在專案資料夾中執行 /nomorevibe verify,即可驗證所有權並自行管理介紹。
一分鐘完成驗證Web-based terminal for safe Kubernetes debugging - Designed for Devs, not Ops. RBAC, audit logs, auto-sweep.
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗Web-based debug terminal for Kubernetes. Pick a pod, inject an ephemeral
container with the image you want (busybox, netshoot, psql, …),
attach to it from your browser. Pluggable authN (JWT/OIDC) and authZ
(OPA) so developers reach pods without kubectl, and without the cluster
having to know their corporate identity.
Click the still for the live demo on porthole.runlocal.dev.
Smallest possible install — no auth, no policy. Port-forward and drive the UI immediately.
helm install porthole oci://ghcr.io/bcollard/charts/porthole \
--version 0.2.0 \
--namespace porthole --create-namespace \
--set auth.disabled=true
kubectl -n porthole port-forward svc/porthole 8081:8081 &
open http://localhost:8081/ui/
auth.disabled=true stamps every request as a local-dev principal
and grants admin everywhere. Anything beyond a kubectl port-forward demo needs the OIDC layer below.
The browser can't speak OIDC to porthole on its own; something on the request path has to terminate the handshake and inject the user's id-token into the request headers. Porthole then validates the JWT against the IdP's JWKS and reads the user claims off it.
Reference stack: Envoy Gateway + its SecurityPolicy CR. The
chart renders a generic HTTPRoute; you attach a SecurityPolicy
to it that does the OIDC handshake. Worked recipe in
docs/examples/envoy-gateway/ —
a values.yaml for helm install plus the SecurityPolicy you
apply separately.
The chart handles the awkward bits:
auth.idTokenHeader defaults
to X-ID-Token (Envoy Gateway's forwardIDToken). Point it at
Authorization (with auth.idTokenHeaderPrefix: "Bearer ") when
you'd rather rely on forwardAccessToken. The canonical
Authorization: Bearer fallback is always tried, so
forwardAccessToken: true works with zero extra config.gatewayAPI.pathPrefix=/porthole lets
porthole share a hostname with other apps behind one platform
gateway (api.example.com/porthole). The chart emits a 308 for
the missing trailing slash and a URLRewrite that strips the
prefix; the SPA infers the public prefix from
window.location.pathname at boot. Same image works at root or
under any prefix.For the OIDC handshake itself, see the Envoy Gateway docs: Envoy Gateway SecurityPolicy / OIDC.
Every handler asks the OPA sidecar for a yes/no decision before touching the kube API. The chart bundles OPA as a sidecar; policy + data live in a ConfigMap you can override at install time.
OPA input — pkg/auth/opa.go builds the input on every
request: user claims (sub/email/groups), the requested action,
namespace, namespace labels (fetched lazily, cached 60 s), and
the current timestamp.
Rego logic — policy/porthole.rego carries the matchers:
glob + labels + business-hours, AND-composed, default-deny. Plus
an effective_bindings rule the SPA queries on /api/me so the
topbar can render the user's role chips.
Action vocabulary — fixed set the handlers ask OPA for:
| Action | Triggered by |
|---|---|
list_namespaces | the namespace picker (cluster-wide) |
list_pods | the pod picker, Service Viewer |
list_ec | the EC chip bar refresh |
inject_ec | clicking + Debugger |
attach_ec | opening a WebSocket terminal, extending TTL |
terminate_ec | clicking ×, "Clean up all", or the sweeper |
policy/data.jsonTwo tables: roles (bundle actions) and bindings (group → role → namespace scope). Override via chart values; OPA hot-reloads without a pod restart.
helm upgrade porthole oci://ghcr.io/bcollard/charts/porthole \
--reuse-values \
--set-file opa.data=./my-bindings.json
{
"policy": {
"roles": {
"viewer": ["list_namespaces", "list_pods", "list_ec"],
"debugger": ["list_namespaces", "list_pods", "list_ec",
"inject_ec", "attach_ec", "terminate_ec"]
},
"bindings": [
{ "group": "porthole-admins", "role": "debugger", "namespace_glob": "*" },
{ "group": "team-a", "role": "debugger", "namespace_glob": "team-a-*" },
{ "group": "secops", "role": "debugger", "namespace_labels": { "tier": "production" } },
{ "group": "oncall", "role": "debugger", "namespace_glob": "*", "business_hours": true }
]
}
}
A binding always carries group + role + one or more matchers:
| Matcher | Behavior |
|---|---|
namespace_glob | Shell-style glob over the namespace name. * is cluster-wide. Required to grant cluster-wide actions (list_namespaces) — a label-only binding cannot grant them. |
namespace_labels | All key: value pairs must equal labels on the namespace. |
business_hours | When true, only matches Mon-Fri 09:00–17:00 UTC. |
Matchers on the same binding compose with AND. Multiple bindings compose with OR. Default is deny. Sanity-check locally:
make opa-eval # 15 case Rego suite, no cluster required
| Value | Default | What it does |
|---|---|---|
image.repository | ghcr.io/bcollard/porthole | Porthole image. |
image.tag | (unset) | Defaults to Chart.AppVersion. |
replicas | 1 | Replica count. |
auth.disabled | false | Stamp local-dev on every request, skip JWT validation. Local dev only. |
auth.jwksURL | "" | IdP JWKS endpoint. Required when auth.disabled is false. |
auth.issuer | "" | Expected iss claim. Empty disables the check. |
auth.audience | "" | Expected aud claim. Empty disables the check. |
auth.idTokenHeader | "" | Request header read first for the id-token. Empty → X-ID-Token. |
auth.idTokenHeaderPrefix | "" | Prefix to trim from auth.idTokenHeader. Set to "Bearer " when pointing at Authorization. |
opa.enabled | true | Run the OPA sidecar. |
opa.url | http://localhost:8181/v1/data/porthole/authz/decision | Decision endpoint. |
opa.policy | (inline default) | Rego policy — override with --set-file opa.policy=…. |
opa.data | (inline default) | Roles + bindings JSON — override with --set-file opa.data=…. |
wsAllowedOrigins | "" | Comma-separated Origin allowlist for the /term WebSocket. CSWSH defence — required behind a gateway. |
Full schema with comments: helm-chart/porthole/values.yaml.
One structured slog JSON line on stdout per security-relevant
action — every inject, attach-deny, and cleanup. Shaped to the
Elastic Common Schema
(v8.11) so it ingests into Elastic, Loki, Splunk, anything that
keys on event.action / event.outcome / user.id /
kubernetes.namespace with no custom parser.
A denied inject looks like this — event.type: denied,
event.outcome: failure, and the OPA decision text in
event.reason:
{
"@timestamp": "2026-06-07T10:53:45Z",
"log.level": "WARN",
"message": "inject",
"ecs.version": "8.11",
"event": {
"kind": "event",
"category": ["iam"],
"action": "inject_ec",
"type": "denied",
"outcome": "failure",
"dataset": "porthole.audit",
"provider": "porthole",
"duration": 12387251,
"reason": "matched: group=junior-devs role=debugger ns=dev-checkout — outside business hours"
},
"user": { "id": "[email protected]" },
"source": { "ip": "10.0.1.5" },
"kubernetes": { "namespace": "dev-checkout",
"pod": { "name": "api-7d4b9c5f-mznpr" } },
"container": { "image": { "name": "nicolaka/netshoot" } }
}
Successful path: event.type: creation (inject) / deletion
(cleanup), event.outcome: success. Internal errors collapse into
event.outcome: failure, event.type: error, with the error text
on error.message. Per-byte attach traffic is intentionally not
audited — the start of a session shows in gin's access log, and an
authZ-deny on attach lands here as attach_ec / denied.
Implementation: pkg/audit/audit.go. The
canonical shape per event type lives in
pkg/audit/audit_smoke_test.go —
go test -v ./pkg/audit/ pretty-prints one of each.
Three SVGs, each at a different zoom level:
docs/architecture.svg — system
layout: browser → Envoy Gateway (+ OIDC) → Porthole →
kube-apiserver → kubelet → ephemeral container.docs/traffic-flow.svg — byte paths
through an attach session: stdout / stdin / resize travel three
distinct chains across the WebSocket, the k8s executor, kubelet,
and the PTY.docs/sequence.svg — page load →
discovery → inject → attach → live session → close.go build ./... # binary, sanity check
AUTH_DISABLED=true go run . # uses your current kubectl context
open http://localhost:8081/ui/
make opa-eval # 15-case Rego sanity check
helm lint helm-chart/porthole
The SPA at pkg/web/dist/ is embedded into the Go binary via
go:embed. Edit, then go build to re-embed — no separate frontend
build step.
ecSweepTTL | "" | Auto-terminate porthole-injected ECs older than this duration (e.g. 30m). Off by default. |
logoutPath | /logout | Gateway's logout path; the SPA prepends gatewayAPI.pathPrefix. |
gatewayAPI.enabled | false | Render an HTTPRoute (and optional Gateway) for Gateway API. |
gatewayAPI.hostnames | [porthole.example.com] | HTTPRoute.hostnames. |
gatewayAPI.pathPrefix | / | Public sub-path; e.g. /porthole. |
gatewayAPI.gateway.create | false | Also render a dedicated Gateway alongside the HTTPRoute. |
ingress.enabled | false | Render a standard Ingress instead of Gateway API resources. |