feat: 完善堡垒机与 Agent 智能运维能力
- 支持 Windows Agent 构建、安装脚本和统一上报协议 - 增强 RDP 剪贴板、虚拟盘和文件传输能力 - 新增 AIOps 上下文工具、告警 RCA trace 落库和回放接口 - 重构 docs 模块文档并补充终端、堡垒机、监控、AI Agent 设计
This commit is contained in:
1 parent
a9513c2056
commit
e0d652d211
169 files changed
+12192
-9116
No files matched your search
@@ -30,10 +30,35 @@ func (h *AuditSettingsHandler) getOrCreate() (model.AuditSettings, error) {
|
||||
if err != gorm.ErrRecordNotFound {
|
||||
return s, err
|
||||
}
|
||||
s = model.AuditSettings{RetentionDays: 180, RecordAll: true}
|
||||
s = model.AuditSettings{
|
||||
RetentionDays: 180,
|
||||
RecordAll: true,
|
||||
SessionWatermarkEnabled: true,
|
||||
SessionRecordEnabled: true,
|
||||
ClipboardEnabled: true,
|
||||
FileUploadEnabled: true,
|
||||
FileDownloadEnabled: true,
|
||||
}
|
||||
return s, h.db.Create(&s).Error
|
||||
}
|
||||
|
||||
func auditSettingsPayload(s model.AuditSettings) gin.H {
|
||||
return gin.H{
|
||||
"retention_days": s.RetentionDays,
|
||||
"record_all": s.RecordAll,
|
||||
"session_watermark_enabled": s.SessionWatermarkEnabled,
|
||||
"session_record_enabled": s.SessionRecordEnabled,
|
||||
"clipboard_enabled": s.ClipboardEnabled,
|
||||
"file_upload_enabled": s.FileUploadEnabled,
|
||||
"file_download_enabled": s.FileDownloadEnabled,
|
||||
"command_policy_enabled": s.CommandPolicyEnabled,
|
||||
"approval_required": s.ApprovalRequired,
|
||||
"last_cleanup_at": s.LastCleanupAt,
|
||||
"last_cleanup_summary": s.LastCleanupSummary,
|
||||
"allowed_retention_days": model.AllowedAuditRetentionDays,
|
||||
}
|
||||
}
|
||||
|
||||
// GetAuditSettings 获取审计策略 // Logan.Li
|
||||
// GET /api/v1/admin/audit-settings
|
||||
func (h *AuditSettingsHandler) GetAuditSettings(c *gin.Context) {
|
||||
@@ -45,13 +70,7 @@ func (h *AuditSettingsHandler) GetAuditSettings(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, model.Response{
|
||||
Code: 200,
|
||||
Message: "success",
|
||||
Data: gin.H{
|
||||
"retention_days": s.RetentionDays,
|
||||
"record_all": s.RecordAll,
|
||||
"last_cleanup_at": s.LastCleanupAt,
|
||||
"last_cleanup_summary": s.LastCleanupSummary,
|
||||
"allowed_retention_days": model.AllowedAuditRetentionDays,
|
||||
},
|
||||
Data: auditSettingsPayload(s),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -59,8 +78,15 @@ func (h *AuditSettingsHandler) GetAuditSettings(c *gin.Context) {
|
||||
// PUT /api/v1/admin/audit-settings
|
||||
func (h *AuditSettingsHandler) ApplyAuditSettings(c *gin.Context) {
|
||||
var req struct {
|
||||
RetentionDays int `json:"retention_days" binding:"required"`
|
||||
RecordAll bool `json:"record_all"`
|
||||
RetentionDays int `json:"retention_days" binding:"required"`
|
||||
RecordAll bool `json:"record_all"`
|
||||
SessionWatermarkEnabled bool `json:"session_watermark_enabled"`
|
||||
SessionRecordEnabled bool `json:"session_record_enabled"`
|
||||
ClipboardEnabled bool `json:"clipboard_enabled"`
|
||||
FileUploadEnabled bool `json:"file_upload_enabled"`
|
||||
FileDownloadEnabled bool `json:"file_download_enabled"`
|
||||
CommandPolicyEnabled bool `json:"command_policy_enabled"`
|
||||
ApprovalRequired bool `json:"approval_required"`
|
||||
}
|
||||
if err := c.ShouldBindJSON(&req); err != nil {
|
||||
c.JSON(http.StatusBadRequest, model.Response{Code: 400, Message: "请求参数错误"})
|
||||
@@ -82,6 +108,13 @@ func (h *AuditSettingsHandler) ApplyAuditSettings(c *gin.Context) {
|
||||
|
||||
s.RetentionDays = req.RetentionDays
|
||||
s.RecordAll = req.RecordAll
|
||||
s.SessionWatermarkEnabled = req.SessionWatermarkEnabled
|
||||
s.SessionRecordEnabled = req.SessionRecordEnabled
|
||||
s.ClipboardEnabled = req.ClipboardEnabled
|
||||
s.FileUploadEnabled = req.FileUploadEnabled
|
||||
s.FileDownloadEnabled = req.FileDownloadEnabled
|
||||
s.CommandPolicyEnabled = req.CommandPolicyEnabled
|
||||
s.ApprovalRequired = req.ApprovalRequired
|
||||
|
||||
cleanResult, cleanErr := auditcleaner.Run(h.db, req.RetentionDays)
|
||||
now := time.Now()
|
||||
@@ -111,11 +144,18 @@ func (h *AuditSettingsHandler) ApplyAuditSettings(c *gin.Context) {
|
||||
Code: 200,
|
||||
Message: msg,
|
||||
Data: gin.H{
|
||||
"retention_days": s.RetentionDays,
|
||||
"record_all": s.RecordAll,
|
||||
"last_cleanup_at": s.LastCleanupAt,
|
||||
"last_cleanup_summary": s.LastCleanupSummary,
|
||||
"cleanup": cleanResult,
|
||||
"retention_days": s.RetentionDays,
|
||||
"record_all": s.RecordAll,
|
||||
"session_watermark_enabled": s.SessionWatermarkEnabled,
|
||||
"session_record_enabled": s.SessionRecordEnabled,
|
||||
"clipboard_enabled": s.ClipboardEnabled,
|
||||
"file_upload_enabled": s.FileUploadEnabled,
|
||||
"file_download_enabled": s.FileDownloadEnabled,
|
||||
"command_policy_enabled": s.CommandPolicyEnabled,
|
||||
"approval_required": s.ApprovalRequired,
|
||||
"last_cleanup_at": s.LastCleanupAt,
|
||||
"last_cleanup_summary": s.LastCleanupSummary,
|
||||
"cleanup": cleanResult,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user