Speichert das LDAP-Bind-Passwort je Tenant ausschliesslich verschluesselt mit dem Tenant-KEK aus API-10 (AES-256-GCM, kek.EncryptWithTenantKEK/ DecryptWithTenantKEK) statt in einem separaten Secret-Schema oder Klartext (Keycloak-Antipattern bewusst vermieden). Neue Tabelle ldap_bind_config in der Tenant-Datenbank (Migration 0009), neuer internal/ldapsync.ConfigStore fuer Save/Get, rein additiv zu IAM-05 (Syncer/RoleMappingStore unveraendert). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QPsyieCYwvbUBsnN598SbP
26 lines
1.4 KiB
SQL
26 lines
1.4 KiB
SQL
-- IAM-19: Verschluesselte Ablage der LDAP/AD-Bind-Credentials je Tenant
|
|
-- (siehe core-kanban/tickets/IAM-19.md). Liegt wie alle anderen
|
|
-- Tenant-Fachdaten in der Tenant-Datenbank (Modell C, TEN-01) — NICHT in der
|
|
-- Control-Plane-Registry, in der ausschliesslich der verpackte Tenant-KEK
|
|
-- selbst liegt (internal/kek, API-10).
|
|
--
|
|
-- bind_password_ciphertext enthaelt AUSSCHLIESSLICH das mit dem Tenant-KEK
|
|
-- verschluesselte Bind-Passwort (AES-256-GCM, Nonce vorangestellt) — niemals
|
|
-- Klartext (Akzeptanzkriterium 1 + 2). Kein separates Secret-Schema: dieselbe
|
|
-- Envelope-Encryption wie fuer alle anderen ueber den Tenant-KEK geschuetzten
|
|
-- Daten (bewusst vermieden: Keycloaks historische Klartextablage, siehe
|
|
-- Ticket "Bewusst vermeiden").
|
|
CREATE TABLE ldap_bind_config (
|
|
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
|
host TEXT NOT NULL,
|
|
bind_dn TEXT NOT NULL,
|
|
bind_password_ciphertext BYTEA NOT NULL,
|
|
base_dn TEXT NOT NULL,
|
|
updated_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
|
);
|
|
|
|
-- Genau ein LDAP-Bind-Konfigurationssatz pro Tenant-Datenbank (physische
|
|
-- Isolation macht einen tenant_id-Fremdschluessel hier unnoetig, siehe
|
|
-- identisches Muster in tenant_settings/TEN-03).
|
|
CREATE UNIQUE INDEX ldap_bind_config_singleton_idx ON ldap_bind_config ((true));
|