Add base system configuration commands for agent-wdd

- Implemented new base commands for system configuration:
  * swap: Disable system swap
  * selinux: Disable SELinux
  * firewall: Stop and disable firewalld and ufw
  * sysconfig: Modify system sysctl configuration
  * ssh: Add SSH-related subcommands (key, port, config)

- Updated Config.go to initialize ConfigCache with default values
- Added new utility functions in FileUtils.go for file content manipulation
- Extended Excutor.go with HardCodeCommandExecutor method
This commit is contained in:
zeaslity
2025-02-27 10:57:58 +08:00
parent e8f0e0d4a9
commit 16c041e3eb
5 changed files with 578 additions and 1 deletions

View File

@@ -12,7 +12,19 @@ import (
var WddConfigFilePath = "/usr/local/etc/wdd/agent-wdd-config.yaml"
var ConfigCache *Config
// ConfigCache 配置缓存
var ConfigCache = &Config{
TimeStamp: "",
ModifiedTimes: 0,
Agent: Agent{
OS: OS{},
Network: Network{},
CPU: CPU{},
Mem: Memory{},
Swap: Swap{},
Disks: []Disk{},
},
}
func init() {
// 根据运行的操作系统不同, 修改 WddConfigFilePath 的位置