15 KiB
Enterprise Readiness Design and Implementation Plan
Goal Description
Archie is moving into a single static binary (cmd/archie) backed by PostgreSQL. Several core governance controls already exist. These include pre-action Cedar judgement, earned autonomy, and fresh WebAuthn passkey checks for irreversible actions. They also include Ed25519-signed extension catalogues, Linux namespace egress confinement, a DDL/DML database role split, and an external deletion ledger that survives database restores.
This plan sets out the locked architecture and phased work to deploy cmd/archie in regulated enterprise environments. It targets finance, healthcare, government, and critical infrastructure aligned with SOC 2 Type II, ISO 27001, SOX ITGC, PCI-DSS, and APRA CPS 234. It covers multi-stage containerised environments across dev, staging, and prod.
All work targets the single-binary architecture (cmd/archie, internal/app/archie, modules/*, and internal/platform/*), not the legacy six-service stack.
Locked Decisions
These architectural choices are locked in for Enterprise v1 and Enterprise v2:
- Hard isolation per Archie stage (
dev,staging, andprod): Each stage runs its own Archie instance. It keeps its own Postgres database, sealing key, OIDC client, egress allow-list, and approval log. Earned autonomy in Staging never carries over to Production. One Production instance can still manage non-prod and prod servers using CMDB facts and Cedar rules. - Orchestrator priority: Kubernetes and Helm first, with hardened Docker Compose secondary.
- Extension confinement in strict Kubernetes: Ship static remote gRPC+mTLS extension endpoints in v1 (never SSH), passing Kubernetes
restrictedPod Security Standards andNetworkPolicy, alongside existingCLONE_NEWUSERconfinement for Compose and VMs. - Cryptography and secret offloading: Keep
age, addarchie rekey, and ship a Vault/OpenBao secret engine extension in v1 so target credentials stay in the enterprise secret manager. Do not bundle cloud KMS SDKs. Defer FIPS 140-3 stdlib AES-256-GCM sealing (GOFIPS140) to v2. - Control-plane mutability and promotion: Keep the dashboard as the complete control plane, and add versioned promotion bundles (
archie bundle export,diff, andapply) for peer-reviewed promotion across stages. - Identity and approvals: Ship OIDC confidential client, group-to-role claim mapping, SSO-only mode, session timeouts, four-eyes Segregation of Duties (
initiator != approver), and ITSMChangeRequestswiring in v1. Defer SCIM 2.0 and N-of-M quorum to v2. - Audit and telemetry: Ship an append-only
audittable (INSERTandSELECTonly forarchie_app), structured JSON audit logs to stdout, and a unified audit export API. Customer log collectors handle SIEM shipping, WORM retention, and Legal Hold. Also ship OTel tracing with trace-ID logs, internal/metrics, and gracefulSIGTERMdrain in v1. Defer cryptographic hash-chaining to v2. - High availability: Ship Active-Passive (one active replica plus HA PostgreSQL) in v1. Document Active-Active HA (
LISTEN/NOTIFYhub, Postgres lease leader election for pollers, and shared WORM deletion ledger) in v2 so requirements are preserved.
Target Architecture
Multi-Stage Regulated Deployment Topology
flowchart LR
subgraph CI["Release and Supply Chain (Signed OCI + SBOM)"]
IMG["archie OCI image\n(digest-pinned, cosign)"]
CAT["Internal Extension Catalogue\n(Ed25519-signed, OCI mirror)"]
BND["Promotion Bundle\n(workflows, Cedar, guards, pins)"]
end
subgraph DEV["Dev Stage (Isolated)"]
D_ARC["archie (dev)"]
D_DB[("PostgreSQL (dev)")]
D_SEC["Vault / OpenBao (dev)"]
D_ARC --> D_DB
D_ARC --> D_SEC
end
subgraph STG["Staging Stage (Isolated)"]
S_ARC["archie (staging)"]
S_DB[("PostgreSQL (staging)")]
S_SEC["Vault / OpenBao (staging)"]
S_ARC --> S_DB
S_ARC --> S_SEC
end
subgraph PRD["Production Stage (Regulated)"]
P_MIG["Pre-upgrade Job:\narchie migrate (owner_url)"]
P_ARC["archie (prod)\n(runtime url only)"]
P_DB[("HA PostgreSQL\nTLS verify-full")]
P_SEC["Vault / OpenBao (prod)"]
P_LOG["Customer Log Collector\n(Stdout JSON -> SIEM / WORM)"]
P_ITSM["ITSM Change Control\n(ServiceNow / Jira)"]
P_MIG --> P_DB
P_ARC --> P_DB
P_ARC --> P_SEC
P_ARC --> P_LOG
P_ARC --> P_ITSM
end
IMG -->|GitOps PR| DEV
IMG -->|Verified digest| STG
IMG -->|Approved CR| PRD
CAT --> DEV & STG & PRD
BND -->|Export + Diff| STG
BND -->|Peer Review + Approval Gate| PRD
Production Pod and Network Boundary
flowchart TD
EXT_SRC["External Alert/Webhook Sources"] -->|TLS + HMAC| EDGE_ING["Perimeter Webhook Ingress\n(/webhooks/* only)"]
OPS["Operators / Approvers"] -->|Corporate VPN / SSO| INT_ING["Internal Ingress\n(Dashboard + /api/* + OIDC)"]
subgraph NS["Kubernetes Namespace: archie-prod"]
EDGE_ING --> POD["archie Pod (nonroot UID 65532, RO root filesystem)"]
INT_ING --> POD
POD -->|Unix socket or remote mTLS gRPC| EXT["Isolated Extensions\n(Allow-list Egress / NetworkPolicy)"]
EXT -->|Chained via corporate proxy| PROXY["Corporate Egress Proxy / DLP"]
POD -->|TLS verify-full, DML role only| PG[("Managed HA Postgres")]
POD -->|RWO PVC| STATE[("state_dir / Deletion Ledger")]
end
Enterprise v1 (Build Now)
Enterprise v1 delivers a lean, auditable, Active-Passive containerised deployment across six tracks.
Track 1: Container Packaging, Bootstrap, and Least-Privilege Runtime
[NEW] Dockerfile.archie
- Build
ui/distwith Node 24 (pnpm run build) and staticcmd/archiewith Go 1.27 (CGO_ENABLED=0 -trimpath). - Ship on
gcr.io/distroless/static-debian12:nonroot(UID65532) with OCI labels and read-only root filesystem compatibility. - Support enterprise CA bundles via
SSL_CERT_FILE.
[MODIFY] cmd/archie/main.go and internal/app/archie/run.go
- Add
archie migrate [-config ...]to acquire the migration lock, run Goose migrations and runtime DML grants viaowner_url, and exit0for a KubernetesJobor Helm pre-upgrade hook. - Add
archie bootstrap [-config ...] [-spec path]for idempotent headless first-boot setup (org, workspace, public URL, OIDC provider, and initial owner or break-glass identity).
[MODIFY] internal/app/archie/config.go and internal/platform/pg/pg.go
- Support env and
*_FILEoverrides for bootstrap secrets (ARCHIE_DATABASE_URL,ARCHIE_DATABASE_OWNER_URL,ARCHIE_AGE_IDENTITY,ARCHIE_ADMIN_TOKEN_SHA256, and*_FILEvariants) soconfig.tomlstays non-secret and read-only. - Allow serving without
database.owner_url. In DML-only mode,pg.VerifySchemachecks that all embedded migrations are applied and fails closed on lag. - Grant
SELECTonpublic.goose_db_versionto the runtime role inpg.grantRuntime. - Remove runtime writes to
config.toml(WriteAdminHashin running servers) and add configurableshutdown_grace(default30s) plus[catalogue]overrides for air-gapped stages.
[MODIFY] internal/platform/health/health.go and internal/app/archie/gate.go
- Separate
/healthz(liveness),/startupz(DB reachable, schema verified, and deletion ledger ready), and/readyz(readiness, returning503onSIGTERMdrain).
[MODIFY] modules/connectors/internal/egress/tunnel.go and modules/connectors/internal/host/host.go
- Chain allowed egress hosts through
HTTPS_PROXY(respectingNO_PROXY) after enforcing Archie's allow-list and loopback/SSRF checks. - Propagate
SSL_CERT_FILEandSSL_CERT_DIRinto confined extensions so internal PKI works with full TLS checks.
Track 2: Kubernetes Extension Isolation and Supply Chain
[NEW] modules/connectors/internal/host/remote.go
- Add a
Runtimeabstraction supportingLocalNamespaceRuntime(existingCLONE_NEWUSER | CLONE_NEWNETfor Compose/VMs) andRemoteGRPCRuntime(static gRPC+mTLS endpoints for sidecar or dedicated extension Pods running under KubernetesrestrictedPSS andNetworkPolicy). Fail closed if neither is available.
[NEW] Air-Gapped Catalogue and Supply Chain (modules/connectors/internal/catalogue/)
- Support OCI registry authentication for internal extension mirrors.
- Emit SPDX/CycloneDX SBOMs, SLSA provenance, and cosign signatures in CI for
archieimages and extensions, plusarchie catalogue mirrorfor air-gapped transfer.
Track 3: Key Rotation and Enterprise Secret Offloading
[NEW] internal/app/archie/rekey.go (archie rekey)
- Rotate
ageidentities acrossconnectorscredentials andeventswebhook secrets in transactional batches under an advisory lock, checking decryption before commit and logging an audit event.
[NEW] Vault and OpenBao Secret Engine Extension
- Offload target infrastructure credentials to the customer's secret manager using Archie's existing
secretengine/v1contract.
Track 4: Enterprise Identity, Approvals, and Segregation of Duties
[MODIFY] modules/governance/oidc.go and modules/governance/accounts_api.go
- Add confidential OIDC client auth (
client_secretandprivate_key_jwt), group-to-role claim mapping synced on sign-in, SSO-only mode with audited break-glass alerting, idle/max session lifetimes, and OIDC back-channel logout (POST /oauth2/backchannel-logout).
[MODIFY] modules/approvals/approvals.go and internal/app/archie/run.go
- Segregation of Duties (SoD): Persist
InitiatorIDon approval requests and reject self-approval (answerer.ID == req.InitiatorID) when SoD applies. - ITSM Change Requests: Wire
allow.UseChangeRequests(...)ininternal/app/archie/run.goto a ServiceNow or Jira Service Management extension driven byjudgement.KindChangeRequestrules.
Track 5: Audit Stream, OpenTelemetry, and Prometheus Metrics
[NEW] modules/audit/ (Append-Only Audit Table and Unified Export)
- Create an append-only
audit.eventstable wherearchie_appholds onlySELECTandINSERTprivileges. - Emit every audit record as structured JSON to stdout so the customer's log collector (Fluent Bit, Vector, OTel Collector, or Splunk Forwarder) routes it to SIEM and WORM retention.
- Serve a unified Cedar-gated export API (
GET /api/audit/eventsandPOST /api/audit/exports).
[MODIFY] internal/app/archie/run.go and internal/app/archie/api.go
- Wire
otelhttpand OTLP trace export (OTEL_EXPORTER_OTLP_ENDPOINT), spans around runs, steps, LLM calls, judgements, and extensions, plus aslog.Handlerinjectingtrace_idandspan_id. - Serve Prometheus
/metricson an internal-only port and drain active HTTP requests and run checkpoints onSIGTERMup toshutdown_grace.
Track 6: Multi-Stage Promotion and Helm Deployment Kit
[NEW] internal/app/archie/bundle.go (archie bundle)
- Separate portable definitions (
bundle.yaml: workflows, Cedar policies, judgement rules, action types, event schemas, and extension digest pins) from stage-local bindings (bindings.<env>.yaml: credentials, OIDC client, public URL, target hosts, schedules, channels, and per-stage autonomy ceilings). - Provide
archie bundle export,diff, andapply(transactional, runsRecheckConnector, preserves earned autonomy counts, and supports a Prod approval gate).
[NEW] deployments/helm/archie/ and Hardened Compose
- Ship a Helm chart with
values-{dev,staging,prod}.yamloverlays:StatefulSet(Active-Passive, 1 replica + RWO PVC),Jobpre-upgrade hook (archie migrate), split Ingress (perimeter/webhooks/*vs internal Dashboard/API), default-denyNetworkPolicy,ExternalSecretexamples,ServiceMonitor, and hardened Compose overlay. - Document Postgres pool settings (requiring PgBouncer session pooling for
ClaimServe) and independent backup/restore of Postgres, recovery keys, and the deletion ledger.
Enterprise v2 (Documented for Demand)
These items are deferred from v1 so engineering effort stays focused, while interfaces avoid locking them out:
- Active-Active HA: Back
hub.Hub(internal/platform/hub/hub.go) with PostgreSQLLISTEN/NOTIFY, add PostgreSQL lease-based leader election for polling sources and channel listeners, and add an S3/GCS Object Lock store fordeletions.Store(internal/platform/deletions/deletions.go). - FIPS 140-3 Sealing Profile: Add a stdlib AES-256-GCM
seal.Sealercompiled withGOFIPS140=v1.0.0, reading the master key from an External Secrets / CSI KMS mount. - SCIM 2.0 Lifecycle: Add
/scim/v2/Usersand/scim/v2/Groupsfor automated IdP provisioning and instant offboarding. - N-of-M Approval Quorum: Add
approvals.votesrequiring multiple distinct approvers for high-risk production actions. - Cryptographic Audit Hash Chain and Multi-Org Tenancy: Add per-org
prev_hash/entry_hashchaining onaudit.eventsand replace single-org routing (const orgID = "default") when multi-BU tenancy in one instance is needed.
Verification Plan
Automated Tests (task check)
All changes must pass task check (go test -short, golangci-lint, gosec, generated OpenAPI/SQL checks). Add boundary tests per track:
- Track 1:
go test -short ./internal/app/archie/... ./internal/platform/pg/... ./internal/platform/health/... ./modules/connectors/internal/...tests schema checks,*_FILEsecret loading,/startupzvs/readyz,HTTPS_PROXYallow-lists, and CA env forwarding. - Track 2:
go test -short ./modules/connectors/internal/host/...testsRemoteGRPCRuntimemTLS checks and fail-closed startup. - Track 3:
go test -short ./internal/app/archie/...tests atomicarchie rekeyrollback on failure. - Track 4:
go test -short ./modules/governance/... ./modules/approvals/...tests confidential OIDC, group claim mapping, SSO-only refusal, and SoD self-approval refusal. - Track 5:
go test -short ./modules/audit/... ./internal/app/archie/...tests runtimeUPDATE/DELETErefusal onaudit.events, trace-ID log injection, andSIGTERMdrain. - Track 6:
go test -short ./internal/app/archie/... ./modules/runs/...tests thatarchie bundle applykeeps earned autonomy and stage credentials.
Manual and Container Verification
- Container and Kubernetes hardening: Build
Dockerfile.archie, scan with Trivy or Grype (0 critical or high CVEs), and verify UID65532with--read-onlyroot filesystem. Deploy the Helm chart tokindork3sunderrestrictedPSS, checkingarchie migrateJob vs DML-only Pod. - Proxy and air-gapped drill: Run on a zero-internet network behind an HTTP proxy and private CA, verifying OIDC login, private OCI extension install, and egress allow-lists.
- Promotion and SoD drill: Export bundle from
staging, rundiffandapplytoprod, and confirm credentials and autonomy ceilings stay intact. Check self-approval rejection, ITSM CR creation, and stdout audit JSON output. - DR restore drill: Delete a memory note, restore Postgres from a pre-deletion snapshot, boot
archie, and confirm the note remains deleted via the deletion ledger.