Skip to content

Add agent-issued certificates, revocation, and Terraform provider - #9

Merged
msdmazvoid merged 16 commits into
mainfrom
feature/cert-ui
Nov 9, 2026
Merged

msdmazvoid merged 16 commits into
mainfrom
feature/cert-ui

Conversation

@msdmazvoid

Copy link
Copy Markdown
Contributor

Summary

Adds agent-issued client certificates, durable revocation, and a Terraform provider for certificate, volume-group, and storage-class management.

The design record is committed at docs/designs/terraform.md.

What changed

  • Certificate authority (internal/pki)

    • CA loading and degraded issuance mode
    • Certificate issuance with TTL and active-certificate quota
    • SQLite certificate registry
    • Append-only revocation journal, cache, compaction, and backup snapshot
    • Normal, external, and orphan certificate revocation
    • Issuer, Registry, ExternalRevoker, FileStore, RevocationChecker, and CAStatus interfaces
  • mTLS enforcement

    • Client certificate serial is carried in the auth identity
    • Revoked serials are rejected on both gRPC and HTTP/JSON paths
    • Agent advertises certificates and storage_classes capabilities and caller role/owner
  • Admin API and UI

    • Certificate issue/list/get/revoke and external revoke RPCs
    • GetVG and class administration RPCs
    • Shared VGClassManager with audit-aware VG transactions
    • Local UI certificate list/create/revoke/external-revoke/download
    • URL-backed tabs so refresh preserves the current page
    • Improved spacing and certificate table layout, including certificate name
  • Terraform provider

    • cmd/terraform-provider-kouja
    • kouja_volume_group resource and data source
    • kouja_storage_class resource
    • kouja_client_certificate resource with sensitive private key and self-revoke guard
    • Provider TLS configuration, capability/admin checks, warnings, and request IDs
    • Examples and Makefile/CI provider targets
  • State and audit

    • Schema v2 certificate table and audit columns
    • Pre-v2 timestamped backup before migration
    • Shared audit recorder and PutAuditEvent
    • Journal snapshot in backup manifest and retention

Verification

  • make all
  • make test-provider
  • go test -tags=unit across all packages
  • go vet for commands and internal packages
  • terraform fmt -check -recursive cmd/terraform-provider-kouja/examples
  • Live E2E against a running agent:
    • Terraform registered VG kouja-2 (UUID uv8lsj-icbd-tKv2-Hi5j-ge6w-Bs1o-hU76m2)
    • Data source kouja_volume_group read the registration and capacity
    • Terraform issued a rookery caller certificate and it authenticated over mTLS
    • terraform destroy revoked the caller certificate and removed the VG registration
    • Production provider plan after restart returned no changes

Operator notes

  • admin_ui.client_cert_dir and admin_ui.client_ca_key_file are removed.
  • New top-level config is certificate_authority.
  • kouja_volume_group destroy deregisters the VG; it does not run vgremove.
  • The provider is built from this repository and is not published to the public Terraform Registry.

@msdmazvoid
msdmazvoid merged commit be27742 into main Nov 9, 2026
2 checks passed
@msdmazvoid
msdmazvoid deleted the feature/cert-ui branch November 9, 2026 16:34
@msdmazvoid

Copy link
Copy Markdown
Contributor Author

Added periodic S3 recovery backups in 8825b82:\n\n- Recovery tar.gz bundle: SQLite snapshot, config, emergency log, secret key, host ID, revocation journal, TLS key/cert, CA key, and certificate directory\n- S3 upload on the existing backup interval\n- AWS default credential chain\n- Optional S3-compatible endpoint/path style\n- SSE-S3 or SSE-KMS\n- Restore procedure and security notes in docs/backups.md\n- Fake-S3 upload test and archive-content test\n\nThe code compiles and local tests/lint pass. A live S3 upload still needs the real bucket/credentials.

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.

1 participant