reference deployersecurity-reviewer

Ports and Service Exposure

OpenGov containers publish zero host ports in production (docker-compose.yml). A TLS-terminating reverse proxy routes public hostnames to internal service ports.

Compose Services and Internal Ports

ServiceInternal Ports / ExposeHost PortsNetwork ModeNotes
postgresNoneNone (0)Default composeInternal PostgreSQL 18 (max_connections=150).
init-keycloakNoneNone (0)Default composeOne-shot Keycloak realm and SMTP bootstrap.
opengov8000None (0)Default composeFastAPI app + 5 SPAs (:8000); unexposed internal metrics on :9100.
workerNoneNone (0)Default composeProcrastinate background worker; unexposed internal metrics on :9100.
sentinelNoneNone (0)Default composeEgress-only deployment watchdog; zero listening ports.
errorpageNoneNone (0)Default composeLegacy in-stack fallback page (:8099); superseded by host systemd unit.
oidc8080None (0)Default composeKeycloak (:8080); internal health/metrics on :9000; /admin refused publicly.
clamavNoneNone (0)noneClamAV daemon; network isolated (none), reads Unix socket /run/clamd/clamd.sock.
freshclamNoneNone (0)bridgeVirus signature updater; bridge network for signature downloads only.

Host-Based Subdomain Routing (spa_router.py + artifact.py)

Subdomain LabelTargetDev PortEnvironment Variable
smartrules.<base>SPA editor:3000OPENGOV_EDITOR_URL
approval.<base>SPA approval:3001OPENGOV_APPROVAL_URL
applicant.<base>SPA portal:3002OPENGOV_PORTAL_URL
smartlink.<base>SPA smartlink-admin:3003OPENGOV_SMARTLINK_URL
studio.<base>SPA studio:3004OPENGOV_STUDIO_URL
login.<base>Keycloak (oidc:8080):8080OPENGOV_OIDC_ISSUER
mcp.<base>Embedded MCP door (/mcp, no SPA):8000OPENGOV_MCP_PUBLIC_URL

Backend Passthrough Prefixes (PASSTHROUGH_PREFIXES)

The host-based SPA router passes these prefixes directly to FastAPI instead of serving index.html:

  • /api
  • /health
  • /version
  • /config.json
  • /mcp
  • /.well-known
  • /mesh
  • /docs (disabled by default; requires OPENGOV_API_DOCS_ENABLED=true)
  • /redoc (disabled by default; requires OPENGOV_API_DOCS_ENABLED=true)
  • /openapi.json (disabled by default; requires OPENGOV_API_DOCS_ENABLED=true)
  • /metrics is deliberately excluded and served only on the internal :9100 listener.

Login Reverse-Proxy Security Controls

oidc declares Traefik labels in docker-compose.yml to enforce:

  • HTTP-to-HTTPS redirect on login.<base>.
  • Public 403 refusal on /admin paths (ipallowlist.sourcerange=127.0.0.1/32).
  • Per-peer and aggregate rate limits on /realms/opengov-applicants/ auth, registration, and recovery.