Skip to main content

Guard 已在運行

Error: Panguard Guard is already running (PID: 12345)
另一個 Guard 實例正在運作。請先停止它:
# 停止運行中的實例
sudo panguard guard stop

# 如果停止失敗,檢查並移除 PID 檔案
cat ~/.panguard-guard/guard.pid
sudo kill $(cat ~/.panguard-guard/guard.pid)
rm ~/.panguard-guard/guard.pid

# 現在重新啟動
sudo panguard guard start
不要在同一台機器上執行多個 Guard 實例。它們會在日誌檔存取、防火牆規則和監控資源上產生衝突。
如果 PID 檔案引用了不再存在的程序(過期 PID):
# 驗證程序是否確實已停止
ps -p $(cat ~/.panguard-guard/guard.pid)

# 如果顯示「no such process」,安全地移除 PID 檔案
rm ~/.panguard-guard/guard.pid
sudo panguard guard start

權限被拒

Error: EACCES: permission denied, open '/var/log/auth.log'
Guard 需要 root/admin 權限來讀取系統日誌和管理防火牆規則。
sudo panguard guard start

高記憶體使用量

如果 Guard 消耗的記憶體超出預期:
panguard status --verbose
正常記憶體範圍:
元件典型記憶體
核心代理50—100 MB
Sigma 引擎(3,000 規則)約 50 MB
YARA 引擎(900 規則)約 30 MB
AI 分析(本機)100—500 MB
合計230—680 MB
  1. 停用未使用的監控器 — 關閉不需要的子系統監控:
    panguard config set monitoring.dockerEvents false
    panguard config set monitoring.kernelModules false
    
  2. 減少規則數量 — 停用不需要的規則類別:
    panguard config set rules.excludeCategories '["informational", "test"]'
    
  3. 使用遠端 AI 而非本機 — 從 Ollama 切換到雲端 AI 提供者以節省本機模型使用的記憶體:
    export ANTHROPIC_API_KEY=sk-ant-...
    # 如果正在運行則停止 Ollama
    
  4. 增加垃圾回收 — 用於 Node.js 記憶體最佳化:
    export NODE_OPTIONS="--max-old-space-size=512"
    

誤報

如果 Guard 對合法活動產生太多警報:
預設學習期間為 7 天。如果您的工作負載較複雜,請延長它:
panguard config set learningDays 14
重設學習資料並重新啟動:
sudo panguard guard stop
panguard config set mode learning
sudo panguard guard start
提高特定威脅類型的閾值:
# 在警報前需要更多事件用於暴力破解
panguard config set response.minConfidence 0.90

# 增加 SSH 失敗閾值
panguard config set rules.sshFailureThreshold 20
將受信任的 IP 和程序加入白名單:
# 將 IP 加入白名單
panguard config set response.whitelistedIps '["10.0.0.0/8", "192.168.1.100"]'

# 將程序加入白名單
panguard config set response.whitelistedProcesses '["backup-agent", "monitoring-daemon"]'
識別並停用導致誤報的特定規則:
# 檢查帶有規則 ID 的最近警報
panguard guard logs --severity low --limit 20

# 停用特定規則
panguard config set rules.excludeIds '["sigma-noisy-001"]'

自動回應未執行

如果 Guard 偵測到威脅但未採取自動動作:
自動回應需要 Solo 層級或更高。Community 層級僅支援偵測,不支援自動回應。
panguard whoami
# 如果層級是「community」,請升級:
panguard upgrade
自動回應僅在 AI 信心分數超過 minConfidence 時觸發:
# 檢查目前閾值
panguard config get response.minConfidence
如果偵測低於閾值,謹慎地降低它:
panguard config set response.minConfidence 0.80
minConfidence 設定在 0.7 以下會顯著增加誤報回應的風險(封鎖合法 IP 或終止合法程序)。
panguard config get response.enabled
panguard config get response.autoBlock
如果停用,請啟用:
panguard config set response.enabled true
panguard config set response.autoBlock true
自動回應在 learningdetect 模式下不會執行:
panguard config get mode
切換到 protect 模式:
panguard config set mode protect
sudo panguard guard restart
如果啟用了 requireApproval,Guard 會發送核准請求而非自動執行:
panguard config get response.requireApproval
# 如果為 true,檢查待處理的核准:
panguard guard approvals

Guard 啟動時當機

cat ~/.panguard-guard/logs/guard.log | tail -50
或使用 CLI:
panguard guard logs --limit 50
panguard doctor
這會檢查 Node.js 版本、權限、磁碟空間、埠可用性和設定有效性。
如果設定檔已損壞:
# 備份目前設定
cp ~/.panguard-guard/config.json ~/.panguard-guard/config.json.bak

# 重設為預設值
rm ~/.panguard-guard/config.json
sudo panguard guard start