Skip to content

mTLS Authentication

Mutual TLS (mTLS) provides bidirectional authentication between Thorax and Tarsus agents.

Mutual TLS extends standard TLS by requiring both parties to present certificates:

BenefitDescription
Mutual trustBoth parties verify each other
Strong authenticationCryptographic proof of identity
No shared secretsPrivate keys never transmitted
Certificate-basedIntegrates with PKI infrastructure

Mantis supports two mTLS authentication modes:

ModeCA RequiredComplexityUse Case
ThumbprintNoLowQuick setup, isolated agents
CA-SignedYesMediumCentralized management, PKI

Agents use self-signed certificates verified by thumbprint:

┌─────────────────────────────────────────────────────────────┐
│ Thumbprint Mode Authentication │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. Agent generates self-signed certificate │
│ 2. Admin registers thumbprint in Mantis │
│ 3. Agent connects with certificate │
│ 4. Thorax verifies certificate matches thumbprint │
│ │
│ Security: TLS validates cert, app validates thumbprint │
│ │
└─────────────────────────────────────────────────────────────┘

See Thumbprint Mode for configuration.

Agents use certificates signed by a trusted CA:

┌─────────────────────────────────────────────────────────────┐
│ CA-Signed Mode Authentication │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. CA issues client certificates │
│ 2. Thorax trusts the CA │
│ 3. Agent connects with CA-signed certificate │
│ 4. TLS layer validates CA signature │
│ 5. Auto-approved — CA-signed clients accepted without │
│ a separate thumbprint lookup │
│ │
│ Security: TLS validates CA chain; PKI trust is sufficient │
│ │
└─────────────────────────────────────────────────────────────┘

See CA-Signed Mode for configuration.

[tls]
auth_mode = "thumbprint" # or "ca_signed"
# Server certificate
cert_path = "/etc/mantis/certs/thorax.crt"
key_path = "/etc/mantis/certs/thorax.key"
# CA certificate (required for ca_signed mode)
ca_cert_path = "/etc/mantis/certs/ca.crt"
VariableDescriptionDefault
MANTIS_TLS_AUTH_MODEAuthentication modethumbprint
MANTIS_TLS_CERT_PATHServer certificate-
MANTIS_TLS_KEY_PATHServer private key-
MANTIS_TLS_CA_CERT_PATHCA certificate-
[tls]
cert_path = "/etc/tarsus/cert.pem"
key_path = "/etc/tarsus/key.pem"
# Server verification
ca_cert_path = "/etc/tarsus/ca.crt"
VariableDescriptionDefault
MANTIS_TLS_CERT_PATHClient certificate-
MANTIS_TLS_KEY_PATHClient private key-
MANTIS_TLS_CA_CERT_PATHCA certificate-
MANTIS_TLS_SERVER_THUMBPRINTExpected Thorax server cert thumbprint (SHA-256 hex); required with auto-generated certs in thumbprint mode-
StateDescriptionAction Required
TLS EstablishedmTLS handshake completeNone
AuthenticatingVerifying registrationWait
AuthenticatedAgent approvedReady for commands
RejectedInvalid certificateCheck registration

Thorax validates client certificates:

┌─────────────────────────────────────────────────────────────┐
│ Thorax Validation Steps │
├─────────────────────────────────────────────────────────────┤
│ │
│ 1. TLS handshake - certificate format valid │
│ 2. Signature check - certificate properly signed │
│ 3. Expiration check - certificate not expired │
│ 4. CA check: if client cert is CA-signed → auto-approved │
│ (thumbprint steps below are skipped; an audit record │
│ is written to Mandible non-blocking) │
│ 5. Thumbprint lookup - registered in Mantis │
│ (thumbprint mode only, or non-CA-signed clients) │
│ 6. Registration status - approved (not pending/revoked) │
│ │
└─────────────────────────────────────────────────────────────┘

Tarsus validates the server certificate:

CheckPurposeConfigurable
HostnamePrevent MITMYes
CA chainTrusted issuerYes
ExpirationValid certNo
Terminal window
# Get thumbprint from certificate
openssl x509 -in cert.pem -fingerprint -sha256 -noout
# Output:
# SHA256 Fingerprint=AB:CD:EF:12:34:56:78:90:...
# Convert to Mantis format (lowercase, no colons)
openssl x509 -in cert.pem -fingerprint -sha256 -noout | \
sed 's/SHA256 Fingerprint=//' | tr -d ':' | tr '[:upper:]' '[:lower:]'
Terminal window
# Pre-register by thumbprint
mantisctl cert pre-register --name "agent-name" \
--thumbprint "abcdef1234567890..."
# View a registration's details (by registration ID or thumbprint prefix)
mantisctl cert show "agent-registration-id"
AspectRecommendation
Key lengthRSA 2048+ or ECDSA P-256+
AlgorithmSHA-256 or better
Validity1 year maximum
StorageEncrypted at rest
Terminal window
# Secure private key permissions
chmod 600 /etc/tarsus/key.pem
chown root:root /etc/tarsus/key.pem
# Verify permissions
ls -la /etc/tarsus/key.pem
# Expected: -rw------- root root

When a certificate is compromised:

  1. Revoke registration in Mantis
  2. Generate new certificate on the agent
  3. Register new thumbprint
  4. Investigate the compromise
Terminal window
# Revoke compromised agent (by registration ID or thumbprint prefix)
mantisctl cert revoke "<REGISTRATION_UUID>" \
--reason "Private key compromised"

Certificate not trusted:

Terminal window
# Check CA configuration
openssl verify -CAfile /etc/mantis/certs/ca.crt \
/etc/tarsus/cert.pem
# Fix: Ensure CA file is correct on both sides

Thumbprint mismatch:

Terminal window
# Get actual thumbprint
tarsus show-thumbprint
# Compare with the registered thumbprint (by registration ID or thumbprint prefix)
mantisctl cert show "agent-registration-id"
# Fix: revoke the stale registration and pre-register the current thumbprint

Certificate expired:

Terminal window
# Check expiration
openssl x509 -in cert.pem -enddate -noout
# Fix: Renew certificate
Terminal window
# Test mTLS connection
openssl s_client -connect thorax.example.com:50051 \
-cert /etc/tarsus/cert.pem \
-key /etc/tarsus/key.pem \
-CAfile /etc/tarsus/ca.crt
# Check Thorax logs
journalctl -u mantis-thorax -f | grep -i tls
# Check Tarsus logs
journalctl -u tarsus -f | grep -i certificate
ErrorCauseSolution
no client certificateAgent didn’t send certCheck Tarsus TLS config
certificate verify failedCA mismatchVerify CA file matches
thumbprint not foundNot registeredPre-register or approve
registration revokedAgent revokedRe-register if appropriate
certificate expiredCert past validityRenew certificate

For production environments:

  • Deploy internal CA
  • Issue certificates centrally
  • Enable automatic renewal
Certificate TypeRotation Period
Server certificatesAnnually
Client certificatesAnnually
CA certificate5-10 years
Terminal window
# Check all certificates
for cert in /etc/mantis/certs/*.crt; do
echo "$cert:"
openssl x509 -in "$cert" -enddate -noout
done
  • Use hardware security modules (HSM) for CA keys
  • Encrypt private keys at rest
  • Limit access to key files
  • Audit key access

Monitor for security issues:

  • Failed authentication attempts
  • Certificate validation errors
  • Unusual connection patterns