From a1f9ca11764f3f2dc5acfd5d1a2010a7e3514c91 Mon Sep 17 00:00:00 2001 From: wuko233 Date: Mon, 16 Feb 2026 15:46:02 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=BB=93=E6=9E=84=E4=BD=93=E4=BB=A5=E6=94=AF=E6=8C=81=E6=9C=AC?= =?UTF-8?q?=E5=9C=B0=E5=92=8C=E7=94=A8=E6=88=B7=E8=87=AA=E5=AE=9A=E4=B9=89?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/config/config.go | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/internal/config/config.go b/internal/config/config.go index 123525e..8acd233 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -1,5 +1,44 @@ package config +import "time" + +type Configuration struct { + Local Localconfig // 本地配置 + Offical OfficialConfig // 官方配置 + User UserConfig // 用户自定义配置 +} + +type Localconfig struct { + LogPath string `yaml:"log_path"` + CheckInterval time.Duration `yaml:"check_interval"` + ServerUrl string `yaml:"server_url"` +} + +type OfficialConfig struct { + WhitelistFiles map[string][]string `yaml:"whitelist_files"` + WhitelistProcesses []string `yaml:"whitelist_processes"` + IgnoredPaths []string `yaml:"ignored_paths"` +} + +type UserConfig struct { + AuditServerUrl string `json:"audit_server_url"` // 审计服务器地址 + // 用户补充的白名单文件 + SupplementFiles map[string][]string `json:"supplement_files"` + // 用户补充的进程列表 + // Key: 进程名, Value: 启动指令(如果为空则仅作为白名单,如果不为空则需保活) + SupplementProcesses map[string]string `json:"supplement_processes"` + IgnoredPaths []string `json:"ignored_paths"` + CheckPermPaths []string `json:"check_perm_paths"` // 检查权限的目录 + + // 邮件配置 + EmailConfig EmailConfig `json:"email_config"` +} + +type EmailConfig struct { + ImapServer string `json:"imap_server"` + EmergencyMail []string `json:"emergency_mail"` +} + type SSHMonitor struct { Enabled bool `yaml:"enabled"` DisplayOnShell bool `yaml:"display_on_shell"`