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"`