步驟一:安裝 Panguard
透過 npm 安裝或使用安裝腳本。兩種方式都會設定 CLI、規則引擎和本地 AI 模型。
curl -fsSL https://get.panguard.ai | bashApple Silicon (ARM64) native binary. Intel Mac users: install via npm, or enable Rosetta 2 first.
Verify the installation:
panguard --version # Expected: 1.5.2
Run setup to auto-configure all detected AI platforms (Claude Code, Claude Desktop, Cursor, OpenClaw, Codex, WorkBuddy, NemoClaw, ArkClaw, Windsurf, QClaw, Cline, VS Code Copilot, Zed, Gemini CLI, Continue, Roo Code):
pga setupTip: pga is a shortcut for panguard. Both work.
Then start Panguard in any project:
cd your-project pga scan
[OK] Panguard v1.5.2 installed
[OK] Rule engine loaded (311 ATR + 311 total rules)
[OK] Scan complete.
Platform Quick Start
Step-by-step for each AI platform. Pick yours.
CCClaude Code
Step 1: Open your terminal
npm install -g @panguard-ai/panguard && pga upStep 2: Auto-configure Claude Code
pga setup --platform claude-codeStep 3: Restart Claude Code, then try:
# In Claude Code, ask: "scan my current project for security issues" "audit the MCP skill at github.com/owner/repo"
Step 4: Start 24/7 protection
pga guard start --dashboardDone! Claude Code now has 11 security tools via MCP. Guard monitors everything 24/7.
OCOpenClaw
Step 1: Install PanGuard
npm install -g @panguard-ai/panguard && pga upStep 2: Auto-configure OpenClaw
pga setup --platform openclawStep 3: Close and reopen OpenClaw
Step 4: In OpenClaw, PanGuard tools are now available. Try:
# In OpenClaw, ask: "use panguard to scan this project" "audit the skill I just installed"
Step 5: Start Guard for continuous protection
pga guard start --dashboardDone! Every skill OpenClaw installs will be automatically audited.
Or auto-detect all platforms at once:
pga setupDetects 16 platforms including Claude Code, Claude Desktop, Cursor, OpenClaw, Codex, Windsurf, Gemini CLI, and more automatically.
GitHub Action (CI/CD)
Block malicious MCP skills and SKILL.md files before they reach production. One line in your workflow. Results appear in the GitHub Security tab.
Add to your workflow (.github/workflows/atr-scan.yml):
name: ATR Security Scan on: [push, pull_request] jobs: atr-scan: runs-on: ubuntu-latest permissions: security-events: write steps: - uses: actions/checkout@v4 - uses: Agent-Threat-Rule/agent-threat-rules@v1 with: severity: medium # minimum severity to report fail-on-finding: true # block PRs with threats
What it does: Scans your repo for MCP config files and SKILL.md files using 311 ATR detection rules. Outputs SARIF to the GitHub Security tab.
Options:
severity— minimum level to report: informational, low, medium (default), high, criticalfail-on-finding— setfalseto warn without blockingpath— scan a specific directory (default: entire repo)
步驟二:執行第一次掃描
快速掃描會在約 60 秒內檢查系統常見弱點。
pga scan若需全面分析,包含所有 port、SSL 憑證和設定檔:
pga scan --deep步驟三:啟用即時防護
Guard 以背景程式運行,使用 ATR 偵測規則 24/7 監控你的 AI Agent。
pga guard start步驟四:設定通知
Panguard Chat 會在偵測到威脅和修復完成時,用你聽得懂的語言通知你。
panguard chat config # Follow the prompts to connect LINE, Slack, or Telegram
步驟五:了解掃描結果
每次掃描都會產出安全分數、等級和詳細發現。以下說明如何解讀。
- 安全分數(0-100):0 = 極度危險,100 = 完全防護。低於 60 分需要立即處理。
- 等級:A(90+)、B(75-89)、C(60-74)、D(40-59)、F(40 以下)。目標至少 B 等級。
- 發現項目按嚴重度排序:Critical > High > Medium > Low。優先處理 Critical 問題。
步驟六:JSON 輸出與 AI Agent 整合
Panguard 是 Agent-Native 架構。使用 --json 取得機器可讀的輸出,AI Agent 可以直接解析。
pga scan --json{"riskScore": 72, "findings": 8, "critical": 1, "high": 2, "medium": 3, "low": 2,
"scanDuration": "47s", "framework": "ISO 27001",
"topFinding": "SSH root login enabled (critical)"}
SAST Code Scanning
Scan your source code for SQL injection, XSS, hardcoded secrets, and more.
pga scan code --dir ./my-app --json[OK] Scanning ./my-app (142 files)
[OK] Semgrep: 3 findings
[OK] Built-in patterns: 1 finding
[OK] Secrets scanner: 0 findings
{"totalFindings": 4, "critical": 1, "high": 2, "medium": 1,
"topFinding": "Hardcoded AWS access key in config.js (critical)"}
步驟七:遠端掃描
從外部掃描任何伺服器或網域。Panguard 會檢查開放的 port、SSL 憑證、HTTP 標頭和 DNS 記錄。
pga scan --target example.com panguard scan --target 1.2.3.4 --json
步驟八:合規報告
自動產生 ISO 27001、SOC 2 或台灣資通安全管理法合規報告。
panguard report generate --framework iso27001 panguard report generate --framework soc2 panguard report generate --framework tcsa
更多 CLI 指令
Panguard 有完整的 CLI 工具組。以下是 scan 和 guard 以外最常用的指令。
pgapga uppga setuppga scanpga scan --deeppga audit skill <dir>pga guard startpga statuspga doctorpga --help完整部署 Checklist
按照以下步驟完成 Panguard 的完整部署。每一步都是獨立的,可以依你的需求選擇啟用。
1. 安全掃描 — 拿到安全評分
掃描你的系統,取得安全評分和弱點報告。快速模式約 30 秒,完整模式約 60 秒。
panguard scan2. 即時防護 — 啟動 Guard 守護程序
Guard 會 24/7 監控你的系統。前 7 天是學習模式(偵測 + 記錄),之後自動切換為保護模式(偵測 + 封鎖)。
panguard guard start3. 告警通知 — 設定 Telegram / Slack
收到威脅時即時通知你。支援 Telegram、Slack、Email 和 Webhook。
panguard chat config4. 蜜罐(選用)— 部署蜜罐陷阱
在你的伺服器上部署假的 SSH、HTTP、MySQL 等服務,捕捉攻擊者的行為和意圖。
panguard trap start --services ssh,http5. 合規報告(選用)— 產生合規報告
自動產生 ISO 27001、SOC 2 或台灣資安法合規報告。可作為稽核佐證。
panguard report generate --framework iso27001進階組態
Panguard 開箱即用,但你可以透過選配的外部工具增強偵測能力。所有工具都支援優雅降級——即使外部工具不可用,Panguard 也不會停止運作。
Ollama -- 在本地執行 AI 分析,無需雲端 API。適合離線環境。
關鍵環境變數:ANTHROPIC_API_KEY(Claude AI)、OPENAI_API_KEY(GPT 備選)、PANGUARD_LLM_MODEL(Ollama 模型覆寫)、OLLAMA_API_ENDPOINT(自訂 Ollama URL)。
查看完整的進階設定指南,了解安裝說明和組態細節。多端點部署
在多台伺服器上部署 Panguard 非常簡單。小規模叢集可用 SSH 迴圈,大規模環境建議使用 Ansible。
#!/bin/bash # servers.txt: one IP per line for server in $(cat servers.txt); do ssh root@$server 'curl -fsSL https://get.panguard.ai | bash && panguard guard start' done
如果有 20 台以上的伺服器,建議使用 Ansible Playbook 進行冪等、可重複的部署。
查看完整的多端點部署指南,了解 Ansible Playbook 範例和 Threat Cloud 整合。