設定進階的網路分散式阻斷服務防護功能

分散式阻斷服務 (DDoS) 攻擊是指惡意行為者蓄意中斷公開網站、系統和 API 的運作,藉此降低正當使用者的體驗。對於使用外部直通式網路負載平衡器通訊協定轉送或具備公開 IP 位址 VM 的工作負載,Google Cloud Armor 提供下列選項,協助保護系統免受 DDoS 攻擊:

  • 標準網路 DDoS 防護:為外部直通式網路負載平衡器、通訊協定轉送或使用公開 IP 位址的 VM 提供基本全天候防護。這項功能屬於 Google Cloud Armor Standard 的一部分,不需要額外訂閱。
  • 進階網路 DDoS 防護:為使用外部直通式網路負載平衡器、通訊協定轉送或具備公開 IP 位址 VM 的 Cloud Armor Enterprise 訂閱者,提供額外防護。如要進一步瞭解 Cloud Armor Enterprise,請參閱 Cloud Armor Enterprise 總覽

本文說明標準和進階網路 DDoS 防護功能的差異、進階網路 DDoS 防護功能的運作方式,以及如何啟用進階網路 DDoS 防護功能。

比較標準和進階網路 DDoS 防護功能

請參閱下表,比較標準和進階網路分散式阻斷服務防護功能。

功能 標準網路 DDoS 防護 進階的網路分散式阻斷服務防護功能
受保護的端點類型
  • 外部直通式網路負載平衡器
  • 通訊協定轉送
  • 具有公開 IP 位址的 VM
  • 外部直通式網路負載平衡器
  • 通訊協定轉送
  • 具有公開 IP 位址的 VM
轉送規則強制執行
全天候監控攻擊並發出快訊
針對性攻擊緩解措施
減緩遙測

網路分散式阻斷服務防護的運作方式

標準網路 DDoS 防護功能一律會啟用。您不必採取任何行動即可啟用。

您可以針對每個區域設定進階網路分散式阻斷服務防護功能。您不必將網路邊緣安全性政策與一或多個目標集區、目標執行個體、後端服務或具有外部 IP 位址的執行個體建立關聯,而是與特定區域中的網路邊緣安全性服務建立關聯。為該區域啟用這項功能後,Google Cloud Armor 就會提供全天候的針對性巨流量攻擊偵測與緩解服務,保護該區域中的外部直通式網路負載平衡器、通訊協定轉送作業和使用公開 IP 位址的 VM。您只能將進階網路 DDoS 防護功能套用至已註冊 Cloud Armor Enterprise 的專案。

設定進階網路分散式阻斷服務防護功能時,請先在所選區域中建立 CLOUD_ARMOR_NETWORK 類型的安全性政策。接著,更新安全性政策,啟用進階網路分散式阻斷服務防護功能。最後,您會建立網路邊緣安全服務,這項資源可附加 CLOUD_ARMOR_NETWORK 類型的安全政策。將安全性政策附加至網路邊緣安全服務後,所選區域中所有適用的端點都會啟用進階網路 DDoS 防護功能。

進階網路分散式阻斷服務防護功能會測量基準流量,以提升緩解效能。啟用進階網路 DDoS 防護功能後,系統會先進行 24 小時的訓練,再建立可靠的基準,並運用訓練結果強化防護措施。訓練期結束後,進階網路 DDoS 防護功能會根據歷來流量套用額外的緩解技術。

啟用進階網路 DDoS 防護功能

請按照下列步驟啟用進階網路 DDoS 防護功能。

註冊 Cloud Armor Enterprise

專案必須註冊 Cloud Armor Enterprise,才能在每個區域啟用進階網路 DDoS 防護功能。啟用後,啟用區域中的所有區域端點都會受到進階網路 DDoS 防護機制持續保護。

請確認帳單帳戶有有效的 Cloud Armor Enterprise 訂閱方案,且目前專案已註冊 Cloud Armor Enterprise。如要進一步瞭解如何註冊 Cloud Armor Enterprise,請參閱「訂閱 Cloud Armor Enterprise 並註冊專案」。

設定身分與存取權管理 (IAM) 權限

如要設定、更新或刪除 Google Cloud Armor 邊緣安全服務,您需要下列 IAM 權限:

  • compute.networkEdgeSecurityServices.create
  • compute.networkEdgeSecurityServices.update
  • compute.networkEdgeSecurityServices.get
  • compute.networkEdgeSecurityServices.delete

下表列出 IAM 角色的基本權限和相關聯的 API 方法。

IAM 權限 API 方法
compute.networkEdgeSecurityServices.create networkEdgeSecurityServices insert
compute.networkEdgeSecurityServices.update networkEdgeSecurityServices patch
compute.networkEdgeSecurityServices.get networkEdgeSecurityServices get
compute.networkEdgeSecurityServices.delete networkEdgeSecurityServices delete
compute.networkEdgeSecurityServices.list networkEdgeSecurityServices aggregatedList

