3.5 KiB
Simple Agent Update Checklist
Version Bumping Process for RedFlag v0.2.0 - TESTED AND WORKING
✅ TESTED RESULTS (Real Server Deployment)
Backend APIs Verified:
GET /api/v1/agents/:id/updates/available- Returns update availability with nonce securityPOST /api/v1/agents/:id/update-nonce?target_version=X- Generates Ed25519-signed noncesGET /api/v1/agents/:id/updates/status- Returns update progress status
Test Results:
✅ Update Available Check: {"currentVersion":"0.1.23","hasUpdate":true,"latestVersion":"0.2.0"}
✅ Nonce Generation: {"agent_id":"2392dd78-70cf-49f7-b40e-673cf3afb944","update_nonce":"eyJhZ2VudF...==","expires_in_seconds":600}
✅ Update Status Check: {"error":null,"progress":null,"status":"idle"}
Version Update Process - CONFIRMED WORKING
1. Update Agent Version in Config Builder
File: aggregator-server/internal/services/config_builder.go
Line: 272
Change: config["agent_version"] = "0.1.23" → config["agent_version"] = "0.2.0"
2. Update Default Agent Version (Optional)
File: aggregator-server/internal/config/config.go
Line: 89
Change: cfg.LatestAgentVersion = getEnv("LATEST_AGENT_VERSION", "0.1.23") → cfg.LatestAgentVersion = getEnv("LATEST_AGENT_VERSION", "0.2.0")
3. Update Agent Builder Config (Optional)
File: aggregator-server/internal/services/agent_builder.go
Line: 77 (already covered by config builder)
4. Update Update Package Version
File: aggregator-server/internal/services/config_builder.go
Line: 172 (for struct comment only)
5. Create Signed Update Package
Endpoint: POST /api/v1/updates/packages/sign
Request Body:
{
"version": "0.2.0",
"platform": "linux",
"architecture": "amd64"
}
6. Verify Update Shows Available
Endpoint: GET /api/v1/agents/:id/updates/available
Expected Response:
{
"hasUpdate": true,
"currentVersion": "0.1.23",
"latestVersion": "0.2.0"
}
Authentication Routing Guidelines
Agent Communication Routes (AgentAuth/JWT)
Group: /agents/:id/*
Middleware: AuthMiddleware() - Agent JWT authentication
Purpose: Agent-to-server communication
Examples:
GET /agents/:id/commandsPOST /agents/:id/system-infoPOST /agents/:id/updates
Admin Dashboard Routes (WebAuth/Bearer)
Group: /api/v1/* (admin routes)
Middleware: WebAuthMiddleware() - Admin browser session
Purpose: Admin UI and server management
Examples:
GET /agents- List agents for dashboardPOST /agents/:id/update- Manual agent updateGET /agents/:id/updates/available- Check if update availableGET /agents/:id/updates/status- Get update progress
Update Package Table Structure
Table: agent_update_packages
Fields:
version: Target version stringplatform: Target OS platformarchitecture: Target CPU architecturebinary_path: Path to signed binarysignature: Ed25519 signature of binarychecksum: SHA256 hash of binaryis_active: Whether package is available
Update Flow Check
- Agent Reports Current Version: During check-in
- Server Checks Latest: Via
GetLatestVersion()from packages table - Version Comparison: Using
isVersionUpgrade(new, current) - UI Shows Available: When
hasUpdate = true - Admin Triggers Update: Generates nonce and sends command
- Agent Receives Nonce: Via update command
- Agent Uses Nonce: During version upgrade process