Skip to content

[2/2] Add standalone SCEP gateway, Compose deployment and image workflow - #19

Merged
oriolrius merged 5 commits into
oriolrius:mainfrom
tilwegener:feat/scep-gateway-only
Oct 23, 2026
Merged

oriolrius merged 5 commits into
oriolrius:mainfrom
tilwegener:feat/scep-gateway-only

Conversation

@tilwegener

@tilwegener tilwegener commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Add the optional RSA SCEP gateway, shared/Intune/webhook authorization, Compose templates, protocol documentation and image workflow. Existing installations reuse the backend and add one gateway container.

Depends on #18. This branch is now stacked on the updated #18, rebased on current upstream main (213167c, including #20). Its branch history therefore includes the foundation until #18 is merged. Deployment/KMS Compose conflicts are resolved, retaining both runbook blocks.

Review 5620708940 — #19 corrections

  1. Each request takes an immutable RA/chain snapshot under a short read lock. Remote calls and state-file writes do not hold the RA lock. RA signer/decrypter calls receive the HTTP request context; cancellation propagates. Shared CSR coordination remains separate.
  2. A failed startup renewal logs a warning and retains the current RA when it still validates, allowing hourly retries. Expired/invalid RAs still fail closed. Automatic provisioning calls the idempotent provision endpoint directly, allowing expired incomplete leases to recover instead of getting stuck behind state=409.
  3. GetCACaps/GetCACert use public local state without backend calls. Ingress rate limiting, concurrency/body/read limits and prevention of direct gateway access are explicit deployment requirements, with an nginx example.
  4. Non-loopback HTTP backend URLs are rejected. Compose requires an HTTPS backend URL through the existing PKI reverse proxy; HTTP is allowed only for literal loopback/localhost. This protects service tokens when proxies are configured.
  5. Rebased on [1/2] Generalize CA-bound integration service tokens, migration and UI #18/current main with both deployment blocks retained. KMS pins in deployment, dev and ansible/tests/e2e/docker-compose.yml are aligned at 5.28.0, and the kms.toml header is updated.

Backend-owned RA boundary

No gateway KMS client, KMS credentials, private keys or KMS object IDs. Provision/renew/sign/decrypt go through backend integration-scoped RA endpoints from #18. Compose separates the backend's internal KMS network from the gateway. Shared DN policy, stable renewal subject/SANs, bounded body reads, per-CSR coordination, transient Intune journal retention and protected RA serials are included.

KMS 5.28.0 supplies fresh serials on same-key RA renewal; 5.24 cannot safely provide this. The upgrade runbook requires backup, staging on a copy and retention of old images/data. The direct-KMS gateway migration requires CA rediscovery for the new backend-bound RA. No production data was migrated.

Use one gateway replica while cross-replica device issuance uniqueness is pending. Live Intune/physical-device acceptance and optional image signing/SBOM/scanning remain deployment/follow-up work. MDM/client profiles schedule client renewal separately from automatic RA renewal.

@tilwegener
tilwegener marked this pull request as ready for review October 22, 2026 18:09
oriolrius added a commit that referenced this pull request Oct 22, 2026
kms/kms.toml used `[server]` and `[database] type/path`, which Cosmian KMS
5.24 silently ignores. The dev and e2e KMS therefore kept SQLite in the
container's writable layer, the mounted ./data stayed empty, and recreating
the container lost every key.

Switch to the 5.24 schema (`[http]`, `[db] database_type/sqlite_path`,
`[workspace]`, `[logging] rust_log`), identical to the file proposed in #19,
so that PR merges cleanly. Document in kms/README.md how to rescue a database
left inside an old container, ignore the SQLite WAL/SHM files, and note that
RUST_LOG is ignored in config-file mode.

Production (k5-stack-pki) is unaffected: it runs the KMS in default mode with
the data dir mounted at /var/lib/cosmian-kms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tilwegener
tilwegener force-pushed the feat/scep-gateway-only branch from 77709c8 to 93e03b8 Compare October 22, 2026 21:30

@oriolrius oriolrius left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved together with #18 — see the review there for details. Thanks @tilwegener!

@oriolrius
oriolrius force-pushed the feat/scep-gateway-only branch from d2d7487 to ff6e34b Compare October 23, 2026 13:53
@oriolrius
oriolrius merged commit f2d86da into oriolrius:main Oct 23, 2026
7 checks passed
oriolrius added a commit that referenced this pull request Oct 24, 2026
kms/kms.toml used `[server]` and `[database] type/path`, which Cosmian KMS
5.24 silently ignores. The dev and e2e KMS therefore kept SQLite in the
container's writable layer, the mounted ./data stayed empty, and recreating
the container lost every key.

Switch to the 5.24 schema (`[http]`, `[db] database_type/sqlite_path`,
`[workspace]`, `[logging] rust_log`), identical to the file proposed in #19,
so that PR merges cleanly. Document in kms/README.md how to rescue a database
left inside an old container, ignore the SQLite WAL/SHM files, and note that
RUST_LOG is ignored in config-file mode.

Production (k5-stack-pki) is unaffected: it runs the KMS in default mode with
the data dir mounted at /var/lib/cosmian-kms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
oriolrius pushed a commit that referenced this pull request Oct 24, 2026
…orkflow (#19)

RSA SCEP gateway (shared/Intune/webhook authorization) that reaches the KMS
only through the backend RA API, with short RA snapshots, tolerant startup
renewal, HTTPS-only backend URL, Compose templates and protocol/deployment
docs. Same-key RA renewal requires Cosmian KMS 5.28.0; dev/deployment/e2e
KMS pins move to 5.28.0.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants