Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Configuration Reference

This document provides a complete reference for kipuka.toml, the main configuration file for the kipuka EST server.

Configuration Sections

[server]

Core server settings for HTTP/HTTPS listeners and runtime behavior.

KeyTypeDefaultDescription
listenstring"0.0.0.0:8443"Address and port for the main EST endpoint (HTTPS).
admin_listenstring"127.0.0.1:9443"Address and port for the administrative API. Bind to localhost by default for security.
workersintegernum_cpusNumber of worker threads. Defaults to the number of CPU cores.
max_body_sizestring"1MB"Maximum allowed request body size. Accepts suffixes: B, KB, MB, GB.
shutdown_timeoutstring"30s"Grace period for connection draining during shutdown. Accepts suffixes: s, m, h.

[tls]

TLS configuration for the main EST endpoint.

KeyTypeDefaultDescription
certstringrequiredPath to PEM-encoded server certificate.
keystringrequiredPath to PEM-encoded private key for the server certificate.
min_versionstring"1.2"Minimum TLS protocol version. Valid values: "1.2", "1.3".
cipher_suitesarray of strings(TLS library defaults)Explicit list of allowed cipher suites. Omit to use secure defaults.

[tls.client_auth]

Mutual TLS (mTLS) client authentication settings.

KeyTypeDefaultDescription
trust_anchorsstringrequiredPath to PEM file containing trusted CA certificates for client authentication.
modestring"required"Client certificate verification mode: required, optional, or none.

[db]

Database connection settings.

KeyTypeDefaultDescription
urlstring"sqlite://kipuka.db"Database connection URL. Supports sqlite://, postgres://, and mysql:// (MariaDB) schemes.
max_connectionsinteger5Maximum number of database connections in the pool.
connect_timeoutstring"5s"Timeout for establishing database connections.
auto_migratebooleantrueAutomatically apply schema migrations on startup.

[[ca]]

Certificate Authority (CA) definitions. Multiple [[ca]] sections define multiple CAs.

KeyTypeDefaultDescription
idstringrequiredUnique identifier for this CA. Referenced by EST labels.
namestringrequiredHuman-readable CA name.
certstringrequiredPath to PEM-encoded CA certificate.
keystringrequiredPath to PEM-encoded CA private key (or HSM key reference).
chainstringoptionalPath to PEM-encoded intermediate chain (if applicable).
validity_daysinteger365Default validity period for issued certificates (days).
max_validity_daysinteger398Maximum allowed validity period. RFC 5280 and NIAP recommend 398 days max.
default_key_usagearray of strings["digitalSignature", "keyEncipherment"]Default X.509 Key Usage extensions.
default_ext_key_usagearray of strings["serverAuth"]Default Extended Key Usage OIDs.
hsm_slotintegeroptionalHSM slot number if this CA key is stored in an HSM.

[est]

EST protocol feature flags and global settings.

KeyTypeDefaultDescription
base_pathstring"/.well-known/est"Base URL path for EST endpoints.
cacertsbooleantrueEnable /cacerts endpoint (RFC 7030 section 4.1).
simpleenrollbooleantrueEnable /simpleenroll endpoint (initial certificate enrollment).
simplereenrollbooleantrueEnable /simplereenroll endpoint (certificate renewal).
fullcmcbooleanfalseEnable /fullcmc endpoint (full CMC protocol).
serverkeygenbooleanfalseEnable /serverkeygen endpoint (server-generated key pairs).
csrattrsbooleantrueEnable /csrattrs endpoint (CSR attribute hints).
csr_attributesarray of strings[]OIDs to return in /csrattrs response. Empty means no specific attributes.
retry_afterinteger60Seconds to return in Retry-After header for pending requests.

[[est.label]]

EST label definitions for CA-specific endpoints. Multiple [[est.label]] sections define multiple labels.

KeyTypeDefaultDescription
namestringrequiredLabel name. Appears in URL as /.well-known/est/{name}/simpleenroll.
ca_idstringrequiredID of the CA to use for this label (references [[ca]] section).
allowed_key_typesarray of strings[]Restrict key types (e.g., ["rsa-2048", "ecdsa-p256"]). Empty allows all.
required_ext_key_usagearray of strings[]Require specific EKU OIDs in CSR.
max_validity_daysinteger(inherited from CA)Override CA’s max validity for this label.
require_sanbooleantrueRequire Subject Alternative Name extension in CSR.
subject_patternstringoptionalRegex pattern for validating CSR subject DN.

