This document describes how to add ingress rules to allow Event Threat Detection to monitor logging streams in Security Command Center within VPC Service Controls perimeters. Perform this task if your organization uses VPC Service Controls to restrict services in projects that you want Event Threat Detection to monitor. For more information about Event Threat Detection, see Event Threat Detection overview.
Before you begin
Make sure that you have the following role or roles on the organization:
Cloud Asset Service Agent
(roles/cloudasset.serviceAgent
).
Check for the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the organization.
-
In the Principal column, find all rows that identify you or a group that you're included in. To learn which groups you're included in, contact your administrator.
- For all rows that specify or include you, check the Role column to see whether the list of roles includes the required roles.
Grant the roles
-
In the Google Cloud console, go to the IAM page.
Go to IAM - Select the organization.
- Click Grant access.
-
In the New principals field, enter your user identifier. This is typically the email address for a Google Account.
- In the Select a role list, select a role.
- To grant additional roles, click Add another role and add each additional role.
- Click Save.
Create the ingress rules
To allow Event Threat Detection to monitor logging streams in Security Command Center within VPC Service Controls perimeters, add the required ingress rules in those perimeters. Perform these steps for each perimeter that you want Event Threat Detection to monitor.
For more information, see Updating ingress and egress policies for a service perimeter in the VPC Service Controls documentation.
Console
-
In the Google Cloud console go to the VPC Service Controls page.
- Select your organization or project.
- If you selected an organization, click Select an access policy and then select the access policy associated with the perimeter that you want to update.
-
Click the name of the perimeter that you want to update.
To find the service perimeter you need to modify, you can check your logs for entries that show
RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER
violations. In those entries, check theservicePerimeterName
field:accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME
- Click Edit perimeter.
- Click Ingress policy.
- Click Add an ingress rule.
-
In the FROM section, set the following details:
- For Identity, select Select identities & groups.
- Click Add identities
-
Enter the email address of the Security Center service agent. The service agent's address has the following format:
service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com
Replace
ORGANIZATION_ID
with your organization ID. - Select the service agent or press ENTER, and then click Add identities.
- For Sources, select All sources
-
In the TO section, set the following details:
- For Project, select All projects.
- For Operations or IAM roles, select Select operations.
-
Click Add operations, and then add the following operations:
- Add the cloudasset.googleapis.com service.
- Click All methods.
- Click Add all methods.
- Add the cloudasset.googleapis.com service.
- Click Save.
gcloud
-
If a quota project isn't already set, then set it. Choose a project that has the Access Context Manager API enabled.
gcloud config set billing/quota_project QUOTA_PROJECT_ID
Replace
QUOTA_PROJECT_ID
with the ID of the project that you want to use for billing and quota. -
Create a file named
ingress-rule.yaml
with the following contents:- ingressFrom: identities: - serviceAccount:service-org-ORGANIZATION_ID@security-center-api.iam.gserviceaccount.com sources: - accessLevel: '*' ingressTo: operations: - serviceName: cloudasset.googleapis.com methodSelectors: - method: '*' resources: - '*'
Replace
ORGANIZATION_ID
with your organization ID. -
Add the ingress rule to the perimeter:
gcloud access-context-manager perimeters update PERIMETER_NAME \ --set-ingress-policies=ingress-rule.yaml
Replace the following:
-
PERIMETER_NAME
: the name of the perimeter. For example,accessPolicies/1234567890/servicePerimeters/example_perimeter
.To find the service perimeter you need to modify, you can check your logs for entries that show
RESOURCES_NOT_IN_SAME_SERVICE_PERIMETER
violations. In those entries, check theservicePerimeterName
field:accessPolicies/ACCESS_POLICY_ID/servicePerimeters/SERVICE_PERIMETER_NAME
-
See Ingress and egress rules for more information.
What's next
- Learn how to use Event Threat Detection.