CMEK Setup Guide¶
NornicDB supports provider-backed data-at-rest keys by generating a Badger data-encryption key (DEK), wrapping that DEK with a configured provider key-encryption key (KEK), and persisting only the wrapped DEK metadata on disk.
Provider Modes¶
password(default): PBKDF2-derived Badger key fromencryption_passwordlocal: provider-backed DEK wrapping with a local KEK (dev/test)aws-kms: AWS KMS-backed wrappingazure-keyvault: Azure Key Vault-backed wrappinggcp-cloudkms: GCP Cloud KMS-backed wrapping
Runtime Behavior¶
- NornicDB stores the wrapped DEK metadata in
<data_dir>/db.kms_dek.json - The plaintext DEK is used only in memory to initialize Badger at startup
- Provider-backed audit events are appended to
<data_dir>/encryption-audit.jsonlunlessencryption_audit_log_pathis set - Wrapped-DEK rotation rewraps the persisted DEK metadata with the active provider key; it does not hot-swap the live Badger DEK
Minimal YAML¶
database:
encryption_enabled: true
encryption_provider: "local"
encryption_key_uri: "kms://local/nornicdb"
encryption_master_key: "replace-with-32-byte-test-placeholder"
encryption_audit_sign_events: true
encryption_audit_sign_key: "replace-with-hmac-signing-key"
encryption_rotation_enabled: true
encryption_rotation_interval: "2160h"
AWS KMS Example¶
database:
encryption_enabled: true
encryption_provider: "aws-kms"
encryption_aws_region: "us-east-1"
encryption_aws_kms_key_id: "arn:aws:kms:us-east-1:123456789012:key/..."
encryption_aws_role_arn: "arn:aws:iam::123456789012:role/nornicdb-kms"
encryption_aws_role_session_name: "nornicdb"
Equivalent env vars:
NORNICDB_ENCRYPTION_ENABLED=trueNORNICDB_ENCRYPTION_PROVIDER=aws-kmsNORNICDB_ENCRYPTION_AWS_REGION=us-east-1NORNICDB_ENCRYPTION_AWS_KMS_KEY_ID=...NORNICDB_ENCRYPTION_ROTATION_ENABLED=trueNORNICDB_ENCRYPTION_ROTATION_INTERVAL=2160h
Azure Key Vault Example¶
database:
encryption_enabled: true
encryption_provider: "azure-keyvault"
encryption_azure_vault_name: "nornicdb-prod-kv"
encryption_azure_key_name: "nornicdb-master-key"
encryption_azure_tenant_id: "..."
encryption_azure_client_id: "..."
encryption_azure_client_secret: "..."
GCP Cloud KMS Example¶
database:
encryption_enabled: true
encryption_provider: "gcp-cloudkms"
encryption_gcp_project: "my-project"
encryption_gcp_location: "us-central1"
encryption_gcp_key_ring: "nornicdb"
encryption_gcp_key_name: "storage-kek"
encryption_gcp_credentials_file: "/secrets/gcp-kms.json"
Audit and Rotation Settings¶
database:
encryption_audit_log_path: "/var/log/nornicdb/encryption-audit.jsonl"
encryption_audit_sign_events: true
encryption_audit_sign_key: "replace-with-hmac-signing-key"
encryption_rotation_enabled: true
encryption_rotation_interval: "2160h"
Environment variables:
NORNICDB_ENCRYPTION_AUDIT_LOG_PATHNORNICDB_ENCRYPTION_AUDIT_SIGN_EVENTSNORNICDB_ENCRYPTION_AUDIT_SIGN_KEYNORNICDB_ENCRYPTION_ROTATION_ENABLEDNORNICDB_ENCRYPTION_ROTATION_INTERVAL
What Is Persisted¶
When provider-backed encryption is enabled, NornicDB stores encrypted DEK metadata at:
<data_dir>/db.kms_dek.json<data_dir>/encryption-audit.jsonlby default, orencryption_audit_log_pathwhen configured
This file stores only wrapped DEK metadata (never plaintext DEK).
Validation Rules¶
passwordmode requiresencryption_passwordlocalmode requiresencryption_master_keyaws-kmsrequiresencryption_aws_regionandencryption_aws_kms_key_idazure-keyvaultrequiresencryption_azure_vault_nameandencryption_azure_key_namegcp-cloudkmsrequiresencryption_gcp_project,encryption_gcp_location,encryption_gcp_key_ring, andencryption_gcp_key_name- enabling audit signing requires
encryption_audit_sign_key