如要進一步瞭解使用 Google Cloud Armor 時所需的 IAM 權限,請參閱「為 Google Cloud Armor 安全性政策設定 IAM 權限」。

設定進階網路 DDoS 防護功能

請按照下列步驟啟用進階網路 DDoS 防護功能。

  1. 建立 CLOUD_ARMOR_NETWORK 類型的安全性政策,或使用 CLOUD_ARMOR_NETWORK 類型的現有安全性政策。

     gcloud compute security-policies create SECURITY_POLICY_NAME \
         --type CLOUD_ARMOR_NETWORK \
         --region REGION
    

    更改下列內容:

    • SECURITY_POLICY_NAME:您要為安全性政策指定的名稱
    • REGION:您要佈建安全性政策的區域
  2. --network-ddos-protection 旗標設為 ADVANCED,即可更新新建立或現有的安全性政策。

     gcloud compute security-policies update SECURITY_POLICY_NAME \
         --network-ddos-protection ADVANCED \
         --region REGION
    

    或者,您也可以將 --network-ddos-protection 旗標設為 ADVANCED_PREVIEW,在預覽模式中啟用安全性政策。

     gcloud beta compute security-policies update SECURITY_POLICY_NAME \
         --network-ddos-protection ADVANCED_PREVIEW \
         --region REGION
    
  3. 建立參照安全性政策的網路邊緣安全防護服務。

     gcloud compute network-edge-security-services create SERVICE_NAME \
         --security-policy SECURITY_POLICY_NAME \
         --region REGION
    

停用進階網路 DDoS 防護功能

如要停用進階網路分散式阻斷服務防護功能,可以更新或刪除安全性政策。

更新安全性政策

請使用下列指令更新安全性政策,將 --network-ddos-protection 標記設為 STANDARD。將變數替換為與部署作業相關的資訊。

gcloud compute security-policies update SECURITY_POLICY_NAME \
    --network-ddos-protection STANDARD \
    --region REGION

刪除安全性政策

如要刪除網路邊緣安全性政策,請先從網路邊緣安全服務中移除該政策,因為您無法刪除使用中的安全性政策。如要刪除安全性政策,請按照下列步驟操作:

  1. 從網路邊緣安全服務中移除政策,或刪除網路邊緣安全服務。

    • 如要從網路邊緣安全服務移除政策,請使用下列指令:

      gcloud compute network-edge-security-services update SERVICE_NAME \
         --security-policy="" \
         --region=REGION_NAME
      
    • 如要刪除網路邊緣安全服務,請使用下列指令:

      gcloud compute network-edge-security-services delete SERVICE_NAME \
         --region=REGION_NAME
      
  2. 使用下列指令刪除安全性政策:

      gcloud compute security-policies delete SECURITY_POLICY_NAME
    

使用預覽模式

預覽模式可讓您監控進階網路 DDoS 防護功能的效果,而不必強制執行緩解措施。

Cloud Armor Enterprise 訂閱者也可以為進階網路 DDoS 防護政策啟用預覽模式。在預覽模式中,您會收到偵測到的攻擊和建議緩解措施的所有記錄和遙測資料。不過,系統不會強制執行建議的緩解措施。這樣就能在啟用緩解措施前,先測試其成效。由於每項政策都是依據區域設定,因此您可以依據區域啟用或停用預覽模式。

如要啟用預覽模式,請將 --ddos-protection 旗標設為 ADVANCED_PREVIEW。 您可以參考下列範例更新現有政策。

gcloud beta compute security-policies update POLICY_NAME \
    --network-ddos-protection ADVANCED_PREVIEW \
    --region=REGION

更改下列內容:

  • POLICY_NAME:政策名稱
  • REGION:政策所在的區域。

如果安全政策在攻擊期間處於預覽模式,且您想強制執行緩解措施,可以更新安全政策,將 --network-ddos-protection 旗標設為 ADVANCED。政策幾乎會立即生效,下一個 MITIGATION_ONGOING 記錄事件會反映這項變更。MITIGATION_ONGOING 記錄事件每五分鐘發生一次。

網路 DDoS 緩解遙測

Google Cloud Armor 在緩解 DDoS 攻擊時,會產生三種事件記錄:MITIGATION_STARTEDMITIGATION_ONGOINGMITIGATION_ENDED。您可以使用下列記錄篩選器,依緩解類型查看記錄:

減緩類型 記錄檔篩選器
緩解開始

resource.type="network_security_policy"

jsonPayload.mitigationType="MITIGATION_STARTED"

正在緩解

resource.type="network_security_policy"

jsonPayload.mitigationType="MITIGATION_ONGOING"

緩解結束

resource.type="network_security_policy"

