Firewall policy rule components (original) (raw)

This page describes the components of firewall rules that you create in one of the following firewall policiesthat apply to a regular Virtual Private Cloud (VPC) network:

For details about firewall rules and Remote Direct Memory Access (RDMA) network profiles, seeCloud NGFW for RoCE VPC networks.

Each firewall policy rule applies to incoming (ingress) or outgoing (egress) connections, not both. When you create a firewall policy rule, you specify the components that define what the rule does. In addition to the direction, you can specify source, destination, and Layer 4 characteristics such as protocol and destination port (if the protocol uses ports).

Priority

The priority of a rule in a firewall policy is an integer from 0 to 2,147,483,547, inclusive. Lower integers indicate higher priorities. The priority of a rule in a firewall policy is similar to thepriority of a VPC firewall rule, with the following differences:

Action on match

A rule in a firewall policy can have one of the following actions:

Action parameter Description
allow Allows packets for a new connection. Stops evaluating rules in the firewall policy that contains the matching rule. Doesn't evaluate any other firewall rules. Regardless of the direction of the rule, if the packet protocol and firewall policy type support connection tracking, an allow rule creates a firewall connection tracking table entry that permits both ingress and egress packets.
deny Disallows packets for a new connection. Stops evaluating rules in the firewall policy that contains the matching rule. Doesn't evaluate any other firewall rules. Cloud NGFW always checks for a firewall connection tracking table entry before it evaluates firewall rules. Consequently, if an allow rule created a connection tracking table entry, that connection tracking table entry takes precedence.
apply_security_profile_group Intercepts packets for a new connection, sending them to afirewall endpoint or intercept endpoint group. Stops evaluating rules in the firewall policy that contains the matching rule. Doesn't evaluate any other firewall rules. Regardless of the direction of the rule, if the packet protocol and firewall policy type support connection tracking, a rule with theapply_security_profile_group action creates a firewall connection tracking table entry so that both ingress and egress packets are intercepted by the firewall endpoint or intercept endpoint group. You can't create rules with theapply_security_profile_group action in regional network firewall policies. Regional system firewall policies don't support rules with this action.
goto_next Stops evaluating other rules in the firewall policy, and evaluates rules in the next step of the firewall policy and rule evaluation order. The next step of the firewall policy and rule evaluation order might be evaluation of rules in another firewall policy or the implied firewall rules.

Enforcement

You can choose whether a firewall policy rule is enforced by setting its state to enabled or disabled. You set the enforcement state when you create a rule or when you update a rule.

If you don't set an enforcement state when you create a new firewall rule, the firewall rule is automatically enabled.

Protocols and ports

Similar to VPC firewall rules, you must specify one or more protocol and port constraints when you create a rule. When specifying TCP or UDP in a rule, you can specify the protocol, the protocol and a destination port, or the protocol and a destination port range; you cannot specify only a port or port range. Also, you can only specify destination ports. Rules based on source ports aren't supported.

You can use the following protocol names in firewall rules: tcp, udp, icmp(for IPv4 ICMP), esp, ah, sctp, and ipip. For all other protocols, use the IANA protocol numbers.

Many protocols use the same name and number in both IPv4 and IPv6, but some protocols, such as ICMP, don't. To specify IPv4 ICMP, use icmp or protocol number 1. To specify IPv6 ICMP, use protocol number 58.

Firewall rules don't support specifying ICMP types and codes, just the protocol.

The IPv6 Hop-by-Hop protocol isn't supported in firewall rules.

If you don't specify protocol and port parameters, the rule applies to all protocols and destination ports.

Logging

Logging for firewall policy rules works the same as for VPCVPC firewall rules loggingexcept for the following:

Target, source, destination

Target, source, and destination parameters work together to determine the scope of a firewall rule.

Targets

The target type parameter and one or more target parameters define the targets of a firewall rule. These targets of a firewall rule are the resources that the firewall rule protects.

Broadest instance targets

The broadest instance targets depend on the firewall policy type:

Broadest load balancer targets

Regional network firewall policies are the only policies whose rules support load balancer targets. The broadest load balancer targets are the forwarding rules for internal Application Load Balancers and internal proxy Network Load Balancers in the policy's region and associated VPC network.

