VPC Service Controls (VPC-SC) is an organization level security control in Google Cloud that enables enterprise customers to mitigate data exfiltration risks. VPC Service Controls delivers zero-trust style access to multi-tenant services by enabling clients to restrict access to authorized IPs, client context, and device parameters while connecting to multi-tenant services from the internet and other services in order to reduce both intentional and unintentional losses. You can use VPC Service Controls to create perimeters that protect the resources and data of services that you explicitly specify.
The goals of this tutorial are:
For this tutorial, we need the following pre-requirements:
(If you don't already have a Google Workspace/Cloud Identity account, you must acquire one as you will need to have an Organization for this tutorial).
You can grant yourself Owner, Folder Admin and Project Creator predefined roles at Organization level and you will have the required roles to set up the resources needed for this tutorial.
NOTE: Granting these roles violates the principle of least privilege. These roles can be used for the Codelab purpose but are not recommended to be used in production setup.
You need to enable billing in the Cloud Console to use Cloud resources/APIs. Running through this codelab won't cost much, if anything at all. To shut down resources to avoid incurring billing beyond this tutorial, you can delete the resources you created or delete the project. New Google Cloud users are eligible for the $300 USD Free Trial program.
The only resource that will generate a cost is the VM Instance. An estimated cost can be found in the pricing calculator.
3. Create a PerimeterIn this laboratory we are going to perform the following steps:
The perimeter setup should look like this:
4. Verify that the perimeter has been enforcedFirst we have to identify what exactly is the problem here to determine how to troubleshoot it.
resource.type="audited_resource" protoPayload.metadata."@type"="type.googleapis.com/google.cloud.audit.VpcServiceControlAuditMetadata"
This will show all VPC Service Controls audit logs. We will be looking for the last error log.
You can use this sample queries to filter more granularly by adding the VPC Service Control unique ID we got while verifying the perimeter was enforced.
This API will show us in a friendly UI the violation reason, and if this was an ingress or egress violation among other useful things.
For this exercise we will be looking for the following:
"principalEmail": "user@domain" "callerIp": "PUBLIC_IP_ADDRESS" "serviceName": "compute.googleapis.com" "servicePerimeterName": "accessPolicies/[POLICY_NUMBER]/servicePerimeters/SuperProtection "ingressViolations": [ { "targetResource": "projects/[PROJECT_NUMBER]", "servicePerimeter": "accessPolicies/[POLICY_NUMBER]/servicePerimeters/SuperProtection" } ], "violationReason": "NO_MATCHING_ACCESS_LEVEL", "resourceNames": "[PROJECT_ID]"
" NO_MATCHING_ACCESS_LEVEL" violation happens when the IP address, device requirement, or user identity doesn't match any ingress rules or access levels assigned to the perimeter. If the caller IP address is missing or appears as an internal IP address, then this violation might be due to a Google Cloud service that is not integrated with VPC Service Controls. Save this page to learn more about VPC Service Controls common issues.
We have two options to fix this denial in ProjectZ.
In this tutorial we will troubleshoot by creating an Access Level.
In the following lab, we used the system public IP address and its location. You need to change these values accordingly. You can check your system IP address in whatismyip.com
Confirm we have access to Compute Engine and are able to create a VM instance. Now that we have created the Access Level, let's try to access the Compute Engine in ProjectZ and create a VM instance.
After about a minute, you should see the VM instance created and you can verify that you have full access to the Compute Engine protected inside the perimeter.
7. CleanupWhile there is no separate charge for using VPC Service Controls when the service is not in use, it's a best practice to clean up the setup used in this laboratory. You can also delete your VM instance and/or Cloud projects to avoid incurring charges. Deleting your Cloud project stops billing for all the resources used within that project.
These resources will be used in the next laboratory. You can delete them now and recreate them later, or you can skip the cleanup section and continue with the next lab.
In this codelab you created a VPC Service Controls perimeter, enforced it, and troubleshooted it.
Learn moreThis work is licensed under a Creative Commons Attribution 2.0 Generic License.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],[],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4