jsonPayload.mitigationType="MITIGATION_ENDED"

Cloud Logging 攻擊緩解事件記錄

以下各節提供每種事件記錄的記錄格式範例:

已開始緩解

  @type: "type.googleapis.com/google.cloud.networksecurity.cloudarmor.logging.v1.CloudArmorMitigationAlert"
  alertId: "11275630857957031521"
  mitigation_type: "MITIGATION_STARTED"
  target_vip: "XXX.XXX.XXX.XXX"
  total_volume: {
   pps: 1400000
   bps: 140000000
  }
  started: {
   total_attack_volume: {
    pps: 1100000
    bps: 110000000
   }
   classified_attack: {
    attack_type: "NTP-udp"
    attack_volume: {
       pps: 500000
       bps: 50000000
    }
   }
   classified_attack: {
    attack_type: "CHARGEN-udp"
    attack_volume: {
       pps: 600000
       bps: 60000000
    }
   }
   attack_sources: {
    top_source_asns: {
      asn: "ABCDEF"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_asns: {
      asn: "UVWXYZ"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_geos: {
      region_code: "XX"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_geos: {
      region_code: "XY"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_ips: {
      region_code: "xx.xx.xx.xx"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_ips: {
      region_code: "yy.yy.yy.yy"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
   }
  }
  

正在緩解

  @type: "type.googleapis.com/google.cloud.networksecurity.cloudarmor.logging.v1.CloudArmorMitigationAlert"
  alertId: "11275630857957031521"
  mitigation_type: "MITIGATION_ONGOING"
  target_vip: "XXX.XXX.XXX.XXX"
  total_volume: {
   pps: 1500000
   bps: 150000000
  }
  ongoing: {
   total_attack_volume: {
    pps: 1100000
    bps: 110000000
   }
   classified_attack: {
    attack_type: "NTP-udp"
    attack_volume: {
       pps: 500000
       bps: 50000000
    }
   }
   classified_attack: {
    attack_type: "CHARGEN-udp"
    attack_volume: {
       pps: 600000
       bps: 60000000
    }
   }
   attack_sources: {
    top_source_asns: {
      asn: "ABCDEF"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_asns: {
      asn: "UVWXYZ"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_geos: {
      region_code: "XX"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_geos: {
      region_code: "XY"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_ips: {
      region_code: "xx.xx.xx.xx"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
    top_source_ips: {
      region_code: "yy.yy.yy.yy"
      volume: {
        pps: 20000
        bps: 2000000
      }
    }
   }
  }
  

緩解完成

  @type: "type.googleapis.com/google.cloud.networksecurity.cloudarmor.logging.v1.CloudArmorMitigationAlert"
  alertId: "11275630857957031521"
  mitigation_type: "MITIGATION_ENDED"
  target_vip: "XXX.XXX.XXX.XXX"
  ended: {
      attack_duration_seconds: 600
      attack_type: "NTP-udp"
  }
  

在預覽模式中,每個前述 mitigation_type 前面都會有 PREVIEWED_。舉例來說,在預覽模式中,MITIGATION_STARTED 會改為 PREVIEWED_MITIGATION_STARTED

如要查看這些記錄,請前往記錄檔探索工具,並查看 network_security_policy 資源。

前往記錄檔探索工具

如要進一步瞭解如何查看記錄,請參閱「查看記錄」。

Security Command Center 發現項目

透過 Security Command Center 資訊主頁,您可以監控及因應以直通網路負載平衡器和虛擬機器為目標的大量 DDoS 攻擊。Google Cloud Armor 偵測到攻擊時,資訊主頁和 Google Cloud Armor 資訊卡會顯示標示為「Volumetric DDoS Attack Attempt - Network LB/VMs」(巨流量 DDoS 攻擊嘗試 - 網路負載平衡器/VM) 的專屬發現項目。

這項發現包含相關記錄的直接連結,並提供下列資訊,協助您瞭解攻擊:

  • 遭受攻擊的特定資源
  • 影響資源的流量
  • 攻擊分類 (例如 UDP、TCP 或 SYN 洪水攻擊)

發現項目會動態反映攻擊狀態。攻擊狀態是根據下列記錄事件判斷:

  • 已開始緩解:緩解措施開始時會顯示這項發現
  • 正在緩解:隨著緩解作業的進展,系統會自動更新調查結果,讓您掌握最新情況。下圖顯示有效發現事項的範例:

    有效的 Security Command Center 發現項目。
    有效的 Security Command Center 發現項目 (按一下即可放大)。
  • 緩解措施已結束:攻擊減緩並結束緩解措施後,這項發現就會變成非使用中,提供事件記錄。以下螢幕截圖顯示了停用發現項的範例:

    處於非使用中狀態的 Security Command Center 發現項目。
    處於非使用中狀態的 Security Command Center 發現項目 (按一下即可放大)。

後續步驟