【GCP教學】如何使用 Cloud Load Balancer + Cloud Armor 限制流量與增強 GCP 安全性

情境

Google Cloud (舊稱:GCP) 是否有提供透過 Cloud Load Balancer + Cloud Armor 的方式來限制流量?

操作

您可透過 Google Cloud Armor 來達到您想限制特定來源 IP 存取的目的,建立安全策略 (Create security policy) 且設定要限制的 IP 並將其規則分配給 HTTP(S) 附載平衡器,以達到限制特定 IP 存取。

啟用 Cloud Armor 會收取額外的費用,以下是 Cloud Armor Standard Tier 的收費方式:

(1) WAF HTTP 請求

(2) WAF 安全政策

(3) WAF 規則

Cloud Armor Standard Tier 會依照 WAF HTTP requests, WAF security policies 和 WAF rules 的數量多寡來收取費用,建議您如果想限制流量可先 block all user 再開白名單。

另外 Cloud Armor 生效大約需要 5 分鐘,請測試後再更新至正式環境以避免無法連線。

Managed Protection

Standard VS Managed Protection Plus

我們可以總結兩者的差異在於多了兩個進階的功能(Named IP Lists 和 Adaptive Protection)。

  1. Named IP Lists 是 Cloud Armor 整合第三方廠商 (目前有 Fastly, CloudFlare, Imperva)的 IP 名單,讓您不需要在 Cloud Armor 針對像是 CloudFlare 的 IP 或是 IP 網段進行一一的配置。
  2. Adaptive Protection 是 GCP 使用機器學習等等的技術幫助您 monitor 目前潛在的安全危機。透過機器學習持續分析您的系統,然後當發現可能攻擊的行為時會跳出 alert 並給您建議的規則,讓您能夠加入到 Cloud Armor 的 rules 中。
  • Standard 版本 : 就是一般用多少付多少的機制,一般 WAF rule 做使用,可以使用Adaptive Protection 但只有基本的儀表板功能(沒有 alert 、建議的 rules 等等功能)。
  • Plus 版本:一年訂閱方案配套,除了 Standard 版本有的之外,還有 named IP address list 跟完整的 Adaptive Protection 功能等等。

Log

觀察被 deny 的 request URL pattern

resource.type="http_load_balancer" previewSecurityPolicy

resource.type="http_load_balancer"

jsonPayload.previewSecurityPolicy.outcome="DENY"

參考文件

[1] https://cloud.google.com/armor/docs/configure-security-policies#https-load-balancer

[2] https://cloud.google.com/armor/pricing

[3] https://cloud.google.com/armor/docs/threat-intelligence

[4] https://cloud.google.com/armor/docs/adaptive-protection-overview

[5] https://cloud.google.com/armor/docs/rule-tuning#remote_code_execution_rce

訂閱 CloudMile 電子報

所有 CloudMile 最新消息、產品動態、活動資訊和特別優惠,立即掌握。