To inspect consumers' network traffic, you use firewall policies to redirect the traffic to the VPC's intercept endpoint group. The traffic then goes through the producer's intercept deployment group to their compute resources.
This page describes how to configure and manage global network firewall policies and rules. If you want to create hierarchical firewall policies and rules, see Use hierarchical firewall policies and rules.
Before you begin
Enable the Compute Engine API in your Google Cloud project.
Enable the Network Security API in your Google Cloud project.
Install the gcloud CLI.
Create a security profile group.
Roles
To create, view, or delete firewall rules, ask your administrator to grant you the necessary Identity and Access Management (IAM) roles on your project. For more information about granting roles, see Manage access to projects, folders, and organizations.
To check the progress of the operations listed on this page, make sure that your
user role has the following project-level Compute Security
Admin
(roles/compute.securityAdmin), Compute Network
Admin
(roles/compute.networkAdmin), and Compute
Viewer (roles/compute.viewer)
roles:
compute.networks.getcompute.networks.listcompute.firewallPolicies.createcompute.firewallPolicies.updatecompute.firewallPolicies.removeAssociation
Create firewall policies and rules
You create a firewall policy and a rule with the APPLY_SECURITY_PROFILE_GROUP
action.
Console
To create a network firewall policy, follow these steps:
In the Google Cloud console, go to the Firewall policies page.
In the project selector list, select your project within your organization.
Click Create firewall policy.
In the Name field, enter a name for the policy.
For Deployment scope, select Global.
To create rules for your policy, click Continue, and then click Add rule.
- In the Priority field, set the order number for the rule, where
0is the highest priority. - For Direction of traffic, choose Ingress.
- For Action on match, choose Proceed to L7 inspection.
- For Purpose, choose NSI in-band.
- For Security profile group, select the custom intercept security profile group.
- For Target type, specify the target of the rule.
- For Source filters, specify the source filter.
- For Destinations, specify the destination filters.
- For Protocols and ports, either specify that the rule applies to all protocols and all destination ports or specify to which protocols and destination ports the rule applies.
- Click Create.
- In the Priority field, set the order number for the rule, where
Click Add rule to add another rule.
If you want to associate the policy with a network, click Continue, and then click Associate policy with VPC networks.
Click Create.
For more information, see Create global network firewall rules.
gcloud
To create a network firewall policy, use the
gcloud compute firewall-policies create
command:
gcloud compute network-firewall-policies create FIREWALL_POLICY
To create a firewall rule, use the
gcloud compute network-firewall-policies rules create
command:
gcloud compute network-firewall-policies rules create PRIORITY \
--action APPLY_SECURITY_PROFILE_GROUP \
--firewall-policy FIREWALL_POLICY \
--security-profile-group organizations/ORGANIZATION_ID/locations/global/securityProfileGroups/SECURITY_PROFILE_GROUP_ID \
--direction DIRECTION \
--layer4-configs LAYER4_CONIFG \
--src-ip-ranges SRC_IP_RANGE \
[--dest-ip-ranges DEST_IP_RANGE] \
--global-firewall-policy
Replace the following:
PRIORITY: the priority of the rule to add.FIREWALL_POLICY: the firewall policy ID with which to create a rule.ORGANIZATION_ID: the ID of the organization where the security profile group is created.SECURITY_PROFILE_GROUP_ID: the ID of the security profile group that has acustom-intercept-profileaction.DIRECTION: indicates whether the rule is aningressoregressrule. If the direction is not specified, it defaults to applying the rule on incoming traffic. For incoming traffic, you cannot specify destination ranges. For outbound traffic, you cannot specify source ranges or source tags.LAYER4_CONFIG: a list of destination protocols and ports to which the firewall rule applies.SRC_IP_RANGE: the source IP ranges. This is only specified ifDIRECTIONisingress.DEST_IP_RANGE: the destination IP ranges. This is only specified ifDIRECTIONisegress.
Terraform
To create a firewall policy, you can use a google_compute_firewall_policy resource.
To create a firewall policy rule, you can use a google_compute_network_firewall_policy_rule resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
Describe firewall policies and rules
You can see all the details of a policy, including all its firewall rules.
Console
In the Google Cloud console, go to the Firewall policies page.
From the project picker, select your project that contains the global network firewall policy.
Click your policy.
To see the details of a rule, click the priority of the rule.
gcloud
To describe a firewall policy, use the
gcloud compute network-firewall-policies describe
command:
gcloud compute network-firewall-policies describe FIREWALL_POLICY
To describe a firewall rule, use the
gcloud compute network-firewall-policies rules describe
command:
gcloud compute network-firewall-policies rules describe PRIORITY \
--firewall-policy FIREWALL_POLICY
Replace FIREWALL_POLICY with the firewall policy ID with
where the rule is defined.
Delete firewall policies and rules
You can delete a policy and its firewall rules. You must delete all associations on an organization firewall policy before you can delete it.
Console
In the Google Cloud console, go to the Firewall policies page.
From the project picker, select your project that contains the policy.
Click your policy.
Select the rule that you want to delete.
Click Delete.
Click the Associations tab.
Select the association that you want to delete.
Click Remove Associations.
After all associations are removed, click Delete.
gcloud
To delete a firewall rule, use the
gcloud compute network-firewall-policies rules delete
command:
gcloud compute network-firewall-policies rules delete PRIORITY \
--firewall-policy FIREWALL_POLICY
Replace FIREWALL_POLICY with the firewall policy ID with
where the rule is defined.
To delete a firewall policy, use the
gcloud compute network-firewall-policies delete
command:
gcloud compute network-firewall-policies delete FIREWALL_POLICY