Agent Enrollment
This guide covers the complete agent enrollment process, from generating enrollment tokens in the admin console to verifying successful enrollment and managing agent certificates.
Overview
The Tamandua agent enrollment process uses a secure token-based system:
- Administrator generates an enrollment token in the admin console
- Token is used during agent installation
- Agent exchanges the token for credentials via CSR (Certificate Signing Request)
- Agent receives a signed certificate and JWT for authentication
- Agent connects to the backend using mTLS
┌─────────────┐ 1. Generate Token ┌─────────────┐
│ Admin │ ─────────────────────────► │ Backend │
│ Console │ ◄───────────────────────── │ Server │
└─────────────┘ Token returned └──────┬──────┘
│ │
│ 2. Provide token to agent │
▼ │
┌─────────────┐ 3. Token + CSR ┌──────▼──────┐
│ Agent │ ─────────────────────────► │ Enrollment │
│ Install │ ◄───────────────────────── │ API │
└─────────────┘ JWT + Certificate └─────────────┘
Generate Enrollment Token
Via Admin Console
- Log in to the Tamandua admin console
- Navigate to Settings > Agents > Enrollment
- Click Generate Token
- Configure token options:
| Option | Description | Default |
|---|---|---|
| Expiration | How long the token is valid | 24 hours |
| Usage Limit | Number of agents that can use this token | Unlimited |
| Organization | Organization for enrolled agents | Current org |
| Tags | Automatic tags applied to enrolled agents | None |
| Performance Profile | Default performance profile | Balanced |
- Click Create Token
- Copy the token securely (displayed only once)
Via API
# Generate enrollment token via API
curl -X POST "https://tamandua.treantlab.org/api/v1/admin/enrollment-tokens" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"expires_in_hours": 24,
"max_uses": 100,
"tags": ["production", "datacenter-east"],
"performance_profile": "balanced"
}'
# Response:
{
"token": "tam_enroll_abc123xyz789...",
"expires_at": "2026-05-10T14:30:00Z",
"max_uses": 100,
"uses": 0
}
Token Formats
| Format | Example | Use Case |
|---|---|---|
| Standard | tam_enroll_abc123... | Single organization |
| Multi-org | tam_enroll_org:ORGID:abc123... | MSSP deployments |
| Time-limited | tam_enroll_exp:TIMESTAMP:abc123... | Short-lived tokens |
Enroll Agent
During Installation
The recommended approach is to provide the token during installation:
Windows
# The current MSI installs an unprovisioned agent and rejects token properties
msiexec /i tamandua-agent.msi /qn
# Enroll with the direct binary; token is prompted without echo
tamandua-agent.exe install
Linux
# After package installation; token is prompted without echo
sudo tamandua-agent install
macOS Preview/Experimental
# After preview PKG installation, if available for your release
sudo /Library/Application\ Support/Tamandua/tamandua-agent install \
--server "wss://agents.tamandua.treantlab.org:8443/socket/agent"
Manual Enrollment
If the agent was installed without a token:
# Enroll; token is prompted without echo
tamandua-agent install
# With custom server URL (self-hosted)
tamandua-agent install \
--server "wss://your-server.example.com:8443/socket/agent" \
--enrollment-url "https://your-server.example.com"
Enrollment Options
| Option | Description | Required |
|---|---|---|
| interactive prompt | Enrollment token, read without echo | Default |
--token-stdin | Read the enrollment token from standard input for automation | No |
--server | WebSocket server URL | No (uses default) |
--enrollment-url | HTTPS enrollment API URL | No (derived from server) |
--org-id | Organization ID | No (from token) |
--name | Service name | No (default: TamanduaAgent) |
--no-driver | Skip kernel driver (Windows) | No |
For unattended enrollment, the launcher must write the token directly to the
agent's standard input and add --token-stdin. Never interpolate it into a
shell command, process argument list, diagnostic bundle, or log.
Verify Enrollment
Check Agent Status
# Windows
sc query TamanduaAgent
# Linux
sudo systemctl status tamandua-agent
# macOS Preview
sudo launchctl list | grep tamandua
Verify Certificate
# Check certificate exists
# Windows
dir "C:\ProgramData\Tamandua\config\cert.pem"
# Linux
ls -la /var/lib/tamandua/config/cert.pem
# macOS Preview
ls -la "/Library/Application Support/Tamandua/config/cert.pem"
# View certificate details
openssl x509 -in /var/lib/tamandua/config/cert.pem -text -noout
Verify in Admin Console
- Log in to the admin console
- Navigate to Agents > All Agents
- Locate the new agent by hostname or agent ID
- Verify status shows Online
Check Agent Logs
# Windows
Get-Content "C:\ProgramData\Tamandua\logs\agent.log" -Tail 50 | Select-String "enroll"
# Linux
sudo grep -i enroll /var/lib/tamandua/logs/agent.log
# macOS Preview
grep -i enroll "/Library/Application Support/Tamandua/logs/agent.log"
Certificate Management
Certificate Lifecycle
Tamandua uses short-lived certificates with automatic rotation:
| Phase | Duration | Action |
|---|---|---|
| Initial Enrollment | Day 0 | Certificate issued |
| Valid Period | 30 days | Normal operation |
| Renewal Window | Days 20-30 | Auto-renewal attempted |
| Expired | After Day 30 | Agent generates new CSR |
Automatic Certificate Renewal
The agent automatically renews certificates before expiration:
- Agent detects certificate approaching expiration (10 days before)
- Agent generates new CSR (Certificate Signing Request)
- CSR sent to enrollment API with existing JWT
- New certificate issued and stored
- Connection re-established with new certificate
Manual Certificate Renewal
If automatic renewal fails:
# Force certificate renewal (requires valid JWT)
tamandua-agent renew-certificate
# Or re-enroll; token is prompted without echo
tamandua-agent install
Certificate Files
| File | Purpose | Permissions |
|---|---|---|
cert.pem | Agent certificate | Read-only (root/SYSTEM) |
key.pem | Private key | Read-only (root/SYSTEM), 600 |
ca-bundle.pem | CA certificate chain | Read-only |
View Certificate Details
# View certificate
openssl x509 -in /var/lib/tamandua/config/cert.pem -text -noout
# Check expiration
openssl x509 -in /var/lib/tamandua/config/cert.pem -enddate -noout
# Verify certificate chain
openssl verify -CAfile /var/lib/tamandua/config/ca-bundle.pem \
/var/lib/tamandua/config/cert.pem
Re-Enrollment
When to Re-Enroll
- Certificate expired and auto-renewal failed
- Agent moved to different organization
- Security incident requiring credential rotation
- Corruption of agent credentials
Re-Enrollment Process
- Generate a new enrollment token in the admin console
- Stop the agent service
- Remove existing credentials (optional but recommended)
- Re-run enrollment
# Stop agent
sudo systemctl stop tamandua-agent # Linux
Stop-Service TamanduaAgent # Windows
# Remove old credentials (optional)
sudo rm /var/lib/tamandua/config/{cert,key,ca-bundle}.pem
# Re-enroll; token is prompted without echo
sudo tamandua-agent install
# Start agent
sudo systemctl start tamandua-agent
Bulk Re-Enrollment
For re-enrolling multiple agents:
- Generate a multi-use token with appropriate usage limit
- Deploy re-enrollment script via your management tool
#!/bin/bash
# The management tool must connect a secret directly to this script's stdin.
# Stop agent
sudo systemctl stop tamandua-agent
# Clear old state
sudo rm -f /var/lib/tamandua/config/{cert,key}.pem
# Re-enroll from redirected stdin; no token argument or environment variable
sudo tamandua-agent install --token-stdin
# Restart
sudo systemctl start tamandua-agent
Token Security
Best Practices
- Short expiration: Use 24-hour tokens for planned deployments
- Limited uses: Set max_uses appropriate to your deployment
- Secure transmission: Never send tokens via email; use secure channels
- Rotate regularly: Don't reuse tokens across deployments
- Audit token usage: Review enrollment logs regularly
Token Revocation
If a token is compromised:
- Navigate to Settings > Agents > Enrollment Tokens
- Locate the compromised token
- Click Revoke
- Review enrolled agents for unauthorized entries
# Revoke token via API
curl -X DELETE "https://tamandua.treantlab.org/api/v1/admin/enrollment-tokens/TOKEN_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
Troubleshooting
Token Validation Failed
Error: "Invalid or expired enrollment token" Causes:- Token has expired
- Token has reached usage limit
- Token was revoked
- Network issues reaching enrollment API
- Generate a new token in the admin console
- Verify network connectivity:
curl -v https://tamandua.treantlab.org/api/v1/agent/health
- Check system clock is accurate (important for token validation)
Certificate Signing Failed
Error: "CSR signing failed" or "Certificate issuance error" Causes:- Organization enrollment quota exceeded
- Backend CA service unavailable
- Invalid CSR format
- Check organization quotas in admin console
- Verify backend services are running
- Check agent logs for detailed error:
sudo grep -i "csr\|certificate" /var/lib/tamandua/logs/agent.log
Agent Not Appearing in Console
Causes:- Enrollment succeeded but WebSocket connection failed
- Firewall blocking agent communication
- DNS resolution issues
- Verify enrollment completed:
ls -la /var/lib/tamandua/config/cert.pem
- Check WebSocket connectivity:
curl -v https://agents.tamandua.treantlab.org:8443/socket/agent
- Review agent logs for connection errors
Certificate Renewal Failed
Error: "Auto-renewal failed" or "JWT expired" Causes:- JWT expired before renewal window
- Network outage during renewal
- Backend certificate service unavailable
- Re-enroll with new token
- If JWT is still valid, force renewal:
sudo tamandua-agent renew-certificate
Permission Denied During Enrollment
Error: "Permission denied" or "Access denied" Causes:- Not running as administrator/root
- File system permissions incorrect
- SELinux/AppArmor blocking
# Run as root; token is prompted without echo
sudo tamandua-agent install
# Check SELinux (RHEL/CentOS)
sudo ausearch -m avc -ts recent | grep tamandua
# Check AppArmor (Ubuntu/Debian)
sudo dmesg | grep apparmor | grep tamandua
Multi-Organization Enrollment (MSSP)
For managed service providers managing multiple organizations:
Generate Multi-Org Token
# Via API with organization scope
curl -X POST "https://tamandua.treantlab.org/api/v1/admin/enrollment-tokens" \
-H "Authorization: Bearer MSSP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"organization_id": "customer-org-id",
"expires_in_hours": 48,
"max_uses": 50
}'
Customer-Specific Tokens
Each customer organization should have separate tokens:
- Navigate to Organizations > [Customer Org] > Enrollment
- Generate token scoped to that organization
- Provide token to customer for deployment
Enrollment Segregation
Agents enrolled with organization-scoped tokens:
- Only visible to that organization's users
- Policies and rules are organization-specific
- Telemetry is segregated by organization
Next Steps
- Agent Configuration - Configure agent settings
- Agent Overview - Return to agent overview
- Windows Installation - Platform-specific installation