Agent Installation & Diagnostics
Platform-specific installation, verification, service management, troubleshooting, and diagnostics for the CF-LSH endpoint agent.
- Only install on systems you own or are authorized to manage.
- Each enrollment token is device-specific. Never reuse tokens.
- Never share credentials or identity files.
Quick Start
Select your platform for step-by-step installation instructions.
Download
Verify
Install
Start service
Verify identity
Service
The agent runs as a system service. All commands require admin or root privileges. First, discover the real service name — do not assume 'cf-lsh-agent'.
The service name, executable path, and registration vary by installation method and version. Always discover them before stopping or replacing anything.
Discover the real Windows service:
Debug Mode
Run the agent in the foreground to see structured output. This is the primary method for diagnosing startup failures, connection issues, and collector errors.
Press Ctrl+C to stop, then restart:
Verify Binary
Compare the installed binary SHA-256 against the published manifest. A mismatch means the installed binary differs from the current release.
Safe Binary Update
Updating the agent binary is not the same as re-enrolling the device. Follow this procedure to replace only the executable without losing identity, configuration, or service registration.
Re-enrolling a device creates a new installation ID and orphaned device record. Instead, replace only the executable while preserving everything else.
Download the new artifact
Verify the artifact SHA-256 against the manifest
Discover the real service name (do not assume cf-lsh-agent)
Discover the registered executable path
Stop the service
Back up the existing executable with a timestamp
Replace only the executable
Preserve all identity and configuration files — do not touch them
Restart the same service
Confirm the agent version changed
Confirm heartbeat and telemetry return HTTP 200
Confirm processesCollected is greater than zero
Heartbeat
The agent sends an authenticated heartbeat every 60 seconds. Heartbeats are required for Connected status — enrollment or approval does not establish connectivity.
Expected
- Accepted → HTTP 200
- Server updates
lastSeenAt - Device → Connected
- Missed → Stale → Disconnected
Troubleshoot
- Verify service is running
- Run agent interactively
- Check manager URL reachability
- Check firewall rules
- Inspect agent logs
Telemetry
System telemetry (CPU, memory, disk, network, OS) submits automatically after heartbeat. Process telemetry uses a separate collector and is persisted as ProcessSnapshot and DeviceProcess records.
Expected
- Authenticated → persisted
- Heartbeat first, telemetry follows
- Record count increases each cycle
- Failed fields → Unavailable
- Healthy = recent report with 200
Metrics Unavailable?
The platform collector failed to query the host. Run interactively to see errors. Compare with host verification commands.
Process Telemetry
Process telemetry is now implemented and runtime-verified on Windows using Toolhelp32 snapshot enumeration. The agent sends ProcessInfoV1, which is persisted as ProcessSnapshot and DeviceProcess records. The UI renders real process names, PIDs, and memory values.
Implementation Status
- ✅ Windows: implemented and verified
- ⬜ Linux: not yet implemented
- ⬜ macOS: not yet implemented
- Two latest snapshots retained
- Unsupported fields → Not reported
Healthy Submission
processesCollected> 0submitResponse status=200- ProcessSnapshot rows exist
- DeviceProcess rows exist
- UI receives latest snapshot
Check agent version — must be process-enabled (e.g. 898dd04 or later)
Run agent interactively to verify process collection
Look for processesCollected=<number> and submitResponse status=200
Verify the service is not running an older binary from a different path
Restart the service after testing
- Skip agent version verification
- Assume process collection works without checking processesCollected > 0
- Fabricate or simulate process data
- Re-enrol the device to fix process telemetry
Connections Telemetry
Connections telemetry is implemented but requires runtime verification on each platform. The agent collects real TCP and UDP connections using platform-native APIs.
The Connections tab currently shows "Waiting for connection telemetry" until the enrolled agent sends its first connection snapshot. This is expected until the Windows service binary is updated and runtime-verified.
Platform Support
- Windows: collector code added via IP Helper API (GetExtendedTcpTable, GetExtendedUdpTable), requires runtime verification
- Linux: collector code added via /proc/net parsing, requires runtime verification
- macOS: collector code added via lsof -i parsing, requires runtime verification
Implementation Details
- TCP and UDP connections
- Local/remote address and port
- Protocol and connection state
- Owning PID and process name
- Max 1000 connections per snapshot
- Latest 2 snapshots retained
- Tenant-scoped persistence
- Same snapshot architecture as process telemetry
- No packet contents
- No geolocation or risk scoring
HTTP Status Reference
HTTP status codes returned by the CF-LSH agent API endpoints for heartbeat, telemetry, and enrollment.
| Error | Meaning | Action |
|---|---|---|
| 200 | Request accepted and persisted successfully. | No action required. |
| 400 | Malformed payload, missing required fields, unsupported schema, or validation failure. | Run agent interactively to see the exact validation error. Check agent version. |
| 401 | Missing, invalid, revoked, or incorrectly loaded permanent agent credential. | Verify credential file exists and is readable. Re-enrol if credential is revoked. |
| 403 | Credential rejected for device or organisation, device access revoked, or tenant authorisation failure. | Confirm credential belongs to the expected device and organisation. |
| 404 | Incorrect manager URL, incorrect API route, outdated agent route, or deployment mismatch. | Verify manager URL and DNS resolution. |
| 409 | Stale sequence, replay, duplicate submission, consumed enrollment token, or identity conflict. | Check system clock. Do not reuse consumed tokens. |
| 429 | Submission frequency too high or rate limiting. | Reduce submission frequency. Verify system clock. |
| 500 | Server persistence, migration, schema, database, or unhandled route failure. | Inspect server logs. Verify deployment health. |
| 502/503/504 | Proxy, deployment, upstream, or temporary availability failure. | Verify deployment status. Retry after infrastructure stabilises. |
Weaken authentication, credential validation, sequence checking, or tenant isolation to make requests pass. Always investigate root cause first.
Host Verification
Compare collected metrics against actual host state.
-NoProfile for service context consistency.Logs
Agent logs are written to platform-specific paths. If no logs exist, run interactively.
Log Sanitisation
Before sharing agent logs or diagnostic output, remove all sensitive values. Sanitized logs should contain only operational values.
Redact before sharing
- Authorization headers
- Bearer tokens
- Enrollment tokens
- Permanent credentials
- Cookies
- API keys
- Database URLs
- Installation IDs*
- Device IDs*
- Private usernames
- Internal IP addresses*
- Email addresses
*Only include if required for the diagnosis.
Safe examples
agentVersion=898dd04processesCollected=155submitResponse status=200heartbeatAccepted=true[REDACTED] rather than removing the entire line.Error Codes
Codes that may appear in agent logs or API responses.
| Error | Meaning | Action |
|---|---|---|
| RATE_LIMIT_UNAVAILABLE | Server rate-limit infrastructure unavailable. | Verify deployment, retry later. Do not reinstall first. |
| INVALID_CREDENTIAL | Agent credential rejected. | Verify identity and enrollment. Re-enroll if revoked. |
| INSTALLATION_ID_MISMATCH | Identity belongs to a different installation. | Inspect identity path and server mapping. |
| NONCE_USED | Duplicate nonce — possible replay. | Verify system clock. Do not disable replay protection. |
| TOKEN_EXPIRED | Enrollment token expired. | Generate a new token from the device page. |
| DEVICE_NOT_FOUND | Device ID not registered. | Verify ID matches enrollment record. |
| Telemetry accepted, metrics unavailable | Telemetry persisted but collector omitted failed fields. | Compare binary hash. Run interactively. |
| Service runs, no heartbeat | Agent running but not sending heartbeats. | Verify manager URL, network. Run interactively. |
Troubleshooting Decision Flow
Follow this flow to systematically diagnose agent issues. Each step narrows the root cause before you take action.
Uninstall
Before uninstalling, note the device name and ID. Deleting the identity file requires a new enrollment token.
Security
- Share credentials, identity files, or enrollment tokens
- Print or log Authorization headers or identity-file secrets
- Reuse one device's enrollment link on another device
- Disable HMAC verification, nonce checks, or replay protection
- Weaken tenant isolation or bypass authentication
- Delete identity files without a recovery plan
- Manually construct unsigned heartbeat or telemetry requests
- Mark a device healthy without persisted data