安全狀態分析自訂模組總覽

本頁面提供安全狀態分析自訂模組的總覽。如要瞭解內建模組,請參閱「安全狀態分析內建偵測工具」。

透過自訂模組,您可以建立自訂偵測工具,掃描您使用規則指定的 Google Cloud資源和政策,檢查是否有安全漏洞、錯誤設定或違規情形,藉此擴充 Security Health Analytics 的偵測功能。

無論您是在Google Cloud 控制台中建立自訂模組,還是自行編寫程式碼,自訂模組的設定或定義都會決定偵測工具檢查的資源、評估的屬性,以及偵測到安全漏洞或設定錯誤時傳回的資訊。

您可以為 Security Command Center 支援的任何資源或資產建立自訂模組。

如果您自行編寫自訂模組定義,請使用 YAML 和一般運算語言 (CEL) 運算式。如果您使用Google Cloud 控制台建立自訂模組,系統會為您完成大部分的程式碼編寫作業,但您仍需編寫 CEL 運算式。

如需 YAML 檔案中的自訂模組定義範例,請參閱「自訂模組定義範例」。

自訂模組會與安全狀態分析的內建偵測器一起執行即時和批次掃描。在即時模式下,只要資產設定變更,就會觸發掃描。系統每天會為已註冊的機構或專案,使用所有偵測器執行批次模式掃描。

掃描期間,系統會將每個自訂偵測器套用至已啟用偵測器的每個機構、資料夾或專案中所有相符的資產。

自訂偵測器發現項目會寫入 Security Command Center。

如要瞭解詳情,請參考下列資源:

比較內建偵測工具和自訂模組

自訂模組提供的偵測功能比內建的安全狀態分析偵測工具更廣泛。不過,自訂模組不支援內建偵測器提供的部分 Security Command Center 功能。

功能支援

攻擊路徑模擬不支援安全狀態分析自訂模組。自訂模組產生的發現項目不會包含受攻擊風險分數或攻擊路徑

比較偵測邏輯

舉例來說,如要瞭解自訂模組的用途,請比較內建偵測器 PUBLIC_SQL_INSTANCE 的檢查項目與自訂模組的檢查項目。

內建偵測器 PUBLIC_SQL_INSTANCE 會檢查 Cloud SQL 執行個體的 authorizedNetworks 屬性是否設為 0.0.0.0/0。如果是,偵測工具會產生一項發現項目,指出 Cloud SQL 執行個體對外開放,因為該執行個體接受來自所有 IP 位址的連線。

使用自訂模組,您可以實作更複雜的偵測邏輯,檢查 Cloud SQL 執行個體是否符合下列條件:

  • 使用萬用字元指定前置字串的 IP 位址。
  • state 屬性的值,可用於在值設為 MAINTENANCE 時忽略執行個體,或在值為其他內容時觸發發現項目。
  • region 屬性的值,可用於只針對特定區域中具有公開 IP 位址的執行個體觸發結果。

必要 IAM 角色和權限

IAM 角色會決定您可透過安全狀態分析自訂模組執行的動作。

下表列出安全狀態分析自訂模組所需的權限,以及包含這些權限的預先定義 IAM 角色。

您可以使用 Google Cloud 控制台或 Security Command Center API,在機構、資料夾或專案層級套用這些角色。

必要權限 角色
securitycentermanagement.securityHealthAnalyticsCustomModules.create
securitycentermanagement.securityHealthAnalyticsCustomModules.update
securitycentermanagement.securityHealthAnalyticsCustomModules.delete
securitycentermanagement.securityHealthAnalyticsCustomModules.list
securitycentermanagement.securityHealthAnalyticsCustomModules.get
securitycentermanagement.effectiveSecurityHealthAnalyticsCustomModules.list
securitycentermanagement.effectiveSecurityHealthAnalyticsCustomModules.get
securitycentermanagement.securityHealthAnalyticsCustomModules.simulate
securitycentermanagement.securityHealthAnalyticsCustomModules.test
roles/securitycentermanagement.shaCustomModulesEditor
roles/securitycenter.settingsEditor
roles/securitycenter.admin
securitycentermanagement.securityHealthAnalyticsCustomModules.list
securitycentermanagement.securityHealthAnalyticsCustomModules.get
securitycentermanagement.effectiveSecurityHealthAnalyticsCustomModules.list
securitycentermanagement.effectiveSecurityHealthAnalyticsCustomModules.get
securitycentermanagement.securityHealthAnalyticsCustomModules.simulate
securitycentermanagement.securityHealthAnalyticsCustomModules.test
roles/securitycentermanagement.shaCustomModulesViewer
roles/securitycenter.settingsViewer
roles/securitycenter.adminViewer
roles/securitycenter.admin

如要進一步瞭解 IAM 權限和角色,以及如何授予這些權限和角色,請參閱「使用 Google Cloud 控制台授予 IAM 角色」。

自訂模組配額

安全狀態分析自訂模組有配額限制。

建立自訂模組的預設配額上限為 100,但如有需要,您可以申請提高配額。

呼叫自訂模組方法的 API 也會受到配額限制。下表列出自訂模組 API 呼叫的預設配額限制。

API 呼叫類型 限制
CustomModules 讀取要求 (Get、List) 每個機構每分鐘 1,000 次 API 呼叫
CustomModules 寫入要求 (建立、更新、刪除) 每個機構每分鐘 60 次 API 呼叫
CustomModules 測試要求 每個機構每分鐘 12 次 API 呼叫

如要申請提高配額,請在 Google Cloud 控制台的「配額」頁面提出要求。

如要進一步瞭解 Security Command Center 配額,請參閱「配額與限制」。

支援的資源類型

本節概述自訂模組支援的 Google Cloud 資源類型。

服務名稱 資源名稱
Access Context Manager accesscontextmanager.googleapis.com/AccessLevel
accesscontextmanager.googleapis.com/AccessPolicy
accesscontextmanager.googleapis.com/ServicePerimeter
Gemini Enterprise Agent Platform aiplatform.googleapis.com/BatchPredictionJob
aiplatform.googleapis.com/CustomJob
aiplatform.googleapis.com/Dataset
aiplatform.googleapis.com/Endpoint
aiplatform.googleapis.com/Featurestore
aiplatform.googleapis.com/HyperparameterTuningJob
aiplatform.googleapis.com/Index
aiplatform.googleapis.com/MetadataStore
aiplatform.googleapis.com/Model
aiplatform.googleapis.com/NotebookRuntimeTemplate
aiplatform.googleapis.com/SpecialistPool
aiplatform.googleapis.com/Tensorboard
aiplatform.googleapis.com/TrainingPipeline
AlloyDB alloydb.googleapis.com/Backup
alloydb.googleapis.com/Cluster
alloydb.googleapis.com/Instance
API 金鑰 apikeys.googleapis.com/Key
Artifact Registry 存放區 artifactregistry.googleapis.com/Repository
BigQuery bigquery.googleapis.com/Dataset
bigquery.googleapis.com/Model
bigquery.googleapis.com/Table
bigquerydatatransfer.googleapis.com/TransferConfig
Cloud Billing 專案帳單資訊 cloudbilling.googleapis.com/ProjectBillingInfo
Cloud Run 函式 cloudfunctions.googleapis.com/CloudFunction
Cloud KMS cloudkms.googleapis.com/CryptoKey
cloudkms.googleapis.com/CryptoKeyVersion
cloudkms.googleapis.com/ImportJob
cloudkms.googleapis.com/KeyRing
Resource Manager cloudresourcemanager.googleapis.com/Folder
cloudresourcemanager.googleapis.com/Organization
cloudresourcemanager.googleapis.com/Project
cloudresourcemanager.googleapis.com/TagBinding
Managed Service for Apache Airflow 環境 composer.googleapis.com/Environment
Compute Engine compute.googleapis.com/Address
compute.googleapis.com/Autoscaler
compute.googleapis.com/BackendBucket
compute.googleapis.com/BackendService
compute.googleapis.com/Commitment
compute.googleapis.com/Disk
compute.googleapis.com/Firewall
compute.googleapis.com/FirewallPolicy
compute.googleapis.com/ForwardingRule
compute.googleapis.com/GlobalForwardingRule
compute.googleapis.com/HealthCheck
compute.googleapis.com/Image
compute.googleapis.com/Instance
compute.googleapis.com/InstanceGroup
compute.googleapis.com/InstanceGroupManagers
compute.googleapis.com/InstanceTemplate
compute.googleapis.com/InterconnectAttachment
compute.googleapis.com/MachineImage
compute.googleapis.com/Network
compute.googleapis.com/NetworkEndpointGroup
compute.googleapis.com/NodeGroup
compute.googleapis.com/NodeTemplate
compute.googleapis.com/PacketMirroring
compute.googleapis.com/Project
compute.googleapis.com/RegionBackendService
compute.googleapis.com/RegionDisk
compute.googleapis.com/Reservation
compute.googleapis.com/ResourcePolicy
compute.googleapis.com/Route
compute.googleapis.com/Router
compute.googleapis.com/SecurityPolicy
compute.googleapis.com/Snapshot
compute.googleapis.com/SslCertificate
compute.googleapis.com/SslPolicy
compute.googleapis.com/Subnetwork
compute.googleapis.com/TargetHttpProxy
compute.googleapis.com/TargetHttpsProxy
compute.googleapis.com/TargetInstance
compute.googleapis.com/TargetPool
compute.googleapis.com/TargetSslProxy
compute.googleapis.com/TargetVpnGateway
compute.googleapis.com/UrlMap
compute.googleapis.com/VpnGateway
compute.googleapis.com/VpnTunnel
Google Kubernetes Engine container.googleapis.com/Cluster
container.googleapis.com/NodePool
Dataflow dataflow.googleapis.com/Job
Cloud Data Fusion datafusion.googleapis.com/Instance
Managed Service for Apache Spark dataproc.googleapis.com/AutoscalingPolicy
dataproc.googleapis.com/Batch
dataproc.googleapis.com/Cluster
dataproc.googleapis.com/Job
Datastream datastream.googleapis.com/ConnectionProfile
datastream.googleapis.com/PrivateConnection
datastream.googleapis.com/Stream
Dialogflow CX dialogflow.googleapis.com/Agent
Sensitive Data Protection dlp.googleapis.com/DeidentifyTemplate
dlp.googleapis.com/DlpJob
dlp.googleapis.com/InspectTemplate
dlp.googleapis.com/JobTrigger
dlp.googleapis.com/StoredInfoType
Cloud DNS dns.googleapis.com/ManagedZone
dns.googleapis.com/Policy
Filestore file.googleapis.com/Instance
中樞 (又稱裝置機群) gkehub.googleapis.com/Feature
gkehub.googleapis.com/Membership
IAM iam.googleapis.com/Role
iam.googleapis.com/ServiceAccountKey
Kubernetes k8s.io/Namespace
k8s.io/Node
k8s.io/Pod
k8s.io/Service
apps.k8s.io/DaemonSet
apps.k8s.io/Deployment
apps.k8s.io/ReplicaSet
apps.k8s.io/StatefulSet
batch.k8s.io/CronJob
networking.k8s.io/Ingress
networking.k8s.io/NetworkPolicy
rbac.authorization.k8s.io/ClusterRole
rbac.authorization.k8s.io/ClusterRoleBinding
rbac.authorization.k8s.io/Role
rbac.authorization.k8s.io/RoleBinding
Cloud Logging logging.googleapis.com/LogBucket
logging.googleapis.com/LogMetric
logging.googleapis.com/LogSink
Cloud Monitoring monitoring.googleapis.com/AlertPolicy
monitoring.googleapis.com/NotificationChannel
NetApp Volumes
netapp.googleapis.com/Snapshot
netapp.googleapis.com/Volume
Gemini Enterprise Agent Platform Workbench notebooks.googleapis.com/Instance
組織政策服務 v2 orgpolicy.googleapis.com/CustomConstraint
orgpolicy.googleapis.com/Policy
憑證授權單位服務 privateca.googleapis.com/Certificate
privateca.googleapis.com/CertificateRevocationList
Pub/Sub pubsub.googleapis.com/Snapshot
pubsub.googleapis.com/Subscription
pubsub.googleapis.com/Topic
Memorystore for Redis redis.googleapis.com/Cluster
redis.googleapis.com/Instance
Cloud Run run.googleapis.com/DomainMapping
run.googleapis.com/Execution
run.googleapis.com/Job
run.googleapis.com/Revision
run.googleapis.com/Service
Secret Manager secretmanager.googleapis.com/Secret
secretmanager.googleapis.com/SecretVersion
服務使用情形 serviceusage.googleapis.com/Service
Spanner spanner.googleapis.com/Backup
spanner.googleapis.com/Database
spanner.googleapis.com/Instance
MySQL 適用的 Cloud SQL sqladmin.googleapis.com/BackupRun
sqladmin.googleapis.com/Instance
Cloud Storage storage.googleapis.com/Bucket
Google Cloud VMware Engine vmwareengine.googleapis.com/Cluster
vmwareengine.googleapis.com/ExternalAccessRule
vmwareengine.googleapis.com/ExternalAddress
vmwareengine.googleapis.com/NetworkPeering
vmwareengine.googleapis.com/NetworkPolicy
vmwareengine.googleapis.com/PrivateCloud
vmwareengine.googleapis.com/PrivateConnection
vmwareengine.googleapis.com/VmwareEngineNetwork
虛擬私有雲連接器 vpcaccess.googleapis.com/Connector
Cloud Workstations workstations.googleapis.com/Workstation
workstations.googleapis.com/WorkstationConfig

後續步驟