Hardening the deployment
Last updated: 2026-11-27T14:16:11-03:00 (UTC-3)
Security and trust · Operations · Deployment modes · Network
How to install m7gtw with the smallest attack surface. The first part is what the manifests already provide and the gate checks; the second is what depends on the operator.
What already comes hardened
Section titled “What already comes hardened”| Component | User | File system | Other |
|---|---|---|---|
| Gateway (image) | Distroless nonroot (65532), declared in the Dockerfile |
Read-only | No shell or package manager; Go with a pinned patch version |
| Gateway (Kubernetes and Helm) | runAsNonRoot |
readOnlyRootFilesystem |
seccomp: RuntimeDefault, no privilege escalation, all capabilities dropped |
| OpenTelemetry Collector | runAsNonRoot |
Read-only | Same |
Bundled PostgreSQL (deploy/datastore, Helm database.bundled) |
70 (postgres) |
Read-only, with writable data, socket and temp | Same |
Prometheus and Grafana (deploy/observability) |
65534 and 472 | Read-only, with writable data and temp | Same |
Swagger UI no longer runs as a separate Pod: the gateway itself serves it at /docs/swagger/ (ADR 0167). This removes a container that ran as root.
How it is checked: the release gate runs trivy config on the Dockerfile, Kustomize, Helm and Terraform, and fails on any finding of medium severity or higher (secure development). The accepted exceptions live in .trivyignore.yaml, each with its reason. On 2026-10-27, the hardened manifests were applied on minikube:
- all five components came up;
- the gateway responded at
/health/ready,/ui/,/docs/and/docs/swagger/; - Prometheus scraped the gateway and Grafana became healthy;
- the effective users were checked inside the Pods.
What is up to the operator
Section titled “What is up to the operator”- TLS at the edge: expose the gateway only through an ingress or load balancer with HTTPS, and leave
admin.allow_insecure_http: false(the example usestrueonly for local port-forward). With that, the console cookie is sent withSecure. - Egress control: a NetworkPolicy, or an egress firewall, that lets the gateway talk only to the configured providers, vaults and destinations and to PostgreSQL. The Kustomize manifests include none, and the Helm chart’s optional
networkPolicyleaves egress open unless you turn onnetworkPolicy.egress.enabledand list the destinations innetworkPolicy.egress.extraRules, because the list is specific to each operator (operations). The gateway already refuses special internal addresses in MCP and webhook calls (network). - Keep
/metrics, Prometheus, Grafana and the Collector internal:/metricsexposes alias names, providers and volumes. Do not publish these addresses on the ingress. - Secrets outside the YAML: keys through a Secret, a file (
<NAME>_FILE) or a vault. The YAML only references variable names. Keep the providers key alongside the database backup, but in a different place (continuity). - Bootstrap token: generate it with
gateway keygen, store only the SHA-256 in the Secret, and prefer named users or SSO for day-to-day work (access control). Once they exist, setadmin.token_login: falseso the shared token no longer opens the console, and leaveadmin.token_bearer: falseunless automation needs the token as a Bearer credential on the admin API (console). Repeated wrong tokens lock the client address out of token sign-in (admin.login_lockout, on by default); behind a shared proxy that lockout reaches everyone using it, so read its trade-off (console). - PostgreSQL: a user dedicated to the gateway, TLS (
sslmode=verify-fullon a managed database), backup with PITR and, for sensitive data, disk encryption, since part of the content is stored in plain text (data inventory). - Images: use a trusted registry, with an admission policy. Pin the gateway image by digest (
image.digestin Helm). - Flags: turn on only the features you use. Each one widens what the gateway does, and none grants permission on its own.
- Alerts: configure at least budget and guardrail-block alerts to a channel someone reads (alerts).
Limits
Section titled “Limits”- The Kustomize manifests include no NetworkPolicy and no ingress rules: these depend on each operator’s network. The Helm chart renders optional ones (
networkPolicy,ingress), off by default. - The Pods run as the namespace’s default ServiceAccount unless you set
serviceAccountin the chart. The gateway never calls the Kubernetes API:serviceAccount.automountServiceAccountToken: falseremoves that token from its Pods (operations). - The bundled PostgreSQL (
deploy/datastore, the chart’sdatabase.bundled) is one unreplicated instance on a PVC, with no backup of its own. In production, prefer a managed database, or add replication and backups.