Specific targets

The following table lists the target parameters, the firewall policies that support rules with each parameter, and the supported rule target types. If you don't specify a target parameter, the rule uses either the broadest instance targets or broadest load balancer targets, based on the rule's target type. Thecheckmark indicates that the parameter is supported, and the symbol indicates that the parameter isn't supported.

Target parameter Firewall policy support Rule target type support
Hierarchical Global network Regional network INSTANCES INTERNAL_MANAGED_LB
Target VPC network resources A list of one or more VPC networks specified by using the target-resources parameter. This list narrows the broadest instance targets to the VM network interfaces that are in at least one of the specified VPC networks.
Target service accounts A list of one or more service accounts specified by using thetarget-service-accounts parameter. This list narrows the broadest instance targets to the VM network interfaces that belong to VM instances associated with at least one of the specified service accounts.
Target secure tag values from a tag key with network purpose data A rule that uses the target-secure-tags parameter containing a list of one or more tag values from a tag key whosepurpose-data specifies a single VPC network. This list narrows the broadest instance targets to the VM network interfaces that each meet both of the following criteria: The interface is in the VPC network that matches the purpose-data of the tag key. The interface belongs to a VM that's bound to the tag value. For more information, seeSecure tags for firewalls.
Target secure tag values from a tag key with organization purpose data A rule that uses the target-secure-tags parameter containing a list of one or more tag values from a tag key whosepurpose-data is organization=auto. This list narrows the broadest instance targets to the VM network interfaces that each meet both of the following criteria: The interface is in any VPC network of the organization. The interface belongs to a VM that's bound to the tag value. For more information, seeSecure tags for firewalls.
Target forwarding rules Preview A single forwarding rule for an internal Application Load Balancer or internal proxy Network Load Balancer specified in thetarget forwarding rules format. This parameter narrows the broadest load balancer targets to a specific internal Application Load Balancer or internal proxy Network Load Balancer.

Specific target combinations

Rules that support the target-resources parameter can combine it with another target parameter to create a target parameter combination. The following table lists supported target parameter combinations, the firewall policies that support rules with each parameter, and the supported rule target types. If you don't specify a target parameter, the rule uses either thebroadest instance targets orbroadest load balancer targets, based on the rule's target type.

The checkmark indicates that the parameter is supported, and the symbol indicates that the parameter isn't supported.

Target parameter combination Firewall policy support Rule target type support
Hierarchical Global network Regional network INSTANCES INTERNAL_MANAGED_LB
Combination of target VPC network resources and target service accounts A rule that uses both the target-resources andtarget-service-accounts parameters. This combination narrows the broadest instance targets to VM network interfaces that each meet both of the following criteria: The interface is in at least one of the VPC networks specified in target-resources. The interface belongs to a VM instance that's associated with at least one of the specified service accounts.
Combination of target VPC network resources and target secure tag values A rule that uses both the target-resources andtarget-secure-tags parameters. Tag values must come from a tag key whose purpose-data isorganization=auto. This combination narrows the broadest instance targets to VM network interfaces that each meet both of the following criteria: The interface is in at least one of the VPC networks specified in target-resources. The interface belongs to a VM that's bound to the tag value.

Target forwarding rules format

When a firewall rule's target type is set to INTERNAL_MANAGED_LB(Preview), the target forwarding rules parameter accepts values in the following formats:

Targets and IP addresses for ingress rules

When a firewall rule target type is either omitted or set to INSTANCES, the rule applies to packets that are routed to network interfaces of target VMs.

When a firewall rule's target type is set to INTERNAL_MANAGED_LB(Preview), the rule filters packets routed to the managed Envoy proxies associated with internal Application Load Balancers and internal proxy Network Load Balancers. When using destination IP ranges in an ingress rule, make sure that the range includes the relevant load balancer forwarding rule IP address.

Targets and IP addresses for egress rules

When a firewall rule target type is either omitted or set to INSTANCES, the rule applies to packets that are emitted by network interfaces of target VMs.

Sources

Source parameter values depend on the direction of the firewall rule.

Sources for ingress rules

