Back to documentation

Configuration

This guide provides detailed information on how to configure each service in the Quantum-Safe PKI project. The services are primarily configured through environment variables, with some services also supporting configuration files.

Common Configuration

All services share some common configuration options, which are described below:

VariableDescriptionDefault
KEY_DIRDirectory to store/load cryptographic keys and certificateskeys
LOG_LEVELLogging level (debug, info, warn, error)info
LOG_FORMATLogging format (text or json)text
GODEBUGSet to tls13kem=1 to activate hybrid KEM (X25519+MLKEM768)tls13kem=0

CA Service Configuration

The CA Service is configured using the following environment variables:

VariableDescriptionDefault
PORT_CA / ADDRListen address for the service:5000
KEYSTORE_TYPEMethod for storing private keys: fs or pkcs11fs
PKCS11_MODULEPath to PKCS#11 module (required if KEYSTORE_TYPE=pkcs11)None
PKCS11_TOKEN_LABELPKCS#11 token label (required if KEYSTORE_TYPE=pkcs11)None
PKCS11_PINPKCS#11 PIN (required if KEYSTORE_TYPE=pkcs11)None
SERVICE_HOSTPublicly accessible hostname for the serviceDerived from request Host header
TLS_CLIENT_AUTHControls TLS client authentication mode (none, request, require, require_and_verify)require_and_verify

ACME Server Configuration

The ACME Server is configured using the following environment variables:

VariableDescriptionDefault
PORT_ACME / ADDRListen address for the service:4000
DATABASE_URLPostgreSQL connection stringRequired
SKIP_DBSkip database initialization (for testing)false
SKIP_CAUse a self-signed certificate instead of requesting from CA Servicefalse
CA_SIGN_URLURL of the CA's CSR signing endpointhttps://localhost:5000/sign
CA_CRL_URLURL to fetch the Certificate Revocation List from the CAhttps://localhost:5000/crl
CA_OCSP_URLURL of the CA's OCSP responderhttps://localhost:5000/ocsp
TLS_CLIENT_AUTHControls TLS client authentication mode (none, request, etc.)require_and_verify

Transparency Log Configuration

The Transparency Log Service is configured using the following environment variables:

VariableDescriptionDefault
PORT_CT / ADDRListen address for the service:6000
LOG_FILEPath to the append-only log filect-log.dat
CA_CERT_FILEPath to the CA root certificate PEM fileca-cert.pem
CA_CRL_URLURL to fetch the Certificate Revocation List from the CAhttps://localhost:5000/crl
TLS_CLIENT_AUTHControls TLS client authentication mode (none, request, etc.)require_and_verify

Signing Service Configuration

The Signing Service is configured using the following environment variables:

VariableDescriptionDefault
SIGNING_ADDR / ADDRListen address for the service:7000
DB_DSNSQLite database file pathsigning.db
KEYSTORE_TYPEMethod for storing private keys: fs or pkcs11fs
PKCS11_MODULEPath to PKCS#11 module (required if KEYSTORE_TYPE=pkcs11)None
PKCS11_TOKEN_LABELPKCS#11 token label (required if KEYSTORE_TYPE=pkcs11)None
PKCS11_PINPKCS#11 PIN (required if KEYSTORE_TYPE=pkcs11)None
RATE_LIMIT_FREERate limit for free tier (signatures per hour)10

Device Service Configuration

The Device Service is configured using the following environment variables:

VariableDescriptionDefault
PORT_DEVICE / ADDRListen address for the service:8000
CA_SIGN_URLURL of the CA's CSR signing endpointhttps://localhost:5000/sign
DEVICE_DBSQLite database file path for device registrationdevices.db

CLI Configuration

The CLI tool is configured using command-line flags or environment variables:

Flag / VariableDescriptionDefault
--url / SIGNING_URLURL of the Signing Servicehttps://localhost:7000
--api-key / API_KEYAPI key for authenticating with the Signing ServiceNone (required)
--ca-cert / CA_CERT_FILEPath to the CA root certificate PEM fileca-cert.pem

Configuration Files

In addition to environment variables, some services support configuration files in JSON or YAML format. To use a configuration file, specify the path using the --config flag:

# Start CA Service with a configuration file ./bin/ca-service --config ca-config.json # Start ACME Server with a configuration file ./bin/acme-server --config acme-config.yaml

Example Configuration Files

Here are some example configuration files for the services:

CA Service (ca-config.json)

{
  "addr": ":5000",
  "keyDir": "keys",
  "keystoreType": "fs",
  "logLevel": "info",
  "logFormat": "text",
  "tlsClientAuth": "require_and_verify"
}

ACME Server (acme-config.yaml)

addr: ":4000"
databaseUrl: "postgres://user:password@localhost:5432/acme_server"
keyDir: "keys"
caSignUrl: "https://localhost:5000/sign"
caCrlUrl: "https://localhost:5000/crl"
caOcspUrl: "https://localhost:5000/ocsp"
tlsClientAuth: "require_and_verify"
logLevel: "info"
logFormat: "text"

Environment Variables File

You can also use a .env file to set environment variables for all services. Create a file named .env in the root directory of the project with the following content:

# Common configuration
KEY_DIR=keys
LOG_LEVEL=info
LOG_FORMAT=text
GODEBUG=tls13kem=1

# CA Service
PORT_CA=5000
KEYSTORE_TYPE=fs

# ACME Server
PORT_ACME=4000
DATABASE_URL=postgres://user:password@localhost:5432/acme_server
CA_SIGN_URL=https://localhost:5000/sign
CA_CRL_URL=https://localhost:5000/crl
CA_OCSP_URL=https://localhost:5000/ocsp

# Transparency Log
PORT_CT=6000
LOG_FILE=ct-log.dat

# Signing Service
SIGNING_ADDR=:7000
DB_DSN=signing.db

# Device Service
PORT_DEVICE=8000
DEVICE_DB=devices.db

Next Steps

Now that you have configured the services, you can proceed to: