From 4e7b5c4d7bc9da98ad24a5cbda149b8126687368 Mon Sep 17 00:00:00 2001 From: dushixiang Date: Sun, 23 Nov 2025 20:15:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AF=B9=E4=BA=8E=E9=98=B2?= =?UTF-8?q?=E7=AF=A1=E6=94=B9=E4=BF=9D=E6=8A=A4=E5=93=8D=E5=BA=94=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E7=9A=84=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/handler/agent_handler.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/internal/handler/agent_handler.go b/internal/handler/agent_handler.go index 8405c9d..f2fd76c 100644 --- a/internal/handler/agent_handler.go +++ b/internal/handler/agent_handler.go @@ -183,6 +183,29 @@ func (h *AgentHandler) handleWebSocketMessage(ctx context.Context, agentID strin } return h.tamperService.CreateAlert(agentID, alertData.Path, alertData.Details, alertData.Restored, alertData.Timestamp) + case protocol.MessageTypeTamperProtect: + // 防篡改配置响应 + var protectResp protocol.TamperProtectResponse + if err := json.Unmarshal(data, &protectResp); err != nil { + h.logger.Error("failed to unmarshal tamper protect response", zap.Error(err)) + return err + } + // 记录探针的配置应用结果 + if protectResp.Success { + h.logger.Info("tamper protect config applied successfully", + zap.String("agentID", agentID), + zap.String("message", protectResp.Message), + zap.Int("current_paths", len(protectResp.Paths)), + zap.Int("added", len(protectResp.Added)), + zap.Int("removed", len(protectResp.Removed))) + } else { + h.logger.Error("tamper protect config apply failed", + zap.String("agentID", agentID), + zap.String("message", protectResp.Message), + zap.String("error", protectResp.Error)) + } + return nil + default: h.logger.Warn("unknown message type", zap.String("type", messageType)) return nil