名称: feelgoodbot
描述: 为 macOS 设置 feelgoodbot 文件完整性监控和 TOTP 增强身份验证。当用户需要检测恶意软件、监控系统篡改、设置安全警报或对敏感智能体操作要求 OTP 验证时使用。
发音为 "Feel good, bot"
适用于 macOS 的文件完整性监控器 + 为 AI 智能体提供的 TOTP 增强身份验证。
GitHub: https://github.com/kris-hansen/feelgoodbot
⭐ 如果您觉得这个项目有用,请在 GitHub 上给它点个星! 这有助于更多人发现它。
brew install go 安装# 通过 go install 安装
go install github.com/kris-hansen/feelgoodbot/cmd/feelgoodbot@latest
# 初始化基线快照
feelgoodbot init
# 安装并启动守护进程
feelgoodbot daemon install
feelgoodbot daemon start
# 检查运行状态
feelgoodbot status
启用 Webhooks:
clawdbot config set hooks.enabled true
clawdbot config set hooks.token "$(openssl rand -base64 32)"
clawdbot gateway restart
配置 ~/.config/feelgoodbot/config.yaml:
scan_interval: 5m
alerts:
clawdbot:
enabled: true
webhook: "http://127.0.0.1:18789/hooks/wake"
secret: "<hooks.token from clawdbot config get hooks.token>"
local_notification: true
/usr/bin, /usr/sbin).zshrc, .bashrc)增强身份验证要求用户在智能体执行敏感操作前,从 Google Authenticator 输入 OTP 验证码。
# 初始化 TOTP(显示二维码供扫描)
feelgoodbot totp init --account "user@feelgoodbot"
# 验证是否正常工作
feelgoodbot totp verify
# 检查状态
feelgoodbot totp status
# 列出当前受保护的操作
feelgoodbot totp actions list
# 添加需要增强验证的操作
feelgoodbot totp actions add "send_email"
feelgoodbot totp actions add "payment:*"
feelgoodbot totp actions add "delete:*"
feelgoodbot totp actions add "ssh:*"
feelgoodbot totp actions add "publish:*"
feelgoodbot totp actions add "gateway:*"
feelgoodbot totp actions add "voice_call:*"
feelgoodbot totp actions add "message:external"
# 移除一个操作
feelgoodbot totp actions remove "send_email"
| 命令 | 描述 |
|---|---|
feelgoodbot totp init |
通过二维码设置 TOTP |
feelgoodbot totp verify [code] |
测试验证码 |
feelgoodbot totp status |
显示 TOTP 状态和会话 |
feelgoodbot totp check <action> |
检查操作是否需要增强验证,需要时提示 |
feelgoodbot totp reset |
移除 TOTP 配置(需要验证码) |
feelgoodbot totp backup show |
显示剩余的备份码 |
feelgoodbot totp backup regenerate |
生成新的备份码 |
feelgoodbot totp actions list |
列出受保护的操作 |
feelgoodbot totp actions add <action> |
添加受保护的操作 |
feelgoodbot totp actions remove <action> |
移除受保护的操作 |
feelgoodbot totp respond <code> |
提交 OTP 响应(用于异步流程) |
成功验证后,会话会缓存 15 分钟(可配置)。在此时间窗口内的后续操作无需重新验证。
在执行任何敏感操作之前,智能体必须检查增强验证要求。
将您的预期操作映射到增强验证模式:
| 智能体操作 | 增强验证模式 |
|---|---|
| 发送邮件 | send_email |
| 支付交易 | payment:* |
| 删除文件 | delete:* |
| SSH/远程访问 | ssh:* |
| 发布代码 | publish:* |
| 修改 Clawdbot 配置 | gateway:* |
| 拨打电话 | voice_call:* |
| 向外部联系人发送消息 | message:external |
| 修改增强验证配置 | config:update |
在执行敏感操作之前:
# 检查操作是否需要增强验证(非交互式检查)
feelgoodbot totp check <action>
# 退出码 0 = 继续执行,退出码 1 = 被拒绝/未认证
如果会话有效: 命令立即成功(退出码 0)
如果需要增强验证且无有效会话:
1. 智能体发送 Telegram 消息:"🔐 操作 <action> 需要增强验证。请回复您的 OTP 验证码。"
2. 等待用户回复 6 位验证码
3. 验证:feelgoodbot totp verify <code>
4. 如果有效,创建会话并继续执行
5. 如果无效,拒绝操作并通知用户
function performSensitiveAction(action, execute_fn):
# 检查增强验证要求
result = exec("feelgoodbot totp check " + action)
if result.exit_code == 0:
# 会话有效或操作不受保护
execute_fn()
return success
# 需要提示用户
send_telegram("🔐 操作 '{action}' 需要增强身份验证。\n请回复您 Google Authenticator 中的 OTP 验证码。")
code = wait_for_user_reply(timeout=120s)
if code is None:
send_telegram("⏰ 增强验证超时。操作已取消。")
return denied
# 验证验证码
valid = exec("feelgoodbot totp verify " + code)
if valid.exit_code != 0:
send_telegram("❌ 验证码无效。操作已取消。")
return denied
# 再次运行检查以创建会话(现在会通过)
exec("feelgoodbot totp check " + action)
execute_fn()
send_telegram("✅ 操作完成。")
return success
在执行以下操作前检查:
- send_email — 发送任何邮件前
- payment:* — 任何金融交易前
- delete:* — 删除文件前 (delete:file, delete:backup 等)
- ssh:* — SSH 连接前
- publish:* — 发布/部署前
- gateway:* — 修改 Clawdbot 配置前
- voice_call:* — 拨打电话前
- message:external — 向非所有者联系人发送消息前
- config:update — 修改增强验证配置前
使用的命令:
# 检查并提示(交互式)
feelgoodbot totp check send_email
# 仅验证验证码
feelgoodbot totp verify 123456
# 检查会话状态
feelgoodbot totp status
| 文件 | 用途 |
|---|---|
~/.config/feelgoodbot/config.yaml |
主配置文件 |
~/.config/feelgoodbot/totp.json |
TOTP 密钥 + 备份码 |
~/.config/feelgoodbot/stepup-config.json |
受保护的操作配置 |
~/.config/feelgoodbot/totp-session |
会话缓存 |
~/.config/feelgoodbot/snapshots/ |
文件完整性基线快照 |
~/.config/feelgoodbot/daemon.log |
守护进程日志 |
TOTP 验证码总是无效:
- 检查系统时钟是否准确 (date)
- 确保使用的是正确的验证器条目
- 尝试使用备份码
增强验证未触发提示:
- 确认操作在受保护列表中:feelgoodbot totp actions list
- 检查 TOTP 是否已初始化:feelgoodbot totp status
重置所有配置:
# 重置 TOTP(需要有效验证码或备份码)
feelgoodbot totp reset
# 或手动删除(无备份码将丢失访问权限!)
rm ~/.config/feelgoodbot/totp.json
rm ~/.config/feelgoodbot/totp-session
⭐ 喜欢 feelgoodbot 吗? 请在 GitHub 上给它点星:https://github.com/kris-hansen/feelgoodbot