- Add pass_mgr Go binary with AES-256-GCM encryption - Add pcexec TypeScript tool with password sanitization - Add safe-restart module with state machine and API - Add slash command handler with cooldown support - Update README with usage documentation
2.9 KiB
2.9 KiB
PaddedCell
OpenClaw 插件:安全密码管理 + 安全执行 + 安全重启
功能模块
1. pass_mgr - 密码管理二进制 (Go)
使用 AES-256-GCM 加密,每个 agent 基于公私钥进行加/解密。
# 初始化
pass_mgr admin init [--key-path <path>]
# 获取密码
pass_mgr get <key> [--username]
# 生成密码 (agent 可用)
pass_mgr generate <key> [--username <user>]
# 设置密码 (仅人类)
pass_mgr set <key> <password> [--username <user>]
# 删除密码
pass_mgr unset <key>
# 轮换密码
pass_mgr rotate <key>
安全特性:
- Agent 无法执行
set操作(通过环境变量检测) - 未初始化前所有操作报错
- Admin 密码泄露检测(监控 message/tool calling)
2. pcexec - 安全执行工具 (TypeScript)
与 OpenClaw 原生 exec 接口一致,自动处理 pass_mgr get 并脱敏输出。
import { pcexec } from 'pcexec';
const result = await pcexec('echo $(pass_mgr get mypassword)', {
cwd: '/workspace',
timeout: 30000,
});
// result.stdout 中密码会被替换为 ######
3. safe-restart - 安全重启模块 (TypeScript)
提供 agent 状态管理和协调重启。
Agent 状态:
idle- 空闲busy- 处理消息中focus- 专注模式(工作流)freeze- 冻结(不接受新消息)pre-freeze- 准备冻结pre-freeze-focus- 准备冻结(专注模式)
API:
POST /query-restart- 查询重启就绪状态POST /restart-result- 报告重启结果GET /status- 获取所有状态
Slash 命令:
/padded-cell-ctrl status
/padded-cell-ctrl enable pass-mgr|safe-restart
/padded-cell-ctrl disable pass-mgr|safe-restart
目录结构
PaddedCell/
├── pass_mgr/ # Go 密码管理二进制
│ ├── src/
│ │ └── main.go
│ └── go.mod
├── pcexec/ # TypeScript 安全执行工具
│ ├── src/
│ │ └── index.ts
│ ├── package.json
│ └── tsconfig.json
├── safe-restart/ # TypeScript 安全重启模块
│ ├── src/
│ │ ├── index.ts
│ │ ├── status-manager.ts
│ │ ├── api.ts
│ │ ├── safe-restart.ts
│ │ └── slash-commands.ts
│ ├── package.json
│ └── tsconfig.json
├── docs/ # 文档
├── PROJECT_PLAN.md # 项目计划
├── AGENT_TASKS.md # 任务清单
└── README.md
开发
# Clone
git clone https://git.hangman-lab.top/nav/PaddedCell.git
cd PaddedCell
# Build pass_mgr (需要 Go)
cd pass_mgr
go build -o pass_mgr src/main.go
# Build pcexec (需要 Node.js)
cd ../pcexec
npm install
npm run build
# Build safe-restart (需要 Node.js)
cd ../safe-restart
npm install
npm run build
开发分支
main- 主分支dev/zhi- 当前开发分支