> ## Documentation Index
> Fetch the complete documentation index at: https://docs.panguard.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 部署 Threat Cloud

> 自架 Threat Cloud 伺服器，集中管理威脅情報，資料完全掌握在自己手上。

Threat Cloud 是 Panguard 的自架威脅情報平台。它彙總來自 Guard agent 和蜜罐的入侵指標 (IoC)，提供 feed 端點給下游工具訂閱，追蹤攻擊活動 -- 資料完全留在你的基礎設施。

<Steps>
  <Step title="啟動 Threat Cloud 伺服器">
    指定 port 啟動：

    ```bash theme={null}
    panguard threat start --port 8080
    ```

    ```
      PANGUARD AI - Threat Cloud

      Starting Threat Cloud server...

      -- Server Info ----------------------------

      URL:        http://localhost:8080
      Database:   SQLite (./panguard-threat.db)
      API Key:    pg_threat_abc123...
      Rate Limit: 100 req/min

      Threat Cloud is running.
      API documentation: http://localhost:8080/docs
    ```

    <Info>
      API key 在第一次啟動時自動產生，存在 Panguard config 裡。所有 API 請求都用它來認證。
    </Info>
  </Step>

  <Step title="了解架構">
    Threat Cloud 用輕量級架構，適合單台伺服器部署：

    | 元件      | 技術                    | 用途                 |
    | ------- | --------------------- | ------------------ |
    | **資料庫** | SQLite                | 存 IoC、攻擊活動、feed 資料 |
    | **API** | REST + JSON           | 所有資源的 CRUD         |
    | **認證**  | API key（Bearer token） | 認證所有請求             |
    | **限流**  | 預設 100 req/min        | 防濫用，可調整            |

    <Note>
      SQLite 是預設後端。大流量部署（10+ 個 agent）建議把資料庫放 SSD，開啟 WAL 模式：`panguard threat start --db-wal`。
    </Note>
  </Step>

  <Step title="管理入侵指標">
    手動加 IoC，或讓 Guard agent 自動推送：

    <CodeGroup>
      ```bash 透過 CLI 加 IoC theme={null}
      panguard threat ioc add \
        --type ip \
        --value "203.0.113.42" \
        --severity high \
        --tags "brute-force,ssh"
      ```

      ```bash 列出最近的 IoC theme={null}
      panguard threat ioc list --limit 20
      ```

      ```bash 搜尋 IoC theme={null}
      panguard threat ioc search --value "203.0.113.*"
      ```
    </CodeGroup>

    Guard agent 推上來的 IoC 會附完整上下文：觸發事件、蜜罐互動資料、分析結果。
  </Step>

  <Step title="設定 feed 端點">
    Threat Cloud 公開 feed 端點，讓 SIEM、防火牆、其他 Panguard 實例訂閱：

    ```
    GET /api/v1/feeds/ip-blocklist     要封鎖的 IP
    GET /api/v1/feeds/domain-blocklist  惡意 domain
    GET /api/v1/feeds/ioc-all          所有 IoC（STIX 2.1 格式）
    ```

    範例：拉 IP 封鎖清單：

    ```bash theme={null}
    curl -H "Authorization: Bearer pg_threat_abc123..." \
      http://localhost:8080/api/v1/feeds/ip-blocklist
    ```

    ```json theme={null}
    {
      "feed": "ip-blocklist",
      "updated": "2026-03-07T14:00:00Z",
      "count": 42,
      "indicators": [
        { "value": "203.0.113.42", "severity": "high", "last_seen": "2026-03-07T14:30:22Z" },
        { "value": "198.51.100.17", "severity": "medium", "last_seen": "2026-03-07T03:12:44Z" }
      ]
    }
    ```
  </Step>

  <Step title="追蹤攻擊活動">
    把相關 IoC 和事件歸到同一個攻擊活動，方便調查：

    <CodeGroup>
      ```bash 建立攻擊活動 theme={null}
      panguard threat campaign create \
        --name "SSH Brute Force Wave" \
        --description "Coordinated brute-force attacks from CN/RU ranges" \
        --iocs "203.0.113.42,198.51.100.17,192.0.2.88"
      ```

      ```bash 列出攻擊活動 theme={null}
      panguard threat campaign list
      ```

      ```bash 看攻擊活動詳情 theme={null}
      panguard threat campaign view --name "SSH Brute Force Wave"
      ```
    </CodeGroup>
  </Step>

  <Step title="隱私與資料處理">
    Threat Cloud 以隱私為核心設計原則：

    * **自架：** 所有資料留在你的基礎設施
    * **匿名化：** 共享 feed 中的 IP 可做 hash 處理
    * **零遙測：** 不會送任何資料到 Panguard AI 伺服器
    * **資料保留：** IoC 的 TTL 可設定（預設 90 天）

    ```bash theme={null}
    panguard threat start --port 8080 \
      --retention-days 30 \
      --anonymize-feeds
    ```

    <Warning>
      如果要把 Threat Cloud 開放到外網，務必用 HTTPS（反向代理）並限制 IP 或 VPN 存取。光靠 API key 不足以應對公開部署。
    </Warning>
  </Step>
</Steps>

## 下一步

<CardGroup cols={2}>
  <Card title="Threat Cloud 產品參考" icon="book" href="/products/threat-cloud/overview">
    Threat Cloud 平台與架構的完整文件。
  </Card>

  <Card title="隱私模型" icon="lock" href="/products/threat-cloud/privacy">
    資料處理、匿名化、保留政策的詳細說明。
  </Card>

  <Card title="Threat Cloud API" icon="code" href="/api-reference/threat-cloud/ioc">
    IoC、feed、攻擊活動端點的完整 API 參考。
  </Card>

  <Card title="Docker 部署" icon="docker" href="/guides/docker-deployment">
    用容器跑 Threat Cloud。
  </Card>
</CardGroup>
