Configuration Reference

SPORK CA can be configured through CLI flags, environment variables, and a TOML configuration file. This page documents every option.

Configuration Methods

Settings are resolved in the following order of precedence (highest first):

  1. CLI flags — Override everything. Passed directly on the command line.
  2. Environment variables — Override config file and defaults.
  3. Config file/etc/spork/config.toml (or path set by --config).
  4. Built-in defaults — Sensible values that work for development and simple deployments.
Tip: For production deployments, use the config file for base settings and environment variables for secrets (such as SPORK_KEYSTORE_PASSPHRASE).

Environment Variables

Core

VariableDescriptionDefault
SPORK_DATA_DIRRoot directory for CA data, keys, and certificates/opt/spork-acme/data
SPORK_DB_PATHPath to the SQLite database file$SPORK_DATA_DIR/spork.db
DATABASE_URLPostgreSQL connection string (spork-web only)
SPORK_LOG_LEVELLog verbosity: trace, debug, info, warn, errorinfo
SPORK_LOG_FORMATLog format: text or jsontext
RUST_BACKTRACEEnable Rust backtraces: 1 or full0

Server Ports

VariableDescriptionDefault
SPORK_BIND_ADDRIP address to bind all listeners to0.0.0.0
SPORK_ACME_PORTACME server HTTPS port6446
SPORK_EST_PORTEST server port8443
SPORK_OCSP_PORTOCSP responder port8888
SPORK_CRL_PORTCRL distribution point HTTP port8889
SPORK_API_PORTREST API port (mTLS-protected)9443

TLS

VariableDescriptionDefault
SPORK_TLS_CERTPath to the server TLS certificate (PEM)Auto-generated self-signed
SPORK_TLS_KEYPath to the server TLS private key (PEM)Auto-generated
SPORK_TLS_CAPath to the CA certificate for client verificationUses the CA's own certificate
SPORK_TLS_REQUIRE_CLIENT_CERTRequire mTLS client certificates: true or falsefalse

HSM (PKCS#11)

VariableDescriptionDefault
SPORK_HSM_MODULEPath to the PKCS#11 shared library
SPORK_HSM_SLOTHSM slot number0
SPORK_HSM_PINHSM PIN (use env var, never config file)

ACME-Specific

VariableDescriptionDefault
SPORK_KEYSTORE_PASSPHRASEPassphrase for the encrypted keystore. Required for non-interactive (service) mode. In interactive mode, the passphrase is prompted.
Security: Never place SPORK_KEYSTORE_PASSPHRASE or SPORK_HSM_PIN in a config file. Use environment variables or a secrets manager. For systemd services, set them via EnvironmentFile= with restricted permissions.

Config File

The default config file location is /etc/spork/config.toml. Override with --config /path/to/config.toml.

Below is a complete example covering all sections:

# /etc/spork/config.toml

[general]
data_dir = "/opt/spork-acme/data"
log_level = "info"           # trace, debug, info, warn, error
log_format = "text"          # text, json

[database]
# SQLite (default)
path = "/opt/spork-acme/data/spork.db"

# PostgreSQL (spork-web only, uncomment to use)
# url = "postgresql://spork:password@localhost:5432/spork"

[acme]
bind = "0.0.0.0"
port = 6446
# External URLs used in issued certificates
cdp_url = "http://crl.example.com/spork.crl"
aia_base_url = "http://aia.example.com/"
# ACME directory metadata
terms_of_service = "https://example.com/tos"
website = "https://example.com"

[tls]
cert = "/etc/spork/tls/server.pem"
key = "/etc/spork/tls/server-key.pem"
ca = "/etc/spork/tls/ca.pem"
require_client_cert = false   # Set true to enforce mTLS on all endpoints

[logging]
# Syslog integration (optional)
syslog = false
syslog_facility = "local0"
# File logging (optional, in addition to stdout)
file = "/var/log/spork/spork.log"
max_size_mb = 100
max_backups = 5

CLI Flags

Common flags for spork-acme:

FlagDescriptionExample
-s, --state-dirPath to the state/data directoryspork-acme -s /opt/spork-acme
--bindIP address to bind tospork-acme --bind 127.0.0.1
--portHTTPS port for the ACME serverspork-acme --port 443
--cdp-urlCRL Distribution Point URL embedded in issued certificates--cdp-url http://crl.example.com/spork.crl
--aia-base-urlAuthority Information Access base URL for CA certificate and OCSP--aia-base-url http://aia.example.com/
--configPath to config file (overrides default /etc/spork/config.toml)--config /opt/spork/my-config.toml

mTLS Setup

SPORK CA uses mutual TLS (mTLS) with admin certificates to authenticate destructive operations. Certificates contain a Policy OID that determines the access level:

Admin Certificate Hierarchy

LevelPolicy OIDCreated ViaCapabilities
SuperAdmin.1.20.4Initial setup (inception)Full control: factory reset, issue admin certs, all operations
Admin.1.20.3WebUI (by SuperAdmin)Revoke certs, manage CRLs, issue end-entity certs
Operator.1.20.2WebUIIssue certs, view logs
Viewer.1.20.1WebUIView-only access (status, certificates, logs)

Importing PFX in Your Browser

To access the admin web UI, import the admin PFX certificate into your browser:

  1. Chrome/Edge: Settings → Privacy and Security → Security → Manage certificates → Import. Select the .pfx file and enter the passphrase.
  2. Firefox: Settings → Privacy & Security → View Certificates → Your Certificates → Import. Select the .pfx file and enter the passphrase.
  3. Safari: Double-click the .pfx file to add it to Keychain Access. Enter the passphrase when prompted.

Once imported, navigate to the admin UI (e.g., https://your-server:6446/admin). The browser will prompt you to select the client certificate. Choose the SPORK admin certificate.

Note: The admin UI is view-only by design. All destructive operations (revocation, CRL signing, admin cert management) must be performed via the mTLS-authenticated REST API or the CLI with an admin PFX.

Production Checklist

Before deploying SPORK CA in production, verify the following:

ItemActionWhy
Bind address Set SPORK_BIND_ADDR to a specific interface (not 0.0.0.0) Limit network exposure
mTLS enforcement Set SPORK_TLS_REQUIRE_CLIENT_CERT=true for admin endpoints Prevent unauthenticated access to destructive operations
systemd service Install the spork-acme.service unit file and enable it Automatic startup, restart on failure, resource limits
Log rotation Configure [logging] section or use logrotate for /var/log/spork/ Prevent disk exhaustion
Keystore passphrase Set SPORK_KEYSTORE_PASSPHRASE via EnvironmentFile= with mode 0600 Non-interactive startup without exposing secrets in process list
CRL timer Enable spork-acme-crl.timer for periodic CRL regeneration Ensure clients can check revocation status offline
Backup schedule Configure automated backups via spork-acme → Backup → Schedule Disaster recovery
Firewall Allow only required ports (6446 for ACME, 8888 for OCSP, 8889 for CRL) Minimize attack surface
File permissions Ensure /opt/spork-acme/data/ is owned by the service user with mode 0700 Protect private keys and database
Important: Run the security audit from the auto-detect menu (sudo spork-acme → Security → Audit) to verify your deployment meets hardening requirements.