[hsm]

Hardware Security Module (HSM) configuration.

KeyTypeDefaultDescription
librarystringrequiredPath to PKCS#11 library (e.g., /usr/lib/softhsm/libsofthsm2.so).
slotintegeroptionalDefault HSM slot number. Can be overridden per CA.
token_labelstringoptionalToken label for slot selection.
pinstringoptionalHSM PIN. NOT RECOMMENDED (use pin_env or pin_file instead).
pin_envstringoptionalEnvironment variable containing the HSM PIN.
pin_filestringoptionalPath to file containing the HSM PIN (first line, newline stripped).

[otp]

One-Time Password (OTP) authentication for initial enrollment.

KeyTypeDefaultDescription
enabledbooleanfalseEnable OTP authentication.
token_lengthinteger20Length of generated OTP tokens. NIAP requires >= 16 characters.
default_ttlstring"24h"Default OTP validity period.
max_usesinteger1Maximum times an OTP can be used before expiration.
hash_algorithmstring"argon2id"Password hashing algorithm: argon2id, bcrypt, or sha256-hmac.
max_failuresinteger5Maximum failed OTP attempts before lockout.
failure_windowstring"15m"Time window for counting failed attempts.
lockout_durationstring"30m"Duration of account lockout after exceeding max_failures.

[audit]

Audit logging configuration.

KeyTypeDefaultDescription
filestringoptionalPath to audit log file. JSON Lines format.
syslogstringoptionalSyslog server URL (e.g., tcp+tls://syslog.example.com:6514).
syslog_facilitystring"local0"Syslog facility for audit events.
eventsarray of strings(all events)Filter events to log. Omit to log all. Examples: enroll, renew, reject.
include_cert_databooleanfalseInclude full certificate PEM in audit logs. Increases log volume.

[ha]

High Availability configuration for CA failover.

KeyTypeDefaultDescription
enabledbooleanfalseEnable HA mode.
strategystring"active-passive"Global failover strategy: active-passive, round-robin, weighted, latency-based.
check_intervalstring"10s"Health check interval for CAs.
failure_thresholdinteger3Consecutive failures before marking CA unhealthy.
recovery_timeoutstring"60s"Time to wait before retrying a failed CA.
check_timeoutstring"5s"Timeout for individual health checks.

[[ha.group]]

HA groups for label-specific CA failover. Multiple [[ha.group]] sections define multiple groups.

KeyTypeDefaultDescription
namestringrequiredGroup name.
ca_idsarray of stringsrequiredList of CA IDs in priority order.
strategystring(inherited from [ha])Override global HA strategy for this group.

[admin]

Administrative API configuration.

KeyTypeDefaultDescription
enabledbooleanfalseEnable the admin API.
authstring"mtls"Authentication method: mtls, bearer, or both.
trust_anchorsstringoptionalPath to PEM file with trusted CAs for admin mTLS. Required if auth includes mtls.
bearer_token_envstringoptionalEnvironment variable containing bearer token. Required if auth includes bearer.

Configuration Examples

Minimal Configuration

A basic single-CA deployment with one EST label.

[server]
listen = "0.0.0.0:8443"

[tls]
cert = "/etc/kipuka/server.pem"
key = "/etc/kipuka/server-key.pem"

[tls.client_auth]
trust_anchors = "/etc/kipuka/client-ca.pem"
mode = "required"

[db]
url = "sqlite:///var/lib/kipuka/kipuka.db"

[[ca]]
id = "main-ca"
name = "Main CA"
cert = "/etc/kipuka/ca.pem"
key = "/etc/kipuka/ca-key.pem"
validity_days = 365
max_validity_days = 398

[est]
base_path = "/.well-known/est"

[[est.label]]
name = "default"
ca_id = "main-ca"
require_san = true

Production Configuration

A realistic production deployment with HSM, HA, audit logging, admin API, OTP, and multiple CAs.

[server]
listen = "0.0.0.0:8443"
admin_listen = "127.0.0.1:9443"
workers = 8
max_body_size = "2MB"
shutdown_timeout = "60s"

[tls]
cert = "/etc/kipuka/certs/server.pem"
key = "/etc/kipuka/certs/server-key.pem"
min_version = "1.3"

[tls.client_auth]
trust_anchors = "/etc/kipuka/certs/client-ca-bundle.pem"
mode = "required"

[db]
url = "postgres://kipuka:password@db.example.com/kipuka?sslmode=require"
max_connections = 20
connect_timeout = "10s"
auto_migrate = true

[hsm]
library = "/usr/lib/softhsm/libsofthsm2.so"
slot = 0
token_label = "kipuka-prod"
pin_env = "KIPUKA_HSM_PIN"

[[ca]]
id = "root-ca"
name = "Production Root CA"
cert = "/etc/kipuka/ca/root-ca.pem"
key = "pkcs11:object=root-ca-key"
chain = "/etc/kipuka/ca/root-chain.pem"
validity_days = 365
max_validity_days = 398
default_key_usage = ["digitalSignature", "keyEncipherment"]
default_ext_key_usage = ["serverAuth", "clientAuth"]
hsm_slot = 0

[[ca]]
id = "backup-ca"
name = "Production Backup CA"
cert = "/etc/kipuka/ca/backup-ca.pem"
key = "pkcs11:object=backup-ca-key"
chain = "/etc/kipuka/ca/backup-chain.pem"
validity_days = 365
max_validity_days = 398
default_key_usage = ["digitalSignature", "keyEncipherment"]
default_ext_key_usage = ["serverAuth", "clientAuth"]
hsm_slot = 1

[[ca]]
id = "iot-ca"
name = "IoT Device CA"
cert = "/etc/kipuka/ca/iot-ca.pem"
key = "pkcs11:object=iot-ca-key"
validity_days = 180
max_validity_days = 180
default_key_usage = ["digitalSignature"]
default_ext_key_usage = ["clientAuth"]
hsm_slot = 2

[est]
base_path = "/.well-known/est"
cacerts = true
simpleenroll = true
simplereenroll = true
fullcmc = false
serverkeygen = false
csrattrs = true
csr_attributes = ["2.5.4.3", "2.5.4.11"]
retry_after = 120

[[est.label]]
name = "servers"
ca_id = "root-ca"
allowed_key_types = ["rsa-2048", "rsa-4096", "ecdsa-p256"]
required_ext_key_usage = ["serverAuth"]
max_validity_days = 398
require_san = true
subject_pattern = "^CN=.*\\.example\\.com$"

[[est.label]]
name = "clients"
ca_id = "root-ca"
allowed_key_types = ["ecdsa-p256", "ecdsa-p384"]
required_ext_key_usage = ["clientAuth"]
max_validity_days = 365
require_san = true

[[est.label]]
name = "iot"
ca_id = "iot-ca"
allowed_key_types = ["ecdsa-p256"]
required_ext_key_usage = ["clientAuth"]
max_validity_days = 180
require_san = false

[otp]
enabled = true
token_length = 20
default_ttl = "24h"
max_uses = 1
hash_algorithm = "argon2id"
max_failures = 5
failure_window = "15m"
lockout_duration = "30m"

[audit]
file = "/var/log/kipuka/audit.jsonl"
syslog = "tcp+tls://syslog.example.com:6514"
syslog_facility = "local0"
events = ["enroll", "renew", "reject", "revoke"]
include_cert_data = false

[ha]
enabled = true
strategy = "active-passive"
check_interval = "10s"
failure_threshold = 3
recovery_timeout = "60s"
check_timeout = "5s"

[[ha.group]]
name = "production"
ca_ids = ["root-ca", "backup-ca"]
strategy = "active-passive"

[[ha.group]]
name = "iot"
ca_ids = ["iot-ca"]
strategy = "active-passive"

[admin]
enabled = true
auth = "both"
trust_anchors = "/etc/kipuka/certs/admin-ca.pem"
bearer_token_env = "KIPUKA_ADMIN_TOKEN"

Notes

  • Security: Never commit kipuka.toml with plaintext secrets to version control. Use environment variables or HSM-backed keys.
  • Validation: kipuka validates the configuration at startup and reports errors for missing required fields or invalid values.
  • Reloading: Configuration changes require a server restart. Plan maintenance windows for production deployments.
  • HSM Keys: When using HSM-backed CA keys, specify key as a PKCS#11 URI (e.g., pkcs11:object=my-key) and ensure hsm_slot matches the token slot.
  • NIAP Compliance: For NIAP Common Criteria compliance, ensure otp.token_length >= 16, tls.min_version = "1.3", and ca.max_validity_days <= 398.