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
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.

Environment File

SPORK ACME is configured via CLI flags and environment variables. For systemd deployments, use an EnvironmentFile to store sensitive values outside the service file:

# /opt/spork-acme/spork-acme.env

# Keystore passphrase (encrypts CA private keys at rest)
SPORK_LOCKBOX_PASSPHRASE=your-secure-passphrase

# Admin dashboard credentials
SPORK_ADMIN_USER=admin
SPORK_ADMIN_PASSWORD=your-admin-password

# Log level (trace, debug, info, warn, error)
RUST_LOG=spork_acme=info

Reference it from the systemd service file:

[Service]
EnvironmentFile=/opt/spork-acme/spork-acme.env
ExecStart=/usr/local/bin/spork-acme -s /opt/spork-acme --auto-validate
Security: Set restrictive permissions on the environment file: chmod 600 /opt/spork-acme/spork-acme.env. Never store passphrases in the service file itself or in CLI arguments (visible in /proc). Prefer --admin-password-file over the SPORK_ADMIN_PASSWORD environment variable on systems where /proc/*/environ is readable.

CLI Flags

Common flags for spork-acme:

FlagDescriptionExample
-s, --state-dirPath to the state/data directoryspork-acme -s /opt/spork-acme
--hostIP address to bind tospork-acme --host 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.quantumnexus.com/spork.crl
--aia-base-urlAuthority Information Access base URL for CA certificate and OCSP--aia-base-url http://aia.quantumnexus.com/
--log-levelLog level (trace, debug, info, warn, error)spork-acme --log-level debug
--domain-policy-filePath to domain-policy.toml file--domain-policy-file /opt/spork-acme/domain-policy.toml
--allow-domainAllow a domain pattern (additive with policy file)--allow-domain "*.quantumnexus.com"
--deny-domainDeny a domain pattern (additive with policy file)--deny-domain "*.evil.com"
--no-rate-limitDisable built-in rate limiting--no-rate-limit

Domain Policy

SPORK ACME uses a deny-by-default domain policy to control which domains can receive certificates. The policy is configured via a TOML file in the state directory.

Policy File Format

Create domain-policy.toml in your state directory (e.g., /opt/spork-acme/domain-policy.toml):

# /opt/spork-acme/domain-policy.toml
[policy]
mode = "deny-by-default"  # or "allow-by-default"

[[allow]]
pattern = "*.quantumnexus.com"

[[allow]]
pattern = "quantumnexus.com"

[[deny]]
pattern = "*.evil.com"

CLI Integration

The policy file is loaded via --domain-policy-file. You can also add patterns additively from the command line:

# Load policy file and add extra patterns
spork-acme -s /opt/spork-acme \
  --domain-policy-file /opt/spork-acme/domain-policy.toml \
  --allow-domain "*.lab.local" \
  --deny-domain "*.test.invalid"

CLI patterns (--allow-domain, --deny-domain) are merged with the policy file. Deny rules always take precedence over allow rules.

Pattern Syntax

PatternMatchesDoes Not Match
**Everything
**.quantumnexus.coma.quantumnexus.com, b.c.quantumnexus.comquantumnexus.com
*.quantumnexus.coma.quantumnexus.comb.c.quantumnexus.com
quantumnexus.comquantumnexus.comwww.quantumnexus.com
Deny-by-default: If no --allow-domain patterns and no policy file are configured, the server rejects all certificate requests. The setup wizard prompts you to configure allowed domains during initial setup.

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 also supports Basic Auth + session cookies as an alternative to mTLS. Log in at /admin/login and log out at /admin/logout. mTLS remains the recommended method for high-security environments. 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
Domain policy Create domain-policy.toml with allowed domain patterns Prevent unauthorized certificate issuance
CRL timer Enable spork-acme-crl.timer for periodic CRL regeneration (6-hour interval) 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.