OpenClaw的IM机器人禁止群聊或限制白名单开放
操作步骤
使用环境变量方式或在配置文件中直接写入Token值,都存在敏感信息泄露风险。为避免Token泄露,应采用加密方式存储敏感数据,避免以明文形式存储,且定期进行修改。
- 方式一:
- 禁用企业微信群聊
openclaw config set channels.wecom.groupPolicy "disabled"
- 禁用QQ机器人群聊。
openclaw config set channels.qqbot.groupPolicy "disabled"
- 禁用feishu群聊。
openclaw config set channels.feishu.groupPolicy "disabled"
- (可选)私聊白名单。
openclaw config set channels.wecom.dmPolicy "allowlist" openclaw config set channels.wecom.allowFrom '["123456789"]' --json openclaw config set channels.qqbot.dmPolicy "allowlist" openclaw config set channels.qqbot.allowFrom '["123456789"]' --json openclaw config set channels.feishu.dmPolicy "allowlist" openclaw config set channels.feishu.allowFrom '["123456789"]' --json 其中"123456789"请替换成要允许的实际用户ID
- 验证配置。
openclaw config get channels
- 重启OpenClaw网关。
openclaw gateway restart
- 禁用企业微信群聊
- 方式二
- 打开配置文件。
vim ~/.openclaw/openclaw.json
- 按“i”进入编辑模式,对群聊groupPolicy进行配置,禁止群聊或开放白名单配置。
{ "channels": { "wecom": { "enabled": true, "token": "your-stride-token", "dmPolicy": "allowlist", "groupPolicy": "disabled", "allowFrom": ["私聊白名单用户的企业微信ID"] }, "qqbot": { "enabled": true, "appId": "YOUR_APP_ID", "clientSecret": "YOUR_APP_SECRET", "dmPolicy": "allowlist", "groupPolicy": "disabled", "allowFrom": ["允许使用机器人的QQ号"] }, "feishu": { "enabled": true, "appId": "cli_xxxxx", "dmPolicy": "allowlist", "groupPolicy": "disabled", "allowFrom": ["允许的飞书用户ID"] } } } - 按“Esc”键退出编辑模式,输入:wq!,按“Enter”键保存并退出文件。
- 重启OpenClaw网关。
openclaw gateway restart
- 打开配置文件。
父主题: 运行配置