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的部署运行情况。

相关推荐
QUDONG_biubiubiu12 小时前
OpenClaw怎么安装Summarize?新手一键配置教程
openclaw·安装summarize·summarize技能
翼龙云_cloud12 小时前
腾讯云代理商:如何用COS向量桶给OpenClaw实现智能路由?
云计算·腾讯云·openclaw·cos向量桶
JCJC错别字检测-田春峰17 小时前
图片/PDF/Word文件一键转Markdown格式,支持 API Hermes Agent Skill
markdown·openclaw·hermes agent
AC赳赳老秦18 小时前
OpenClaw与Axure联动:自动生成原型图组件、批量修改原型样式,提升设计效率
python·web安全·ui·音视频·axure·photoshop·openclaw
AC赳赳老秦2 天前
OpenClaw与思维导图工具联动:自动生成工作规划脑图、拆解任务节点,适配职场管理
java·大数据·服务器·数据库·python·php·openclaw
csdn_life182 天前
OpenClaw v2026.5.12+ 高级密钥管理:使用SecretRef实现真正的隐蔽存储
linux·openclaw
程序猿进阶3 天前
OpenClaw Mac 安装教程
java·macos·ai·架构·agent·openclaw
AI周红伟3 天前
All in Token,百度李彦宏指出:Token经济,阿里,百度,腾讯,字节,移动,电信,联通,华为,开启新的Token战争
大数据·人工智能·windows·百度·copilot·openclaw
AI周红伟3 天前
Token工厂落地:移动,电信,华为,阿里,从流量到Token,All in Token
大数据·人工智能·百度·华为·copilot·openclaw
碳基硅坊3 天前
投标标书制作的新思路:OpenClaw能帮什么
人工智能·openclaw·智能投标