Phase 3 / Ep 15: Full 权限与安全策略 —— 高风险环境的治理
🎯 学习目标:理解 full 权限的风险及安全缓解措施。
1. Full 权限的使用场景
- 服务器运维自动化(重启服务、清理磁盘)
- 网络诊断(ping, traceroute, nmap)
- 进程管理(kill, top, 资源监控)
- 系统配置变更
2. ⚠️ 必须在隔离环境中使用
graph TD
A["🔴 full 权限 Agent"] --> B{"运行环境?"}
B -->|"macOS 原生"| C["❌ 绝对禁止\nAgent 可能删除系统文件"]
B -->|"Docker 容器"| D["✅ 推荐\n进程级隔离"]
B -->|"UTM 虚拟机"| E["✅✅ 最佳\n内核级隔离"]
style C fill:#fee2e2,stroke:#dc2626
style D fill:#fef9c3,stroke:#ca8a04
style E fill:#dcfce7,stroke:#16a34a3. 安全策略配置
命令黑名单
// openclaw.json
{
"tools": {
"profile": "full",
"blockedCommands": [
"rm -rf /",
"dd if=",
"mkfs",
"shutdown",
"reboot"
]
}
}
白名单模式(更安全)
{
"tools": {
"profile": "full",
"allowMode": "whitelist",
"allowedCommands": [
"systemctl status *",
"systemctl restart *",
"df -h",
"free -m",
"docker ps",
"docker logs *"
]
}
}
人工审批机制
{
"tools": {
"requireApproval": ["rm", "kill", "systemctl stop"]
}
}
启用后,Agent 执行这些命令前会通过 Telegram 请求你的确认。
4. SECURITY.md
在 Agent 目录下创建 SECURITY.md,Agent 会在执行敏感操作前参考:
# 安全策略
- 不删除任何文件,只能创建和修改
- 重启服务前先检查相关服务的依赖
- 磁盘清理只能清除 /tmp 和 /var/log/old
下节预告: Ep 16,多 Agent 权限隔离——personal(basic)、coder(coding)、ops(full)各司其职。