Skip to content

Agent Troubleshooting

Diagnose and resolve common SSH-KLM agent issues.

Terminal window
# Check agent status
sudo systemctl status ssh-klm-agent
# View recent logs
sudo journalctl -u ssh-klm-agent -n 100
# Follow logs in real-time
sudo journalctl -u ssh-klm-agent -f
# Agent self-test
sudo ssh-klm-agent diagnose

Symptoms: Agent shows “disconnected” in UI

Diagnosis:

Terminal window
# Test connectivity
curl -v https://ssh-klm.example.com/health
# Check DNS resolution
nslookup ssh-klm.example.com
# Test with agent
sudo ssh-klm-agent test-connection

Solutions:

  1. Verify server URL in config
  2. Check firewall allows outbound 443/8443
  3. Validate registration token
  4. Check proxy settings if applicable

Symptoms: registration failed: invalid token

Solutions:

  1. Generate new registration token
  2. Check token hasn’t expired
  3. Verify token host limit not reached
Terminal window
# Re-register agent
sudo ssh-klm-agent configure \
--server https://ssh-klm.example.com \
--token NEW_TOKEN \
--force

Symptoms: Scan completes with 0 keys

Diagnosis:

Terminal window
# Check paths being scanned
sudo ssh-klm-agent config show | grep -A10 discovery
# Manual check
sudo ls -la /home/*/.ssh/

Solutions:

  1. Verify discovery paths in config
  2. Check agent has read permissions
  3. Ensure SSH directories exist
Terminal window
# Test discovery manually
sudo ssh-klm-agent discovery run --dry-run

Symptoms: Agent using excessive memory

Solutions:

  1. Reduce concurrent scans:
resources:
maxConcurrentScans: 1
  1. Increase scan interval
  2. Exclude large directories

Symptoms: Service restarts frequently

Diagnosis:

Terminal window
# Check for crash logs
sudo journalctl -u ssh-klm-agent | grep -i "panic\|fatal\|error"
# Check system resources
free -h
df -h

Solutions:

  1. Check disk space
  2. Verify memory available
  3. Update to latest agent version

Symptoms: TLS handshake failures

Solutions:

Terminal window
# Update CA certificates
sudo update-ca-certificates
# Or specify CA in config
server:
tls:
caCert: /path/to/ca.crt

Enable verbose logging:

logging:
level: debug

Or via environment:

Terminal window
SSHKLM_LOG_LEVEL=debug sudo ssh-klm-agent run
Terminal window
# Generate diagnostic bundle
sudo ssh-klm-agent support-bundle --output /tmp/agent-diag.tar.gz
# Contents:
# - Configuration (secrets redacted)
# - Recent logs
# - System information
# - Network diagnostics