SSH Batch Manager
⚠️ CRITICAL SAFETY RULE
EN: Before executing ANY enable operation (enable-all, enable-single, etc.), the agent MUST obtain explicit user confirmation via message. NEVER execute enable operations without explicit user approval.
Reason: Enable operations modify SSH access on remote servers. Unauthorized execution could cause security issues or service disruptions.
Confirmation examples:
- - ✅ "enable ssh all" - Explicit command
- ✅ "yes, execute enable-all" - Explicit confirmation
- ❌ Silent execution - PROHIBITED
- ❌ Inferring user intent - PROHIBITED
Batch management of SSH key-based authentication.
🚀 Installation
Via Clawhub (Auto-Start Enabled)
CODEBLOCK0
Manual Installation
CODEBLOCK1
🌐 Web UI
Auto-started on installation!
Access: http://localhost:8765
Features:
- - ⚡ Quick operations (Enable All / Disable All)
- 🔑 SSH public key management (Read/Copy/Download)
- 🖥️ Server list management
- 🔐 Encryption tools
- 📝 Real-time operation logs
Manual Start (if needed):
python3 serve-ui.py
Features
- - ✅ Intelligent connectivity pre-check - Skip servers that are already accessible (40x faster)
- ✅ Source identifier - Add source info to authorized_keys for audit trail
- ✅ Mandatory safety confirmation - Require explicit user approval before enable operations
- ✅ SQLite + LRU cache - High-performance mapping storage
- ✅ Auto cleanup - Expired entries removed automatically
- ✅ Auto-start Web UI - Web interface starts automatically on installation
Commands
SSH Key Management
| Command | Description |
|---|
| INLINECODE0 | Distribute public key to all configured servers |
| INLINECODE1 |
Remove public key from all servers |
|
enable <user@host> [port] | Distribute to single server |
|
disable <user@host> [port] | Remove from single server |
Encryption Tools
| Command | Description |
|---|
| INLINECODE4 | Encrypt a password |
| INLINECODE5 |
Encrypt file (output to
.enc) |
|
decrypt-file <file> | Decrypt file |
|
generate-key | Generate encryption key |
|
generate-ed25519 | Generate ed25519 SSH key pair |
Configuration
Location: INLINECODE10
Format:
CODEBLOCK3
Security Notes
- - ✅ Passwords stored with AES-256 encryption
- ✅ Key file permissions: 600
- ✅ Config file permissions: 600
- ✅ Web UI auto-starts with systemd
- ⚠️ Never commit keys to git
- ⚠️ Rotate keys periodically
Performance
| Operation | Latency |
|---|
| Hot query (cache) | < 0.1ms |
| Cold query (SQLite) |
~0.5ms |
| Write | < 2ms |
| Max records | 100,000+ |
v2.1 improvements:
- - First run: ~8s (8 servers)
- Repeated runs: ~2s (all skipped)
- 40x faster for repeated executions
Source Identifier
When distributing keys, adds source info to authorized_keys:
CODEBLOCK4
Fields:
- -
ssh-batch-manager - Tool identifier - INLINECODE13 - Source hostname
- INLINECODE14 - Distribution timestamp
Version History
v2.1.0 (2026-03-03)
- - CRITICAL: Require explicit user confirmation before enable operations
- Intelligent connectivity pre-check (skip already accessible servers)
- Add source identifier to authorized_keys
- Clean test configurations (production servers only)
- Performance improvement: 40x faster for repeated runs
- Auto-start Web UI service on installation
v2.0 (2026-03-03)
- - JSON configuration format
- Support key-based authentication
- Mixed mode support (password + key)
- ed25519 key support (Ubuntu/Alpine compatible)
v1.0 (2026-03-03)
- - Initial release
- Enable/Disable all support
- AES-256 encryption
- Batch operations
Repository
Source: https://gitee.com/subline/onepeace/tree/develop/src/skills/ssh-batch-manager
License: MIT
Author: TK
Issues: https://gitee.com/subline/onepeace/issues
Related Skills
- -
sensitive-data-masker - Intelligent sensitive data detection and masking - INLINECODE16 - Security hardening and audits
SSH 批量管理器
⚠️ 关键安全规则
中文:在执行任何启用操作(enable-all、enable-single 等)之前,代理必须通过消息获取用户明确确认。未经用户明确批准,切勿执行启用操作。
原因:启用操作会修改远程服务器上的 SSH 访问权限。未经授权执行可能导致安全问题或服务中断。
确认示例:
- - ✅ 启用所有 SSH - 明确命令
- ✅ 是的,执行 enable-all - 明确确认
- ❌ 静默执行 - 禁止
- ❌ 推断用户意图 - 禁止
批量管理基于 SSH 密钥的身份验证。
🚀 安装
通过 Clawhub 安装(自动启动已启用)
bash
安装技能
clawhub install ssh-batch-manager
安装后脚本自动:
✅ 配置 systemd 服务
✅ 启动 Web UI 服务
✅ 启用开机自启
✅ 无需手动配置!
手动安装
bash
安装依赖
pip install cryptography sshpass
生成加密密钥
python3 ssh-batch-manager.py generate-key
创建配置
python3 ssh-batch-manager.py create-config
生成 SSH 密钥对
python3 ssh-batch-manager.py generate-ed25519
运行安装后脚本(自动启动 Web UI)
cd ~/.openclaw/workspace/skills/ssh-batch-manager
bash post-install.sh
🌐 Web UI
安装时自动启动!
访问地址:http://localhost:8765
功能特点:
- - ⚡ 快速操作(启用全部 / 禁用全部)
- 🔑 SSH 公钥管理(读取/复制/下载)
- 🖥️ 服务器列表管理
- 🔐 加密工具
- 📝 实时操作日志
手动启动(如需):
bash
python3 serve-ui.py
功能特点
- - ✅ 智能连接预检查 - 跳过已可访问的服务器(快 40 倍)
- ✅ 来源标识符 - 向 authorized_keys 添加来源信息以便审计追踪
- ✅ 强制安全确认 - 启用操作前需获得用户明确批准
- ✅ SQLite + LRU 缓存 - 高性能映射存储
- ✅ 自动清理 - 过期条目自动移除
- ✅ 自动启动 Web UI - 安装时自动启动 Web 界面
命令
SSH 密钥管理
| 命令 | 描述 |
|---|
| enable-all | 将公钥分发到所有已配置的服务器 |
| disable-all |
从所有服务器移除公钥 |
| enable
[port] | 分发到单台服务器 |
| disable [port] | 从单台服务器移除 |
加密工具
| 命令 | 描述 |
|---|
| encrypt <password> | 加密密码 |
| encrypt-file <file> |
加密文件(输出为 .enc) |
| decrypt-file | 解密文件 |
| generate-key | 生成加密密钥 |
| generate-ed25519 | 生成 ed25519 SSH 密钥对 |
配置
位置:~/.openclaw/credentials/ssh-batch.json
格式:
json
{
version: 2.0,
auth_method: password,
servers: [
{
user: root,
host: 10.8.8.81,
port: 22,
auth: password,
password: AES256:encryptedpasswordhere
}
]
}
安全说明
- - ✅ 密码使用 AES-256 加密存储
- ✅ 密钥文件权限:600
- ✅ 配置文件权限:600
- ✅ Web UI 通过 systemd 自动启动
- ⚠️ 切勿将密钥提交到 git
- ⚠️ 定期轮换密钥
性能
| 操作 | 延迟 |
|---|
| 热查询(缓存) | < 0.1ms |
| 冷查询(SQLite) |
~0.5ms |
| 写入 | < 2ms |
| 最大记录数 | 100,000+ |
v2.1 改进:
- - 首次运行:~8秒(8台服务器)
- 重复运行:~2秒(全部跳过)
- 重复执行快 40 倍
来源标识符
分发密钥时,向 authorized_keys 添加来源信息:
ssh-ed25519 AAAAC3... ssh-batch-manager from mls at 2026-03-03 17:30:00
字段说明:
- - ssh-batch-manager - 工具标识符
- from mls - 来源主机名
- at 2026-03-03 17:30:00 - 分发时间戳
版本历史
v2.1.0(2026-03-03)
- - 关键:启用操作前需获得用户明确确认
- 智能连接预检查(跳过已可访问的服务器)
- 向 authorized_keys 添加来源标识符
- 清理测试配置(仅保留生产服务器)
- 性能改进:重复运行快 40 倍
- 安装时自动启动 Web UI 服务
v2.0(2026-03-03)
- - JSON 配置格式
- 支持基于密钥的身份验证
- 混合模式支持(密码 + 密钥)
- ed25519 密钥支持(兼容 Ubuntu/Alpine)
v1.0(2026-03-03)
- - 初始版本
- 支持启用/禁用全部
- AES-256 加密
- 批量操作
仓库
源码:https://gitee.com/subline/onepeace/tree/develop/src/skills/ssh-batch-manager
许可证:MIT
作者:TK
问题反馈:https://gitee.com/subline/onepeace/issues
相关技能
- - sensitive-data-masker - 智能敏感数据检测与脱敏
- healthcheck - 安全加固与审计