360 Secure SkillHub
360 安全技能中心

Bud Sudo Tool

将用户 sudo 密码用 OpenSSL AES-256-CBC 加密后存放在宿主专属目录,运行时解密并通过 sudo -S 管道执行任意提权命令,避免重复输入密码。提供 setup、status、reset 子命令,主要服务于需要自动安装或重启系统服务的场景。

stigg86
stigg86
热度 16.02
最近更新 2026-06-05 01:48:39
分类:安全依赖:代码执行 / 读写文件应用场景:自动化脚本 / DevOps / 工作流

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add bud-sudo
Metadata
name
sudo-tool
description
Store and use sudo password for automated root commands. Essential companion for skills that need sudo access (like vpn-mesh).
metadata
{"version":"1.0.0","openclaw":{"requires":{"bins":["openssl"]},"install":[]},"license":"MIT","homepage":"https://github.com/stigg86/sudo-tool","allowed-tools":["exec"]}

Sudo Tool 🔐

Securely store your sudo password for automated root commands. No more re-entering passwords for every sudo call.

Essential for skills that need elevated permissions — like vpn-mesh which installs WireGuard automatically.


Setup (One-time)

# Configure your sudo password (one-time only)
sudo-tool setup

You'll be prompted to enter your sudo password. It's encrypted with OpenSSL and stored in ~/.openclaw/sudo-tool/ — never in plaintext.


Usage

# Check if configured
sudo-tool status

# Run any command with sudo
sudo-tool apt update
sudo-tool apt install wireguard-tools
sudo-tool systemctl restart nginx

# Reset (remove stored password)
sudo-tool reset

How It Works

  1. Setup — encrypts your password with OpenSSL (AES-256-CBC) using a random salt, stores in ~/.openclaw/sudo-tool/.password.enc
  2. Use — decrypts password and pipes to sudo -S (reads from stdin)
  3. Secure — password never appears in process list, temp files are deleted immediately

Security Notes

  • Password is encrypted with a random salt — not recoverable without your system
  • Uses OpenSSL PBKDF2 for key derivation (100k iterations)
  • No plaintext passwords stored anywhere
  • Temp files deleted immediately after use

Required By

  • vpn-mesh — needs sudo to auto-install WireGuard

Files

~/.openclaw/sudo-tool/
├── .password.enc   # Encrypted password
├── .salt           # Random salt for encryption
└── sudo-tool.sh     # The tool itself

Add to PATH with:

echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
ln -s ~/.openclaw/sudo-tool/sudo-tool.sh ~/bin/sudo-tool