CA-Signed Mode
CA-Signed Mode
Section titled “CA-Signed Mode”CA-signed mode uses a Certificate Authority to issue and validate client certificates for Tarsus agents.
Overview
Section titled “Overview”How CA-Signed Mode Works
Section titled “How CA-Signed Mode Works”Authentication Flow
Section titled “Authentication Flow”When to Use CA-Signed Mode
Section titled “When to Use CA-Signed Mode”Ideal Use Cases
Section titled “Ideal Use Cases”| Scenario | Why CA-Signed Mode |
|---|---|
| Enterprise environments | Centralized certificate management |
| Large deployments | Scalable agent onboarding |
| Compliance requirements | PKI audit trail |
| Existing PKI | Reuse existing infrastructure |
| Automated provisioning | Certificate lifecycle management |
Comparison with Thumbprint Mode
Section titled “Comparison with Thumbprint Mode”| Aspect | Thumbprint | CA-Signed |
|---|---|---|
| Certificate issuance | Self-signed per agent | Central CA |
| Trust model | Individual trust | Hierarchical trust |
| Onboarding | Manual per agent | Automated possible |
| Revocation | Per-thumbprint | CA CRL/OCSP |
| Complexity | Lower | Higher |
| Scalability | Limited | Excellent |
CA Infrastructure
Section titled “CA Infrastructure”CA Options
Section titled “CA Options”| Option | Description | Complexity |
|---|---|---|
| Self-managed CA | Create your own CA | Medium |
| HashiCorp Vault | Vault PKI secrets engine | Medium |
| AWS Private CA | AWS Certificate Manager PCA | Low |
| Step CA | Open source ACME CA | Medium |
| Enterprise CA | Active Directory CS | High |
Self-Managed CA Setup
Section titled “Self-Managed CA Setup”Create a private CA for Mantis:
# Create CA directory structuremkdir -p /etc/mantis/ca/{certs,crl,newcerts,private}chmod 700 /etc/mantis/ca/privatetouch /etc/mantis/ca/index.txtecho 1000 > /etc/mantis/ca/serial
# Generate CA private keyopenssl genrsa -aes256 \ -out /etc/mantis/ca/private/ca.key 4096chmod 400 /etc/mantis/ca/private/ca.key
# Generate CA certificateopenssl req -new -x509 \ -key /etc/mantis/ca/private/ca.key \ -out /etc/mantis/ca/certs/ca.crt \ -days 3650 \ -subj "/CN=Mantis Internal CA/O=Your Organization/C=US"CA Configuration File
Section titled “CA Configuration File”Create /etc/mantis/ca/openssl.cnf:
[ ca ]default_ca = CA_default
[ CA_default ]dir = /etc/mantis/cacerts = $dir/certscrl_dir = $dir/crlnew_certs_dir = $dir/newcertsdatabase = $dir/index.txtserial = $dir/serialprivate_key = $dir/private/ca.keycertificate = $dir/certs/ca.crtdefault_days = 365default_md = sha256policy = policy_loose
[ policy_loose ]countryName = optionalstateOrProvinceName = optionallocalityName = optionalorganizationName = optionalorganizationalUnitName = optionalcommonName = supplied
[ client_cert ]basicConstraints = CA:FALSEkeyUsage = digitalSignatureextendedKeyUsage = clientAuthsubjectKeyIdentifier = hashauthorityKeyIdentifier = keyid,issuerThorax Configuration
Section titled “Thorax Configuration”Enable CA-Signed Mode
Section titled “Enable CA-Signed Mode”[tls]auth_mode = "ca_signed"
# Server certificatecert_path = "/etc/mantis/certs/thorax.crt"key_path = "/etc/mantis/certs/thorax.key"
# CA certificate for validating clientsca_cert_path = "/etc/mantis/ca/certs/ca.crt"Environment Variables
Section titled “Environment Variables”export MANTIS_TLS_AUTH_MODE=ca_signedexport MANTIS_TLS_CERT_PATH=/etc/mantis/certs/thorax.crtexport MANTIS_TLS_KEY_PATH=/etc/mantis/certs/thorax.keyexport MANTIS_TLS_CA_CERT_PATH=/etc/mantis/ca/certs/ca.crtAgent Approval
Section titled “Agent Approval”CA-signed mode controls only how the client certificate is trusted at the TLS layer — it does not auto-approve registrations. New agents still register through Mandible and follow the normal approval path; the SHA-256 thumbprint is recorded for audit and revocation regardless of mode.
To approve agents automatically during onboarding, issue each agent a
single-use registration token (configured via TARSUS__REGISTRATION__TOKEN),
which approves the agent on registration. Otherwise, agents land in the pending
queue for manual approval.
Issuing Client Certificates
Section titled “Issuing Client Certificates”Manual Certificate Issuance
Section titled “Manual Certificate Issuance”On the CA server:
# 1. Generate CSR on agent# (Run this on the Tarsus server)openssl req -new -nodes \ -keyout /etc/tarsus/key.pem \ -out /tmp/agent.csr \ -subj "/CN=web-prod-01/O=Production Team"
# 2. Copy CSR to CA serverscp /tmp/agent.csr ca-server:/tmp/
# 3. Sign certificate (on CA server)openssl ca -config /etc/mantis/ca/openssl.cnf \ -extensions client_cert \ -in /tmp/agent.csr \ -out /tmp/agent.crt
# 4. Copy certificate back to agentscp /tmp/agent.crt agent-server:/etc/tarsus/cert.pem
# 5. Copy CA certificate to agentscp /etc/mantis/ca/certs/ca.crt agent-server:/etc/tarsus/ca.crtAutomated Certificate Issuance
Section titled “Automated Certificate Issuance”Using HashiCorp Vault:
# Enable PKI secrets enginevault secrets enable pkivault secrets tune -max-lease-ttl=87600h pki
# Generate root CAvault write pki/root/generate/internal \ common_name="Mantis CA" \ ttl=87600h
# Create role for agent certificatesvault write pki/roles/mantis-agent \ allowed_domains="mantis.local" \ allow_subdomains=true \ max_ttl=8760h \ key_type=rsa \ key_bits=2048
# Issue certificate for agentvault write pki/issue/mantis-agent \ common_name="web-prod-01.mantis.local" \ ttl=8760hCertificate Templates
Section titled “Certificate Templates”Standard client certificate template:
| Field | Value |
|---|---|
| CN | Agent hostname or identifier |
| O | Team or tenant name |
| Key Usage | Digital Signature |
| Extended Key Usage | Client Authentication |
| Validity | 365 days |
Tarsus Configuration
Section titled “Tarsus Configuration”Client Certificate Setup
Section titled “Client Certificate Setup”[tls]cert_path = "/etc/tarsus/cert.pem"key_path = "/etc/tarsus/key.pem"
# CA certificate for verifying Thoraxca_cert_path = "/etc/tarsus/ca.crt"Certificate Installation
Section titled “Certificate Installation”# Install certificate filescp agent.crt /etc/tarsus/cert.pemcp agent.key /etc/tarsus/key.pemcp ca.crt /etc/tarsus/ca.crt
# Set permissionschmod 644 /etc/tarsus/cert.pem /etc/tarsus/ca.crtchmod 600 /etc/tarsus/key.pemchown root:root /etc/tarsus/*.pem /etc/tarsus/ca.crtCertificate Lifecycle
Section titled “Certificate Lifecycle”Renewal Process
Section titled “Renewal Process”Automated Renewal
Section titled “Automated Renewal”Using cert-manager (Kubernetes):
apiVersion: cert-manager.io/v1kind: Certificatemetadata: name: tarsus-clientspec: secretName: tarsus-client-tls duration: 8760h # 1 year renewBefore: 720h # 30 days before issuerRef: name: mantis-ca kind: ClusterIssuer commonName: web-prod-01 usages: - client auth - digital signatureRevocation
Section titled “Revocation”Certificate revocation options:
| Method | Description | Latency |
|---|---|---|
| CRL | Certificate Revocation List | Minutes-hours |
| OCSP | Online Certificate Status Protocol | Real-time |
| Mantis revocation | Thumbprint revocation | Immediate |
Revoke in Mantis (always works):
mantisctl cert revoke "<REGISTRATION_UUID>" \ --reason "Certificate compromised"Security Considerations
Section titled “Security Considerations”CA Security
Section titled “CA Security”| Aspect | Recommendation |
|---|---|
| CA key storage | HSM or encrypted storage |
| CA access | Limited, audited access |
| CA backup | Secure offline backup |
| CA validity | 10+ years |
Defense in Depth
Section titled “Defense in Depth”CA-signed mode provides layered security:
┌─────────────────────────────────────────────────────────────┐│ Security Layers │├─────────────────────────────────────────────────────────────┤│ ││ Layer 1: TLS encryption ││ All communication encrypted ││ ││ Layer 2: CA validation ││ Only CA-signed certificates accepted ││ ││ Layer 3: Thumbprint verification ││ Certificate must be registered in Mantis ││ ││ Layer 4: Registration status ││ Agent must be approved (not pending/revoked) ││ │└─────────────────────────────────────────────────────────────┘Certificate Subject Validation
Section titled “Certificate Subject Validation”In CA-signed mode, trust is established by the CA signature: any certificate
signed by the configured CA is accepted at the TLS layer, and the SHA-256
thumbprint is checked at the application layer. There are no required_org /
required_ou subject-field filters — restrict which certificates are issued by
controlling your CA’s issuance policy.
Multi-CA Setup
Section titled “Multi-CA Setup”Intermediate CA
Section titled “Intermediate CA”For large deployments, use intermediate CAs:
Root CA (offline) └── Intermediate CA (online) ├── Agent certificates └── Server certificatesMultiple CAs
Section titled “Multiple CAs”Trust multiple CAs for different environments:
[tls]# Concatenate multiple CA certificates into a single fileca_cert_path = "/etc/mantis/certs/combined-ca.crt"Or concatenate CA certificates:
cat production-ca.crt staging-ca.crt > combined-ca.crtTroubleshooting
Section titled “Troubleshooting”Certificate Not Trusted
Section titled “Certificate Not Trusted”Problem: certificate verify failed: unable to get local issuer certificate
Diagnosis:
# Verify certificate chainopenssl verify -CAfile /etc/mantis/ca/certs/ca.crt \ /etc/tarsus/cert.pem
# Check CA file on Thoraxcat /etc/mantis/certs/ca.crtSolution:
# Ensure CA certificate matchesdiff /etc/mantis/ca/certs/ca.crt /path/used/by/thorax/ca.crt
# If intermediate CA, include full chaincat intermediate.crt root.crt > ca-chain.crtThumbprint Mismatch After Renewal
Section titled “Thumbprint Mismatch After Renewal”Problem: Agent rejected after certificate renewal
Solution:
# In CA-signed mode trust derives from the CA signature, so a renewed cert from the same# CA is accepted without re-registration. If a registration tracks a specific thumbprint,# re-register the new thumbprint (revoke old, pre-register new):mantisctl cert revoke "$OLD_REGISTRATION_ID" --reason "certificate renewal"mantisctl cert pre-register --name "web-prod-01" --thumbprint "$(tarsus show-thumbprint)"Agent Stuck in Pending
Section titled “Agent Stuck in Pending”Problem: CA-signed clients register but stay pending approval
Check:
# Confirm the agent was given a registration token (token-based auto-approval)journalctl -u mantis-tarsus | grep -i "registration"
# Otherwise approve it manuallymantisctl cert approve "$REGISTRATION_ID"CA-signed mode does not auto-approve agents — use a single-use registration token
(TARSUS__REGISTRATION__TOKEN) for automatic approval, or approve from the
pending queue.
Common Errors
Section titled “Common Errors”| Error | Cause | Solution |
|---|---|---|
certificate signed by unknown authority | CA not trusted | Add CA to ca_cert_path |
certificate has expired | Cert expired | Renew certificate |
certificate is not valid for any names | Wrong CN | Check certificate CN |
registration pending | Awaiting approval | Use a token or manually approve |
Migration from Thumbprint Mode
Section titled “Migration from Thumbprint Mode”Migration Steps
Section titled “Migration Steps”- Deploy CA infrastructure
- Configure Thorax for CA-signed mode
- Issue CA-signed certificates to agents
- Update agent configurations
- Agents re-connect with new certificates
Cutover Migration
Section titled “Cutover Migration”auth_mode accepts only thumbprint or ca_signed — there is no combined
“both” mode. Migration is a cutover: keep Thorax in thumbprint mode until every
agent holds a CA-signed certificate, then switch Thorax to ca_signed and
restart.
[tls]# After all agents have CA-signed certs, switch to ca_signed and restart Thoraxauth_mode = "ca_signed"ca_cert_path = "/etc/mantis/ca/certs/ca.crt"Rollback Plan
Section titled “Rollback Plan”If issues occur during migration:
# Revert to thumbprint mode[tls]auth_mode = "thumbprint"Existing thumbprint registrations remain valid.
Best Practices
Section titled “Best Practices”1. Protect the CA
Section titled “1. Protect the CA”- Store CA private key in HSM or encrypted storage
- Limit CA access to authorized personnel
- Maintain offline backups
- Audit all certificate issuance
2. Use Short-Lived Certificates
Section titled “2. Use Short-Lived Certificates”| Certificate Type | Recommended Validity |
|---|---|
| Root CA | 10-20 years |
| Intermediate CA | 5-10 years |
| Agent certificates | 1 year |
3. Automate Certificate Management
Section titled “3. Automate Certificate Management”Use tools like:
- cert-manager (Kubernetes)
- HashiCorp Vault
- Step CA
- ACME protocol
4. Monitor Expiration
Section titled “4. Monitor Expiration”# List client certificates expiring within the threshold (default 30 days)curl -H "Authorization: Bearer $TOKEN" \ "https://api.mantis.example.com/api/v1/certificates/expiring?days=30"5. Plan for CA Renewal
Section titled “5. Plan for CA Renewal”- Document CA renewal procedure
- Test CA renewal in staging
- Plan for certificate re-issuance
- Communicate timeline to teams
Next Steps
Section titled “Next Steps”- mTLS Authentication - mTLS overview
- Thumbprint Mode - Alternative authentication
- Key Rotation - Certificate renewal procedures
