mirror of
https://github.com/shankar0123/certctl.git
synced 2026-06-07 14:01:36 +00:00
995b72df05
Replace static env-var-based issuer wiring with GUI-driven dynamic configuration stored encrypted in PostgreSQL. Operators can now configure, test, enable/disable, and manage issuers from the dashboard without restarting the server. Key changes: - AES-256-GCM encryption for sensitive issuer config at rest (PBKDF2 key derivation with 100k iterations) - Dynamic IssuerRegistry with sync.RWMutex replacing static map - Connector factory pattern (issuerfactory.NewFromConfig) replacing 140 lines of static wiring in main.go - Migration 000009: encrypted_config, last_tested_at, test_status, source columns on issuers table - Env var seeding on first boot with ON CONFLICT DO NOTHING - Registry Rebuild() for atomic map swap after CRUD operations - Issuer type validation against domain constants on Create - Audit trail for test connection results - Conditional seeding for step-ca/OpenSSL (only when env vars set) - GUI: source badge, connection test status on issuer detail page Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
17 lines
919 B
SQL
17 lines
919 B
SQL
-- Migration 000009: Add dynamic issuer configuration columns
|
|
-- Supports M34: Dynamic Issuer Configuration (GUI)
|
|
|
|
-- encrypted_config stores AES-GCM encrypted config blob containing all fields including secrets.
|
|
-- The existing `config` JSONB column is retained for backward compatibility and holds a redacted copy.
|
|
ALTER TABLE issuers ADD COLUMN IF NOT EXISTS encrypted_config BYTEA;
|
|
|
|
-- last_tested_at tracks when the issuer connection was last successfully tested.
|
|
ALTER TABLE issuers ADD COLUMN IF NOT EXISTS last_tested_at TIMESTAMPTZ;
|
|
|
|
-- test_status tracks the latest connection test result.
|
|
ALTER TABLE issuers ADD COLUMN IF NOT EXISTS test_status TEXT NOT NULL DEFAULT 'untested';
|
|
|
|
-- source tracks where the issuer configuration originated from.
|
|
-- 'database' = created via GUI, 'env' = seeded from environment variables.
|
|
ALTER TABLE issuers ADD COLUMN IF NOT EXISTS source TEXT NOT NULL DEFAULT 'database';
|