首页龙虾技能列表 › Htpasswd — Apache/Nginx 基本认证密码管理

Htpasswd — Apache/Nginx 基本认证密码管理

v3.0.0

生成和管理 Apache/Nginx 基本认证的 htpasswd 文件,支持创建、添加/删除用户、密码验证和用户列表,多种哈希算法。

0· 255·0 当前·0 累计
by @bytesagain1·MIT-0
下载技能包
License
MIT-0
最后更新
2026/4/11
安全扫描
VirusTotal
可疑
查看报告
OpenClaw
安全
high confidence
该技能内部一致,使用本地 shell 工具(openssl、grep、sed)管理 htpasswd 文件,不请求不相关的凭据或网络访问。
评估建议
该技能如描述般工作,是一个本地 htpasswd 管理器(bash 脚本)。安装前请审查脚本、在非生产环境测试,确保安装 openssl。注意它会创建/修改指定文件(如 /etc/nginx/.htpasswd),可能需要 root 权限。若预计接受任意用户名,请注意脚本在使用 grep/sed 时没有完全逃逸用户名,避免使用特殊字符或改进逃逸。若兼容性允许,使用 HTPASSWD_ALGO=sha512 获取更强的哈希。...
详细分析 ▾
用途与能力
Name/description match the included code and instructions. The script implements create/add/delete/verify/list commands for htpasswd files and only requires standard utilities (openssl, grep, sed) that are appropriate for the stated task.
指令范围
Instructions and the script operate on arbitrary filesystem paths (e.g., /etc/nginx/.htpasswd), create parent directories, and change file permissions — which is expected for an htpasswd manager. Minor robustness issue: usernames are inserted directly into grep/sed patterns without escaping, which can produce unexpected behavior for unusual usernames (special regex characters, delimiter collisions). This is a functional/robustness concern, not evidence of exfiltration.
安装机制
No install spec; the skill is delivered as a standalone shell script and SKILL.md. Nothing is downloaded or written during an install step by the registry metadata.
凭证需求
No environment variables or credentials are required (HTPASSWD_ALGO is optional). The declared dependencies (openssl, grep, sed) align with functionality and no unrelated secrets/config paths are requested.
持久化与权限
Skill is not always-enabled and has normal autonomous invocation allowed. The script will write and modify files on disk (including system paths if used); running it with agent autonomy could modify system htpasswd files if the agent has filesystem permissions. This is expected but the user should be aware of the write capability.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv3.0.02026/3/15

v3.0.0:真正的 htpasswd 管理器。

● 可疑

安装命令 点击复制

官方npx clawhub@latest install htpasswd
镜像加速npx clawhub@latest install htpasswd --registry https://cn.clawhub-mirror.com

技能文档

Apache/Nginx HTTP 基本认证的真实 htpasswd 文件管理器。创建密码文件、添加/删除用户、验证密码和列出用户。支持通过 openssl 的 apr1(Apache MD5)、SHA-256 和 SHA-512 哈希算法。

命令

命令描述
htpasswd create <文件> <用户> <密码>创建新 htpasswd 文件(文件存在时失败)
htpasswd add <文件> <用户> <密码>添加用户到现有文件(或更新密码)
htpasswd delete <文件> <用户>从 htpasswd 文件中删除用户
htpasswd verify <文件> <用户> <密码>验证用户密码(支持 apr1, sha256, sha512, sha1, crypt)
htpasswd list <文件>列出所有用户及其哈希算法类型
htpasswd version显示版本
htpasswd help显示可用命令和用法

配置

变量默认描述
HTPASSWD_ALGOapr1哈希算法:apr1sha256sha512

要求

  • Bash 4+ (set -euo pipefail)
  • openssl — 用于密码哈希和验证
  • grepsed — 标准文本工具
  • 无外部依赖或 API 密钥

使用场景

  • 设置基本认证htpasswd create /etc/nginx/.htpasswd admin secret 创建新文件
  • 管理用户 — 使用 htpasswd add 添加用户,htpasswd delete 删除用户
  • 密码验证htpasswd verify 检查密码是否正确
  • 安全审计htpasswd list 显示所有用户和哈希类型
  • 更强的哈希 — 设置 HTPASSWD_ALGO=sha512 使用 SHA-512 代替默认 apr1

示例

# 创建新 htpasswd 文件
htpasswd create /etc/nginx/.htpasswd admin MySecretPass
# 添加另一个用户
htpasswd add /etc/nginx/.htpasswd editor AnotherPass
# 使用 SHA-512 进行更强的哈希
HTPASSWD_ALGO=sha512 htpasswd add /etc/nginx/.htpasswd secure_user StrongPass
# 列出所有用户
htpasswd list /etc/nginx/.htpasswd
# 验证密码
htpasswd verify /etc/nginx/.htpasswd admin MySecretPass
# 删除用户
htpasswd delete /etc/nginx/.htpasswd editor

示例输出

$ htpasswd create /tmp/.htpasswd admin secret123
┌──────────────────────────────────────────────────┐
│ htpasswd 文件创建 │
├──────────────────────────────────────────────────┤
│ 文件: /tmp/.htpasswd │
│ 用户: admin │
│ 算法: apr1 │
│ 权限: 640 (所有者读/写,组读) │
├──────────────────────────────────────────────────┤
│ ✅ 文件创建,包含 1 个用户 │
└──────────────────────────────────────────────────┘
$ htpasswd list /tmp/.htpasswd
┌──────────────────────────────────────────────────┐
│ htpasswd 用户 │
├──────────────────────────────────────────────────┤
│ 文件: /tmp/.htpasswd │
│ 用户数: 2 │
├──────────────────────────────────────────────────┤
│ 1. admin [apr1 (MD5) ] │
│ 2. editor [sha512 ] │
└──────────────────────────────────────────────────┘
$ htpasswd verify /tmp/.htpasswd admin secret123
┌──────────────────────────────────────────────────┐
│ 密码验证 │
├──────────────────────────────────────────────────┤
│ 文件: /tmp/.htpasswd │
│ 用户: admin │
│ 结果: ✅ 密码正确 │
└──────────────────────────────────────────────────┘

安全注意事项

  • 文件创建权限为 640(所有者读/写,组读)
  • 默认算法为 apr1(Apache MD5)— 广泛兼容
  • 使用 HTPASSWD_ALGO=sha512 在现代系统上获取更强的哈希
  • 用户名不能包含 : 或空白字符
  • 使用 add 命令时,现有用户的密码将被替换


Powered by BytesAgain | bytesagain.com | hello@bytesagain.com

数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务