fix: 规范开发文档,规范配置文件
This commit is contained in:
parent
1dcb60fa14
commit
bf45cd54a2
|
|
@ -1,46 +1,72 @@
|
||||||
package config
|
package config
|
||||||
|
|
||||||
import "time"
|
type ModelSwitches struct {
|
||||||
|
FileScanner bool `json:"file_scanner"`
|
||||||
type Configuration struct {
|
FileWatcher bool `json:"file_watcher"`
|
||||||
Local Localconfig // 本地配置
|
SSHMonitor bool `json:"ssh_monitor"`
|
||||||
Offical OfficialConfig // 官方配置
|
SystemMonitor bool `json:"system_monitor"`
|
||||||
User UserConfig // 用户自定义配置
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Localconfig struct {
|
type SSHMonitorConfig struct {
|
||||||
LogPath string `yaml:"log_path"`
|
Enabled bool `json:"enabled"`
|
||||||
CheckInterval time.Duration `yaml:"check_interval"`
|
AlertOnRootLogin bool `json:"alert_on_root_login"`
|
||||||
ServerUrl string `yaml:"server_url"`
|
}
|
||||||
|
|
||||||
|
type SystemMonitorConfig struct {
|
||||||
|
CollectInterval string `json:"collect_interval"`
|
||||||
|
CollectNetwork bool `json:"collect_network"`
|
||||||
|
CollectProcess bool `json:"collect_process"`
|
||||||
|
ProcessLimit int `json:"process_limit"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type MonitorConfig struct {
|
||||||
|
SSHMonitorConfig SSHMonitorConfig `json:"ssh_monitor"`
|
||||||
|
SystemMonitorConfig SystemMonitorConfig `json:"system_monitor"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ConnectionConfig struct {
|
||||||
|
CenterServerURL string `json:"center_server_url"`
|
||||||
|
AuditServerURL string `json:"audit_server_url"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type OfficialConfig struct {
|
type OfficialConfig struct {
|
||||||
WhitelistFiles map[string][]string `yaml:"whitelist_files"`
|
Version string `json:"version"`
|
||||||
WhitelistProcesses []string `yaml:"whitelist_processes"`
|
WhiteListFiles map[string]string `json:"white_list_files"`
|
||||||
IgnoredPaths []string `yaml:"ignored_paths"`
|
WhiteListProcesses []string `json:"white_list_processes"`
|
||||||
|
IgnoredPaths []string `json:"ignored_paths"`
|
||||||
|
ScanPaths []string `json:"scan_paths"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UserConfig struct {
|
type UserConfig struct {
|
||||||
AuditServerUrl string `json:"audit_server_url"` // 审计服务器地址
|
Version string `json:"version"`
|
||||||
// 用户补充的白名单文件
|
Connection ConnectionConfig `json:"connection"`
|
||||||
SupplementFiles map[string][]string `json:"supplement_files"`
|
Models ModelSwitches `json:"models"`
|
||||||
// 用户补充的进程列表
|
SupplementFiles map[string]string `json:"supplement_files"`
|
||||||
// Key: 进程名, Value: 启动指令(如果为空则仅作为白名单,如果不为空则需保活)
|
SupplementProcesses []string `json:"supplement_processes"`
|
||||||
SupplementProcesses map[string]string `json:"supplement_processes"`
|
MonitorConfig MonitorConfig `json:"monitor_config"`
|
||||||
IgnoredPaths []string `json:"ignored_paths"`
|
|
||||||
CheckPermPaths []string `json:"check_perm_paths"` // 检查权限的目录
|
|
||||||
|
|
||||||
// 邮件配置
|
|
||||||
EmailConfig EmailConfig `json:"email_config"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type EmailConfig struct {
|
type Configuration struct {
|
||||||
ImapServer string `json:"imap_server"`
|
Official OfficialConfig // 官方配置
|
||||||
EmergencyMail []string `json:"emergency_mail"`
|
User UserConfig // 用户自定义配置
|
||||||
}
|
}
|
||||||
|
|
||||||
type SSHMonitor struct {
|
func NewDefaultUserConfig() UserConfig {
|
||||||
Enabled bool `yaml:"enabled"`
|
return UserConfig{
|
||||||
DisplayOnShell bool `yaml:"display_on_shell"`
|
Version: "BuildInDefault",
|
||||||
AlertOnRootLogin bool `yaml:"alert_on_root_login"`
|
Connection: ConnectionConfig{
|
||||||
|
CenterServerURL: "ws://localhost:8090/api/v1/ws",
|
||||||
|
AuditServerURL: "ws://localhost:8090/api/v1/ws",
|
||||||
|
},
|
||||||
|
Models: ModelSwitches{
|
||||||
|
FileScanner: false,
|
||||||
|
FileWatcher: true,
|
||||||
|
SSHMonitor: true,
|
||||||
|
SystemMonitor: true,
|
||||||
|
},
|
||||||
|
MonitorConfig: MonitorConfig{
|
||||||
|
SSHMonitorConfig: SSHMonitorConfig{Enabled: true},
|
||||||
|
SystemMonitorConfig: SystemMonitorConfig{CollectInterval: "30s", CollectNetwork: true, CollectProcess: true, ProcessLimit: 10},
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Reference in New Issue
Block a user