openclaw安全加固

1.修改配置文件的方式进行风险加固

1.1 渠道的群组权限太开放

  • 你的 Telegram 群组策略设为 `open`,但启用了高权限工具

  • 风险:群组里的恶意提示注入可能触发危险操作

  • 修复:改为 `allowlist` 模式,或限制群组能用的工具

例:

bash 复制代码
{
  "telegram": {
    "groupPolicy": "open",
    "allowedTools": ["execute_command", "read_file", "write_file", "web_search"]
  }
}

修复命令:

bash 复制代码
# 编辑配置文件
nano ~/.config/openclaw/openclaw.json

# 或者使用命令行设置
openclaw config set telegram.groupPolicy allowlist
openclaw config set telegram.allowedGroups --json '["-1001234567890"]'

修复后:

bash 复制代码
{
  "telegram": {
    "groupPolicy": "allowlist",
    "allowedGroups": ["-1001234567890", "-1009876543210"],
    "allowedTools": ["web_search", "read_file"],
    "toolPermissions": {
      "read_file": {
        "allowedPaths": ["/workspace/*", "/tmp/*"]
      }
    }
  }
}

1.2 文件/系统工具暴露

  • 开放群组可以访问执行命令、读写文件等工具

  • 风险:提示注入可能导致命令执行或文件修改

  • 修复:对开放群组限制为仅消息工具,文件系统限制为仅工作区

例:

bash 复制代码
{
  "tools": {
    "execute_command": { "enabled": true },
    "write_file": { "enabled": true },
    "read_file": { "enabled": true }
  }
}

修复命令:

bash 复制代码
# 禁用群组中的危险工具
openclaw config set tools.execute_command.enabled false
openclaw config set tools.write_file.restrictedToWorkspace true
openclaw config set tools.read_file.restrictedToWorkspace true

修复后:

bash 复制代码
{
  "tools": {
    "execute_command": {
      "enabled": false,
      "groups": {
        "allowlist": []
      }
    },
    "write_file": {
      "enabled": true,
      "restrictedToWorkspace": true,
      "allowedPaths": ["/mnt/kimi/output/*"],
      "denyPaths": ["/etc/*", "/root/*", "~/.ssh/*", "*.pem", "*.key"]
    },
    "read_file": {
      "enabled": true,
      "restrictedToWorkspace": true,
      "allowedPaths": ["/mnt/kimi/upload/*", "/mnt/kimi/output/*"]
    }
  }
}

2.使用沙箱部署

使用容器docker部署openclaw。

MAC安装docker地址:

https://docs.docker.com/desktop/setup/install/mac-install/

安装完成后,因为是 Docker Hub 的官方镜像仓库地址是国外的,需要修改成国内:

打开Docker Desktop --- 打开 Settings (设置)--- 选择 Docker Engine--- 在 JSON 配置中添加json配置:

bash 复制代码
{
  "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "https://hub-mirror.c.163.com"
  ]
}

如:

bash 复制代码
{
  "builder": {
    "gc": {
      "defaultKeepStorage": "20GB",
      "enabled": true
    }
  },
  "experimental": false,
  "registry-mirrors": [
    "https://docker.mirrors.ustc.edu.cn",
    "https://hub-mirror.c.163.com",
    "https://docker.m.daocloud.io"
  ]
}
  1. 点击 Apply & Restart。

  2. 配置openclaw使用docker部署,运行openclaw,在docker的container中可以看到openclaw的部署运行情况。

相关推荐
无心水10 小时前
17、本地多模态|Qwen-VL离线私有化提取敏感PDF完全指南
人工智能·分布式·架构·openclaw·hermes
xyz_CDragon10 小时前
OpenClaw 局域网调用 Ollama 本地大模型:完整配置与踩坑指南
python·ai编程·集成学习·ollama·deepseek·openclaw
Xd聊架构10 小时前
为什么 OpenClaw 和 Claude Code 都使用 Node.js
node.js·agent·智能体·claudecode·openclaw
袁煦丞 cpolar内网穿透实验室11 小时前
飞书+龙虾!摄影师局域网外使用龙虾实例!
飞书·远程工作·内网穿透·cpolar·摄影师·openclaw·安全内网链接
AC赳赳老秦12 小时前
技术文章素材收集自动化:用 OpenClaw 自动爬取行业资讯、技术热点、优质文章
运维·开发语言·python·自动化·wpf·deepseek·openclaw
AC赳赳老秦13 小时前
用 OpenClaw 整理学习笔记:自动提取视频课程内容、生成文字笔记、分类归档
大数据·运维·数据库·人工智能·学习·deepseek·openclaw
七夜zippoe13 小时前
OpenClaw 节点通知:推送消息到设备
运维·服务器·网络·ai·openclaw·nodes
无心水1 天前
【OpenClaw:赚钱】案例19、内容产量5倍、广告收入翻4倍:播客转多平台内容矩阵全自动化实战(OpenAI Whisper + Claude)
java·人工智能·python·ai编程·openclaw·养龙虾·java.time
AC赳赳老秦1 天前
用 OpenClaw 制定技术学习计划:根据目标岗位自动生成学习路线、推荐学习资源
开发语言·c++·人工智能·python·mysql·php·openclaw