A CLI tool to analyze, audit, and fix OpenClaw security configuration issues.
Project description
OpenClaw Security Configuration Checker & Fixer
A powerful CLI tool to audit, analyze, and fix OpenClaw security configuration issues.
โจ Features
- ๐ Comprehensive Security Audit - Checks 15+ security configurations
- ๐จ Beautiful CLI Interface - Rich terminal output with colors and tables
- ๐ง Interactive Fixes - Apply fixes one-by-one with confirmation
- โก Auto-Fix Support - One-command fixes for common issues
- ๐ Detailed Reports - Export audit results to file
- ๐ Native Integration - Uses
openclaw config setandopenclaw security audit
๐ฆ Installation
From PyPI
pip install openclaw-security
With rich terminal UI (recommended):
pip install openclaw-security[rich]
Prerequisites
- Python 3.8+
- OpenClaw CLI installed (auto-detected on Windows, macOS, and Linux)
- OpenClaw config file at
~/.openclaw/openclaw.json
Platform Support
โ Windows - Full support with:
- Automatic openclaw CLI detection (checks npm global, Program Files, and NVM paths)
- Windows-specific file permission guidance (ACLs instead of chmod)
- Correct handling of .cmd batch files
โ macOS - Full support with:
- Auto-detection of openclaw CLI (Homebrew, NVM, npm global)
- Standard Unix permission checks (chmod)
โ Linux - Full support with:
- Auto-detection of openclaw CLI (NVM, npm global, /usr/local/bin)
- Standard Unix permission checks (chmod)
๐ Platform-Specific Behavior
Windows
- File Permissions: Uses Windows ACLs (Access Control Lists) instead of Unix chmod
- The script skips permission checks on Windows
- Manual icacls commands are provided if you want to lock down files
- CLI Detection: Automatically finds openclaw in:
C:\Program Files\nodejs\openclaw.cmd%APPDATA%\npm\openclaw.cmd- NVM installation paths
macOS
- File Permissions: Standard Unix chmod checks (700 for directories, 600 for files)
- CLI Detection: Automatically finds openclaw in:
~/.nvm/versions/node/v*/bin/openclaw/usr/local/bin/openclaw/opt/homebrew/bin/openclaw(Apple Silicon)
Linux
- File Permissions: Standard Unix chmod checks (700 for directories, 600 for files)
- CLI Detection: Automatically finds openclaw in:
~/.nvm/versions/node/v*/bin/openclaw~/.local/bin/openclaw/usr/local/bin/openclaw~/.npm-global/bin/openclaw
๐ Usage
After installing, use the osc command:
Basic Audit
Run security checks only (no fixes):
osc --check
Interactive Fix Mode
Audit + interactive fix session:
osc --fix
Auto-Fix All Issues
Apply all auto-fixable issues without prompting:
osc --fix-all
Run Official Audit
Run the native openclaw security audit command:
osc --audit
# With deep scan
osc --audit --deep
Export Report
Export audit results to file:
osc --export security-report.txt
Use Custom Config
Audit a specific config file:
osc --config /path/to/openclaw.json
Combined Options
Audit, fix all, and export report:
osc --fix-all --export report.txt
๐ Security Checks
The tool checks the following areas:
Gateway Security
- โ Gateway authentication configured
- โ Gateway token strength
- โ Bind mode (loopback vs LAN/tailnet)
- โ Trusted proxies configured
Channel Security
- โ Group policies (avoid "open")
- โ Group allowlists configured
- โ DM policies configured
Sandbox Security
- โ Sandbox mode enabled
- โ Workspace access (none/ro/rw)
- โ Sandbox scope (session/agent/shared)
- โ Docker capabilities dropped
Tool Security
- โ Tool allow/deny lists
- โ Elevated tools restricted
- โ Dangerous tools not globally allowed
Session Security
- โ DM session isolation (per-channel-peer)
File Security
- โ File permissions (~/.openclaw = 700)
- โ Config file permissions (600)
- โ Credentials directory permissions (700)
Command Security
- โ Bash commands disabled
- โ Config commands restricted
- โ Access groups enforced
Browser Security
- โ Browser tool restrictions
- โ Browser proxy mode
Docker Security
- โ Container network settings
- โ Container user (non-root)
Runtime Security
- โ Node.js version (22.12.0+ required)
Other
- โ Logging redaction enabled
- โ mDNS mode (minimal/off)
๐ง Auto-Fixable Issues
The following issues can be automatically fixed:
| Issue | Fix Applied |
|---|---|
| Gateway authentication | Generates new token via openclaw doctor --generate-gateway-token |
| Sandbox disabled | Sets agents.defaults.sandbox.mode = "non-main" |
| mDNS full mode | Sets discovery.mdns.mode = "minimal" |
| DM isolation | Sets session.dmScope = "per-channel-peer" |
| Logging redaction | Sets logging.redactSensitive = "tools" |
| File permissions | Runs chmod 700/600 on directories/files (Unix/Linux/macOS only) |
| Access groups | Sets commands.useAccessGroups = true |
| Docker capDrop | Sets agents.defaults.sandbox.docker.capDrop = ["ALL"] |
โ Verifying Settings After Fix
After running fixes, verify your configuration:
Re-Run Security Check
osc --check
Use OpenClaw CLI Commands
openclaw config get agents.defaults.sandbox.mode
openclaw config get session.dmScope
openclaw config get discovery.mdns.mode
openclaw config get agents.defaults.sandbox.docker.capDrop
Restart Gateway (Required!)
Configuration changes require a gateway restart:
openclaw gateway restart
openclaw gateway status
โ ๏ธ Manual Fixes Required
Some issues require manual intervention:
- Group policies: Need to manually configure allowlists in config
- Tool restrictions: Need to review and adjust tool allow/deny lists per agent
- Node.js version: Must upgrade Node.js manually
- Network exposure: Need to configure firewall rules
- Elevated tools: Need to review
tools.elevated.allowFromsettings
๐ Command Reference
usage: osc [-h] [--check] [--fix] [--fix-all]
[--audit] [--deep] [--export FILE]
[--config FILE] [-v]
Audit and fix OpenClaw security configuration
options:
-h, --help Show help message and exit
--check Run security checks only (no fixes)
--fix Run interactive fix session after checks
--fix-all Apply all auto-fixable issues without prompting
--audit Run official openclaw security audit command
--deep Run deep audit (with --audit flag)
--export FILE Export report to file
--config FILE Use custom config file path
-v, --verbose Verbose output
๐ Security Best Practices
- Always run
openclaw security audit --deepfirst - Never bind Gateway to LAN - Use loopback or Tailscale Serve
- Enable sandboxing for non-main sessions
- Use strong, random gateway tokens (16+ characters)
- Restrict elevated tools to owner only
- Set file permissions:
700for dirs,600for config files - Enable mention gating in groups - Require @-mentions
- Isolate DM sessions - Use
per-channel-peerscope - Keep logging redaction on - Unless actively debugging
- Run this tool regularly - Especially after config changes
๐ Troubleshooting
"openclaw command not found"
Ensure OpenClaw CLI is installed and in your PATH:
npm install -g openclaw
"Config file not found"
Check that ~/.openclaw/openclaw.json exists:
ls -la ~/.openclaw/
Rich library not found
Install with the rich extra:
pip install openclaw-security[rich]
๐ค Contributing
This tool is designed to be extensible. To add new checks:
- Add a new check method to
OpenClawSecurityCheckerclass - Call it in
run_all_checks()method - Add corresponding fix method if applicable
- Update this README
๐ License
MIT License - see LICENSE for details.
๐ Credits
Built with โค๏ธ using:
- Rich - Beautiful terminal output
- OpenClaw - The awesome AI assistant framework
Made By Umer Farooq
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openclaw_security-0.1.0.tar.gz.
File metadata
- Download URL: openclaw_security-0.1.0.tar.gz
- Upload date:
- Size: 16.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdafc0039da755e5ea2490d8ed6c1ba659e4a1e59e0f2f348d4a815a54611d7d
|
|
| MD5 |
b16f2fd7c982f8707ca4a14b81a6aba1
|
|
| BLAKE2b-256 |
5d139cb4ed302007a39e4c962b41ce6daf8156599c487ad5533e6a991cf88807
|
File details
Details for the file openclaw_security-0.1.0-py3-none-any.whl.
File metadata
- Download URL: openclaw_security-0.1.0-py3-none-any.whl
- Upload date:
- Size: 17.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
79b4c8defff598fcf177697e198388d7fd0fb9ccfd7dae1e3600e5165a09dff8
|
|
| MD5 |
25043517a8c3d38e5f87ebb41e3f6d1c
|
|
| BLAKE2b-256 |
a002fb0062f502e21dd5ad136034200c49d020b44ca83eac06b188386ebd532d
|