This table lists the source parameters for ingress rules, the firewall policies that support each parameter, and the rule target types that are compatible with each parameter. You must specify at least one source parameter. Thecheckmark indicates that the parameter is supported, and the symbol indicates that the parameter isn't supported.

Ingress rule source parameter Firewall policy support Rule target type support
Hierarchical Global network Regional network INSTANCES INTERNAL_MANAGED_LB
Source IP address ranges A list consisting of IPv4 addresses in CIDR format or IPv6 addresses in CIDR format. The list is stored within the firewall policy rule itself.
Source address groups Reusable collections of IPv4 addresses in CIDR format or IPv6 addresses in CIDR format. The firewall rule references the collection. For more information, seeAddress groups for firewall policies.
Source domain names A list of one or more source domain names. For more information, including how domain names are converted to IP addresses, seeFQDN objects.
Source secure tag values from a tag key with network purpose data A list of one or more tag values from a tag key whose purpose data specifies a single VPC network. For more information, see Secure tags for firewalls and How source secure tags imply packet sources.
Source secure tag values from a tag key with organization purpose data A list of one or more tag values from a tag key whose purpose data is organization=auto. For more information, see Secure tags for firewalls and How source secure tags imply packet sources.
Source geolocations A list of one or more source geographic locations specified as two-letter country or region codes. For more information, seeGeolocation objects
Source Google Threat Intelligence lists A list of one or more predefined Google Threat Intelligence list names. For more information, seeGoogle Threat Intelligence for firewall policy rules.
Source network context A constraint that defines a security boundary. Valid values depend on the target type of the rule. For more information, seeNetwork contexts.
Ingress rule source combinations

In a single ingress rule, you can use two or more source parameters to produce a source combination. Cloud NGFW enforces the following constraints on source combinations of each ingress rule:

Cloud NGFW applies the following logic to match the packets to an ingress rule that uses a source combination:

How source secure tags imply packet sources

An ingress firewall rule can use source secure tag values when its target type is omitted or set to INSTANCES. Secure tag values identify network interfaces, not packet characteristics like IP addresses.

Packets sent from a network interface of a VM instance match an ingress rule that uses a source secure tag value according to the following rules:

For more information about secure tags for firewalls, seeSpecifications.

Sources for egress rules

You can use the following sources for egress rules in both hierarchical firewall policies and network firewall policies:

Follow these guidelines to add source IP address ranges for egress rules:

Destinations

Destination parameter values depend on the direction of the firewall rule.

Destinations for ingress rules

You can use the following destinations for ingress firewall rules in both hierarchical and network firewall policies:

Follow these guidelines to add destination IP address ranges for ingress rules:

Destinations for egress rules

This table lists the destination parameters for egress rules, the firewall policies that support each parameter, and the rule target types that are compatible with each parameter. You must specify at least one destination parameter. The checkmark indicates that the parameter is supported, and the symbol indicates that the parameter isn't supported.

Egress rule destination parameter Firewall policy support Rule target type support
Hierarchical Global network Regional network INSTANCES INTERNAL_MANAGED_LB
Destination IP address ranges A list consisting of IPv4 addresses in CIDR format or IPv6 addresses in CIDR format. The list is stored within the firewall policy rule itself.
Destination address groups Reusable collections of IPv4 addresses in CIDR format or IPv6 addresses in CIDR format. The firewall policy rule references the collection. For more information, seeAddress groups for firewall policies.
Destination domain names A list of one or more destination domain names. For more information, including how domain names are converted to IP addresses, seeFQDN objects.
Destination geolocations A list of one or more source geographic locations specified as two-letter country or region codes. For more information, seeGeolocation objects.
Destination Google Threat Intelligence lists A list of one or more predefined Google Threat Intelligence list names. For more information, seeGoogle Threat Intelligence for firewall policy rules.
Destination network context A constraint that defines a security boundary.
Egress rule destination combinations

In a single egress rule, you can use two or more destination parameters to produce a destination combination. Cloud NGFW enforces the following constraints on destination combinations of each egress rule:

Cloud NGFW applies the following logic to match the packets to an egress rule that uses a destination combination:

What's next