TLS Certificates
TLS Certificates
Section titled “TLS Certificates”Configure TLS certificates for secure communication between Mantis components.
Certificate Requirements
Section titled “Certificate Requirements”Component Certificates
Section titled “Component Certificates”| Component | Certificate Type | Purpose |
|---|---|---|
| Mandible | Server certificate | HTTPS for API clients |
| Thorax | Server certificate | gRPC server for agents |
| Tarsus | Client certificate | mTLS authentication |
Certificate Standards
Section titled “Certificate Standards”| Requirement | Specification |
|---|---|
| Key Algorithm | RSA 2048+ or ECDSA P-256+ |
| Signature | SHA-256 or stronger |
| Validity | 1 year recommended |
| Format | PEM encoded |
Development Certificates
Section titled “Development Certificates”Quick Setup
Section titled “Quick Setup”For development environments, use the provided script:
just dev-certsThis generates:
- Self-signed CA certificate and private key
- Thorax server certificate (CN=thorax, serverAuth + clientAuth)
- Tarsus listen-mode client certificate (CN=tarsus-dev, clientAuth + serverAuth)
- Mandible dispatch certificate (CN=mandible, clientAuth only — required for Mandible→Thorax deployment dispatch)
- Mandible server certificate (CN=mandible, serverAuth — for HTTPS on port 3000)
- Lens dev-server certificate (CN=localhost, serverAuth — for Vite HTTPS on port 5173)
Development Certificate Location
Section titled “Development Certificate Location”certs/├── ca-cert.pem # CA certificate├── ca-key.pem # CA private key├── server-cert.pem # Thorax server certificate (serverAuth + clientAuth)├── server-key.pem # Thorax server private key├── client-cert.pem # Tarsus listen-mode client certificate (clientAuth + serverAuth)├── client-key.pem # Tarsus client private key├── dispatch-cert.pem # Mandible dispatch certificate (clientAuth, CN=mandible)├── dispatch-key.pem # Mandible dispatch private key├── mandible-cert.pem # Mandible server certificate (serverAuth, CN=mandible)├── mandible-key.pem # Mandible server private key├── lens-cert.pem # Lens dev-server certificate (serverAuth, CN=localhost)└── lens-key.pem # Lens dev-server private keyProduction Certificates
Section titled “Production Certificates”Certificate Authority Options
Section titled “Certificate Authority Options”| Option | Use Case | Complexity |
|---|---|---|
| Public CA | Internet-facing services | Low |
| Private CA | Internal infrastructure | Medium |
| Self-managed CA | Air-gapped environments | High |
Public CA Certificates
Section titled “Public CA Certificates”For internet-facing Mandible deployments:
# Using Let's Encrypt with certbotcertbot certonly --standalone -d mantis.example.com
# Certificate files/etc/letsencrypt/live/mantis.example.com/fullchain.pem/etc/letsencrypt/live/mantis.example.com/privkey.pemPrivate CA Setup
Section titled “Private CA Setup”For internal infrastructure:
# Create CA private keyopenssl genrsa -out ca.key 4096
# Create CA certificateopenssl req -x509 -new -nodes -key ca.key \ -sha256 -days 3650 \ -subj "/CN=Mantis Internal CA/O=Your Organization" \ -out ca.crtMandible TLS Configuration
Section titled “Mandible TLS Configuration”Configuration File
Section titled “Configuration File”[server]host = "0.0.0.0"port = 3000
[server.tls]cert_path = "/etc/mantis/certs/server.crt"key_path = "/etc/mantis/certs/server.key"Environment Variables
Section titled “Environment Variables”| Variable | Description | Example |
|---|---|---|
MANDIBLE__SERVER__PORT | Server port | 3000 |
MANDIBLE__SERVER__TLS__CERT_PATH | Certificate path | /etc/mantis/certs/server.crt |
MANDIBLE__SERVER__TLS__KEY_PATH | Private key path | /etc/mantis/certs/server.key |
Certificate Chain
Section titled “Certificate Chain”For certificates signed by an intermediate CA:
# Concatenate certificate chaincat server.crt intermediate.crt > fullchain.crtConfigure with the full chain:
[server.tls]cert_path = "/etc/mantis/certs/fullchain.crt"key_path = "/etc/mantis/certs/server.key"Thorax TLS Configuration
Section titled “Thorax TLS Configuration”Server Certificate
Section titled “Server Certificate”[grpc]address = "0.0.0.0"port = 50051
[tls]auth_mode = "thumbprint"cert_path = "/etc/mantis/certs/thorax.crt"key_path = "/etc/mantis/certs/thorax.key"ca_cert_path = "/etc/mantis/certs/ca.crt"mTLS Settings
Section titled “mTLS Settings”Thorax always requires client certificates (mTLS is mandatory). The auth_mode controls how they are validated:
[tls]auth_mode = "ca_signed"cert_path = "/etc/mantis/certs/thorax.crt"key_path = "/etc/mantis/certs/thorax.key"ca_cert_path = "/etc/mantis/certs/ca.crt"| Auth Mode | Description |
|---|---|
thumbprint | Self-signed certs accepted, thumbprint verified at app layer (default) |
ca_signed | Client certs must be CA-signed at TLS layer |
Tarsus TLS Configuration
Section titled “Tarsus TLS Configuration”Client Certificate
Section titled “Client Certificate”[tls]cert_path = "/etc/tarsus/cert.pem"key_path = "/etc/tarsus/key.pem"ca_cert_path = "/etc/tarsus/ca.crt"Self-Signed Certificate Generation
Section titled “Self-Signed Certificate Generation”For thumbprint mode, Tarsus automatically generates a certificate on first run if one is not configured. You can also generate one manually:
# Generate self-signed certificate using OpenSSLopenssl req -new -x509 -nodes \ -keyout /etc/tarsus/key.pem \ -out /etc/tarsus/cert.pem \ -days 365 \ -subj "/CN=$(hostname)/O=Mantis Agent"
# View the thumbprinttarsus show-thumbprintCA-Signed Certificate
Section titled “CA-Signed Certificate”For CA-signed mode:
# Generate CSRopenssl req -new -nodes \ -keyout /etc/tarsus/key.pem \ -out /etc/tarsus/client.csr \ -subj "/CN=tarsus-web-prod-01/O=Your Organization"
# Sign with CA (on CA server)openssl x509 -req -in client.csr \ -CA ca.crt -CAkey ca.key -CAcreateserial \ -out client.crt -days 365 -sha256
# Install on agentcp client.crt /etc/tarsus/cert.pemCertificate Generation
Section titled “Certificate Generation”Server Certificate
Section titled “Server Certificate”# Generate server private keyopenssl genrsa -out server.key 2048
# Generate CSRopenssl req -new -key server.key \ -subj "/CN=mantis.example.com/O=Your Organization" \ -out server.csr
# Create certificate with SANcat > server.ext << EOFauthorityKeyIdentifier=keyid,issuerbasicConstraints=CA:FALSEkeyUsage = digitalSignature, keyEnciphermentextendedKeyUsage = serverAuthsubjectAltName = @alt_names
[alt_names]DNS.1 = mantis.example.comDNS.2 = *.mantis.example.comIP.1 = 10.0.0.10EOF
# Sign with CAopenssl x509 -req -in server.csr \ -CA ca.crt -CAkey ca.key -CAcreateserial \ -out server.crt -days 365 \ -extfile server.extClient Certificate
Section titled “Client Certificate”# Generate client private keyopenssl genrsa -out client.key 2048
# Generate CSRopenssl req -new -key client.key \ -subj "/CN=tarsus-agent-01/O=Your Organization" \ -out client.csr
# Create certificatecat > client.ext << EOFauthorityKeyIdentifier=keyid,issuerbasicConstraints=CA:FALSEkeyUsage = digitalSignatureextendedKeyUsage = clientAuthEOF
# Sign with CAopenssl x509 -req -in client.csr \ -CA ca.crt -CAkey ca.key -CAcreateserial \ -out client.crt -days 365 \ -extfile client.extCertificate Verification
Section titled “Certificate Verification”Verify Certificate Chain
Section titled “Verify Certificate Chain”# Verify server certificate against CAopenssl verify -CAfile ca.crt server.crt
# Expected output:# server.crt: OKCheck Certificate Details
Section titled “Check Certificate Details”# View certificate informationopenssl x509 -in server.crt -text -noout
# Check expiration dateopenssl x509 -in server.crt -enddate -noout
# Get thumbprintopenssl x509 -in server.crt -fingerprint -sha256 -nooutTest TLS Connection
Section titled “Test TLS Connection”# Test Mandible HTTPSopenssl s_client -connect mantis.example.com:3000 \ -servername mantis.example.com
# Test Thorax gRPC with client certopenssl s_client -connect thorax.example.com:50051 \ -cert client.crt -key client.key -CAfile ca.crtCertificate Storage
Section titled “Certificate Storage”File Permissions
Section titled “File Permissions”# Secure private keyschmod 600 /etc/mantis/certs/*.keychown mantis:mantis /etc/mantis/certs/*.key
# Certificates can be readablechmod 644 /etc/mantis/certs/*.crtDirectory Structure
Section titled “Directory Structure”/etc/mantis/certs/├── ca.crt # CA certificate (readable)├── server.crt # Server certificate (readable)├── server.key # Server private key (restricted)└── chain.crt # Certificate chain (readable)Secrets Management
Section titled “Secrets Management”For production, consider using:
| Solution | Integration |
|---|---|
| HashiCorp Vault | PKI secrets engine |
| AWS Secrets Manager | Certificate storage |
| Kubernetes Secrets | cert-manager integration |
Certificate Renewal
Section titled “Certificate Renewal”Manual Renewal
Section titled “Manual Renewal”# Generate new CSR with existing keyopenssl req -new -key server.key \ -subj "/CN=mantis.example.com" \ -out server.csr
# Sign new certificateopenssl x509 -req -in server.csr \ -CA ca.crt -CAkey ca.key \ -out server-new.crt -days 365
# Replace certificate (with brief downtime)mv server-new.crt server.crtsystemctl restart mantis-mandibleAutomated Renewal
Section titled “Automated Renewal”For Let’s Encrypt certificates:
# Certbot auto-renewalcertbot renew --deploy-hook "systemctl reload mantis-mandible"
# Add to crontab0 0 * * * certbot renew --quiet --deploy-hook "systemctl reload mantis-mandible"Zero-Downtime Renewal
Section titled “Zero-Downtime Renewal”TLS Protocol Configuration
Section titled “TLS Protocol Configuration”The TLS protocol version and cipher suites are not configurable. Mandible’s
[server.tls] section accepts only cert_path and key_path; there are no
min_version or cipher_suites keys. The underlying rustls stack negotiates
TLS 1.2/1.3 with modern, secure cipher suites by default and rejects deprecated
versions (TLS 1.0/1.1).
| Version | Status |
|---|---|
| TLS 1.0 | Not offered (deprecated) |
| TLS 1.1 | Not offered (deprecated) |
| TLS 1.2 | Supported |
| TLS 1.3 | Supported (preferred) |
Troubleshooting
Section titled “Troubleshooting”Certificate Errors
Section titled “Certificate Errors”| Error | Cause | Solution |
|---|---|---|
certificate verify failed | CA not trusted | Add CA to trust store |
certificate has expired | Certificate expired | Renew certificate |
hostname mismatch | Wrong CN or SAN | Regenerate with correct names |
unable to get local issuer | Missing intermediate | Include full chain |
Common Issues
Section titled “Common Issues”Certificate chain incomplete:
# Check chainopenssl s_client -connect mantis.example.com:3000 -showcerts
# Fix: concatenate certificatescat server.crt intermediate.crt > fullchain.crtPermission denied on key file:
# Check permissionsls -la /etc/mantis/certs/
# Fix permissionschmod 600 /etc/mantis/certs/server.keychown mantis:mantis /etc/mantis/certs/server.keyWrong certificate format:
# Convert DER to PEMopenssl x509 -in cert.der -inform DER -out cert.pem -outform PEM
# Convert PKCS12 to PEMopenssl pkcs12 -in cert.p12 -out cert.pem -nodesNext Steps
Section titled “Next Steps”- mTLS Authentication - Configure mutual TLS
- Thumbprint Mode - Self-signed certificate mode
- CA-Signed Mode - PKI-based authentication
- Key Rotation - Certificate renewal procedures
