SSH Keys

SSH Key Management

Discover, rotate, and manage SSH keys across your infrastructure.

SSH Key Management

TigerTrust provides comprehensive SSH key lifecycle management alongside certificate management.

Overview

FeatureDescription
DiscoveryScan hosts for SSH keys and authorized_keys
InventoryCentral visibility of all SSH keys
RotationAutomated key rotation with zero downtime
DeploymentDeploy public keys to authorized_keys
AuditTrack all SSH key operations

SSH Key Discovery

The agent discovers SSH keys from:

  • */home/\/.ssh/ - User SSH directories
  • /root/.ssh/ - Root user keys
  • /etc/ssh/ - Host keys
  • authorized_keys - Authorized public keys

Configuration

ssh:
  enabled: true
  scan_paths:
    - /home
    - /root/.ssh
    - /etc/ssh
  scan_authorized_keys: true
  scan_known_hosts: false
  key_types:
    - rsa
    - ecdsa
    - ed25519

Discovered Key Information

For each discovered key:

{
  "fingerprint": "SHA256:abc123...",
  "keyType": "ssh-ed25519",
  "keyBits": 256,
  "keyPath": "/home/deploy/.ssh/id_ed25519",
  "publicKeyPath": "/home/deploy/.ssh/id_ed25519.pub",
  "hasPassphrase": true,
  "isHostKey": false,
  "isUserKey": true,
  "publicKeyOnly": false,
  "hostname": "web-server-1",
  "username": "deploy",
  "createdAt": "2024-01-15T10:30:00Z",
  "lastModified": "2024-01-15T10:30:00Z"
}

Authorized Keys Discovery

TigerTrust tracks authorized_keys entries:

{
  "fingerprint": "SHA256:xyz789...",
  "keyType": "ssh-rsa",
  "publicKey": "ssh-rsa AAAA...",
  "comment": "[email protected]",
  "filePath": "/home/deploy/.ssh/authorized_keys",
  "lineNumber": 3,
  "username": "deploy",
  "hostname": "web-server-1",
  "isActive": true,
  "addedBy": "[email protected]",
  "expiresAt": null
}

SSH Key Operations

Generate New Key Pair

Via API:

curl -X POST "https://api.tigertrust.io/api/ssh-keys/generate" \
  -H "X-Agent-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "keyType": "ed25519",
    "comment": "deploy@production",
    "passphrase": "optional_passphrase"
  }'

Deploy Public Key

Deploy a public key to authorized_keys:

curl -X POST "https://api.tigertrust.io/api/ssh-keys/deploy" \
  -H "X-Agent-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "publicKey": "ssh-ed25519 AAAA... [email protected]",
    "targetHosts": ["web-server-1", "web-server-2"],
    "targetUser": "deploy",
    "agentId": "agent-prod-01"
  }'

Remove Key from Authorized Keys

curl -X POST "https://api.tigertrust.io/api/ssh-keys/remove" \
  -H "X-Agent-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "fingerprint": "SHA256:xyz789...",
    "targetHosts": ["web-server-1"],
    "targetUser": "deploy"
  }'

Rotate SSH Key

Generate new key pair and replace existing key:

curl -X POST "https://api.tigertrust.io/api/ssh-keys/:id/rotate" \
  -H "X-Agent-API-Key: ak_your_key" \
  -H "Content-Type: application/json" \
  -d '{
    "keyType": "ed25519",
    "updateAuthorizedKeys": true,
    "retainOldKeyDays": 7
  }'

Agent Task Types

The agent handles these SSH-related tasks:

Task TypeDescription
ssh_discoveryScan for SSH keys
ssh_key_generateGenerate new key pair
ssh_key_deployAdd key to authorized_keys
ssh_key_removeRemove key from authorized_keys
ssh_key_rotateRotate existing key

Dashboard Features

SSH Key Inventory

View all discovered SSH keys with:

  • Key type and fingerprint
  • Location (host, user, path)
  • Associated authorized_keys entries
  • Last rotation date
  • Compliance status

Key Rotation Policies

Configure automatic rotation:

  1. Navigate to SSH Keys → Policies
  2. Create rotation policy:
- Rotation interval (e.g., 90 days)

- Key type requirements (ed25519 preferred)

- Notification settings

- Approval workflow (optional)

API Reference

List SSH Keys

GET /api/ssh-keys
Query Parameters:
  • keyType - Filter by type (rsa, ecdsa, ed25519)
  • hostname - Filter by hostname
  • isHostKey - Filter host keys only
  • hasAuthorizedEntries - Filter keys with authorized_keys presence

Get SSH Key Details

GET /api/ssh-keys/:id

SSH Key Statistics

GET /api/ssh-keys/stats
Response:
{
  "data": {
    "total": 250,
    "byType": {
      "rsa": 100,
      "ecdsa": 50,
      "ed25519": 100
    },
    "hostKeys": 30,
    "userKeys": 220,
    "rotationDue": 15,
    "withoutPassphrase": 80
  }
}

Best Practices

  1. Prefer Ed25519 - Modern, secure, and fast
  2. Rotate regularly - 90-day rotation recommended
  3. Use passphrases - Protect private keys at rest
  4. Audit authorized_keys - Remove unused entries
  5. Separate user and deploy keys - Different keys for different purposes
  6. Monitor key usage** - Track which keys are actively used