Install
openclaw skills install mjolnir-credential-vaultGPG AES-256 encrypted credential management. Requires: GPG (gnupg) installed, Python 3.8+, CRED_MASTER_PASS env var for non-interactive use. Use when the user needs to securely store, retrieve, or manage passwords, API tokens, and secrets. Supports init/add/get/list/remove operations. Triggers: password management, secret storage, credential encryption, token vault, secure credentials, 凭证管理, 密码加密, 安全存储.
openclaw skills install mjolnir-credential-vaultGPG AES-256 encrypted credential manager — one file, all secrets.
GPG AES-256 对称加密凭证管理器 — 一个文件,管理所有密钥。
⚡🔨 Part of the Mjölnir / 雷神 toolchain
🛡️ Brand: 雷神之盾 (Shield of Thor)
gpg --version (the init command verifies this automatically / init 命令会自动检查)| Variable / 变量 | Purpose / 用途 | Required? / 是否必需 |
|---|---|---|
CRED_MASTER_PASS | Master password for encrypt/decrypt / 加解密主密码 | Required for non-interactive use; prompts if unset / 非交互使用时必需;未设置则交互输入 |
# Initialize (first time) / 首次初始化 — checks GPG availability / 检查 GPG 可用性
python3 SKILL_DIR/scripts/cred_manager.py init
# Add credentials (interactive) / 交互式添加凭证
python3 SKILL_DIR/scripts/cred_manager.py add myservice
# Non-interactive use / 非交互使用
export CRED_MASTER_PASS="your_password"
Replace SKILL_DIR with the actual skill directory path.
将 SKILL_DIR 替换为实际的技能目录路径。
.gpg file (permissions 600).gpg 文件(权限 600)--passphrase-fd (stdin pipe) — never in command-line arguments--passphrase-fd(stdin 管道)传递给 GPG — 绝不出现在命令行参数中--passphrase-fd 0 (echo pipe) — not --passphrase--passphrase-fd 0(echo 管道)— 不用 --passphraseDuring save/encrypt operations, plaintext JSON briefly exists as a temporary file:
在保存/加密操作期间,明文 JSON 会短暂存在于临时文件中:
mkstemp + fchmod 600 (owner-only read/write) / 使用 mkstemp + fchmod 600 创建(仅所有者可读写)The CRED_MASTER_PASS environment variable is readable by same-user processes via /proc/*/environ on Linux.
CRED_MASTER_PASS 环境变量在 Linux 上可被同用户进程通过 /proc/*/environ 读取。
Recommended approaches (most → least secure) / 推荐方式(安全性从高到低):
read -s prompt / 通过密钥管理器或会话级 read -s 提示设置export CRED_MASTER_PASS="..." in current shell (convenient but less secure) / 在当前 shell 中设置(方便但安全性较低)Avoid / 避免: persisting the master password in plaintext files (e.g., ~/.bashrc). If you must, ensure chmod 600 and understand the trade-off.
不要将主密码明文写入文件(如 ~/.bashrc)。如必须,请确保 chmod 600 并了解风险。
python3 scripts/cred_manager.py init
Verifies GPG is installed, creates encrypted credentials.json.gpg (permissions 600). Warns if password < 8 chars.
验证 GPG 已安装,创建加密的 credentials.json.gpg(权限 600)。密码少于 8 位会警告。
python3 scripts/cred_manager.py add <service_name>
# Interactive: enter key=value pairs, empty line to finish
# 交互式:输入 key=value 键值对,空行结束
Or programmatically / 或通过代码调用:
from cred_manager import add_credential
add_credential('github', {'user': 'octocat', 'token': 'ghp_xxx'})
Python:
from cred_manager import get_credential, get_service
token = get_credential('github', 'token') # single field / 单个字段
config = get_service('github') # full dict / 完整字典
Shell / Bash:
export CRED_MASTER_PASS="your_password"
source scripts/cred_helper.sh
TOKEN=$(cred_get github token)
CLI / 命令行:
python3 scripts/cred_manager.py get github token
python3 scripts/cred_manager.py list
python3 scripts/cred_manager.py remove <service_name>
When a script has hardcoded passwords, refactor to:
当脚本中有硬编码密码时,重构为:
import sys, os
sys.path.insert(0, os.path.expanduser('path/to/credential-vault/scripts'))
from cred_manager import get_credential
password = get_credential('myservice', 'pass')
CRED_MASTER_PASS readable by same-user processes on Linux / 在 Linux 上可被同用户进程读取.gpg file integrity not independently verified / .gpg 文件完整性未独立验证For higher security requirements, consider: OS keyring, pass, HashiCorp Vault, or cloud KMS.
如需更高安全性,请考虑:OS 密钥环、pass、HashiCorp Vault 或云 KMS。
gpg, python3 bins and CRED_MASTER_PASS env var / 修复注册表元数据:声明依赖二进制和环境变量--passphrase-fd for both Python & Shell; honest temp-file disclosure; 3-tier password advice / 安全加固--passphrase-fd stdin pipe / Python 端 stdin 管道传密码