Class FirewallRule
- All Implemented Interfaces:
Serializable,SdkPojo,ToCopyableBuilder<FirewallRule.Builder,FirewallRule>
A single structured firewall engine rule, for use in a firewall engine rule group or as an embedded rule in a Next Generation policy. A firewall rule accepts, drops, or rejects traffic at a connection-state hook. For more information about authoring firewall engine rules, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide.
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionfinal BooleanWhether Network Firewall automatically accepts the earlier application-layer hooks that a connection must pass to reach this rule's hook.final FirewallRuleActionaction()The action that the firewall engine takes on traffic that matches the rule.final StringThe action that the firewall engine takes on traffic that matches the rule.final ActionScopeThe scope that controls how much of the matched traffic the action applies to.final StringThe scope that controls how much of the matched traffic the action applies to.final BooleanSpecifies whether the rule also generates an alert log for the traffic that it matches.static FirewallRule.Builderbuilder()final BooleanSpecifies whether an accepted connection bypasses the IPS engine.final StringdestIPs()The destination IP addresses and address ranges to inspect for, in CIDR notation.final StringThe destination ports to inspect for.final booleanfinal booleanequalsBySdkFields(Object obj) Indicates whether some other object is "equal to" this one by SDK fields.final <T> Optional<T> getValueForField(String fieldName, Class<T> clazz) final inthashCode()final booleanFor responses, this returns true if the service returned a value for the RuleOptions property.final HookKeyhook()The connection-state hook at which the firewall engine evaluates the rule.final StringThe connection-state hook at which the firewall engine evaluates the rule.final FirewallRuleProtocolprotocol()The protocol of the rule's hook.final StringThe protocol of the rule's hook.final RuleMetadataOptional metadata for the rule: whether the rule is enabled and a description.final List<RuleOption> Additional options for the rule.static Class<? extends FirewallRule.Builder> final StringThe source IP addresses and address ranges to inspect for, in CIDR notation.final StringThe source ports to inspect for.Take this object and create a builder that contains all of the current property values of this object.final StringtoString()Returns a string representation of this object.Methods inherited from interface software.amazon.awssdk.utils.builder.ToCopyableBuilder
copy
-
Method Details
-
action
The action that the firewall engine takes on traffic that matches the rule. The firewall engine supports the following actions:
-
ACCEPT- Allow the traffic. -
DROP- Block the traffic and discontinue inspection. -
REJECT- Block the traffic and send a TCP reset packet back to the client. -
REJECT_DST- Block the traffic and send a TCP reset packet to the destination. -
REJECT_BOTH- Block the traffic and send a TCP reset packet to both the client and the destination.
You combine the action with an action scope, for example
accept:flow. To send accepted traffic straight to its destination and skip the IPS engine, pair an accept action with theBypassIPSEnabledsetting. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide.If the service returns an enum value that is not available in the current SDK version,
actionwill returnFirewallRuleAction.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromactionAsString().- Returns:
- The action that the firewall engine takes on traffic that matches the rule. The firewall engine supports
the following actions:
-
ACCEPT- Allow the traffic. -
DROP- Block the traffic and discontinue inspection. -
REJECT- Block the traffic and send a TCP reset packet back to the client. -
REJECT_DST- Block the traffic and send a TCP reset packet to the destination. -
REJECT_BOTH- Block the traffic and send a TCP reset packet to both the client and the destination.
You combine the action with an action scope, for example
accept:flow. To send accepted traffic straight to its destination and skip the IPS engine, pair an accept action with theBypassIPSEnabledsetting. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide. -
- See Also:
-
-
actionAsString
The action that the firewall engine takes on traffic that matches the rule. The firewall engine supports the following actions:
-
ACCEPT- Allow the traffic. -
DROP- Block the traffic and discontinue inspection. -
REJECT- Block the traffic and send a TCP reset packet back to the client. -
REJECT_DST- Block the traffic and send a TCP reset packet to the destination. -
REJECT_BOTH- Block the traffic and send a TCP reset packet to both the client and the destination.
You combine the action with an action scope, for example
accept:flow. To send accepted traffic straight to its destination and skip the IPS engine, pair an accept action with theBypassIPSEnabledsetting. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide.If the service returns an enum value that is not available in the current SDK version,
actionwill returnFirewallRuleAction.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromactionAsString().- Returns:
- The action that the firewall engine takes on traffic that matches the rule. The firewall engine supports
the following actions:
-
ACCEPT- Allow the traffic. -
DROP- Block the traffic and discontinue inspection. -
REJECT- Block the traffic and send a TCP reset packet back to the client. -
REJECT_DST- Block the traffic and send a TCP reset packet to the destination. -
REJECT_BOTH- Block the traffic and send a TCP reset packet to both the client and the destination.
You combine the action with an action scope, for example
accept:flow. To send accepted traffic straight to its destination and skip the IPS engine, pair an accept action with theBypassIPSEnabledsetting. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide. -
- See Also:
-
-
actionScope
The scope that controls how much of the matched traffic the action applies to. The valid scopes depend on the action:
ACCEPTsupports all four scopes, andDROP,REJECT,REJECT_DST, andREJECT_BOTHsupport onlyPACKETandFLOW.-
PACKET- The current packet only. -
HOOK- The current hook only. The firewall engine evaluates the connection again at the next hook. -
TX- The current transaction. The firewall engine continues to evaluate later transactions on the connection. -
FLOW- The entire connection. For an accept action, the connection skips the firewall engine's remaining hooks and advances to the IPS engine.
In a Suricata-compatible rule string, you write the scope in lowercase, for example
accept:flow.If the service returns an enum value that is not available in the current SDK version,
actionScopewill returnActionScope.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromactionScopeAsString().- Returns:
- The scope that controls how much of the matched traffic the action applies to. The valid scopes depend on
the action:
ACCEPTsupports all four scopes, andDROP,REJECT,REJECT_DST, andREJECT_BOTHsupport onlyPACKETandFLOW.-
PACKET- The current packet only. -
HOOK- The current hook only. The firewall engine evaluates the connection again at the next hook. -
TX- The current transaction. The firewall engine continues to evaluate later transactions on the connection. -
FLOW- The entire connection. For an accept action, the connection skips the firewall engine's remaining hooks and advances to the IPS engine.
In a Suricata-compatible rule string, you write the scope in lowercase, for example
accept:flow. -
- See Also:
-
-
actionScopeAsString
The scope that controls how much of the matched traffic the action applies to. The valid scopes depend on the action:
ACCEPTsupports all four scopes, andDROP,REJECT,REJECT_DST, andREJECT_BOTHsupport onlyPACKETandFLOW.-
PACKET- The current packet only. -
HOOK- The current hook only. The firewall engine evaluates the connection again at the next hook. -
TX- The current transaction. The firewall engine continues to evaluate later transactions on the connection. -
FLOW- The entire connection. For an accept action, the connection skips the firewall engine's remaining hooks and advances to the IPS engine.
In a Suricata-compatible rule string, you write the scope in lowercase, for example
accept:flow.If the service returns an enum value that is not available in the current SDK version,
actionScopewill returnActionScope.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromactionScopeAsString().- Returns:
- The scope that controls how much of the matched traffic the action applies to. The valid scopes depend on
the action:
ACCEPTsupports all four scopes, andDROP,REJECT,REJECT_DST, andREJECT_BOTHsupport onlyPACKETandFLOW.-
PACKET- The current packet only. -
HOOK- The current hook only. The firewall engine evaluates the connection again at the next hook. -
TX- The current transaction. The firewall engine continues to evaluate later transactions on the connection. -
FLOW- The entire connection. For an accept action, the connection skips the firewall engine's remaining hooks and advances to the IPS engine.
In a Suricata-compatible rule string, you write the scope in lowercase, for example
accept:flow. -
- See Also:
-
-
hook
The connection-state hook at which the firewall engine evaluates the rule. The hook encodes both the protocol and the connection state, for example a TCP hook or a TLS
client_hellohook. For the hooks that the firewall engine supports and how they map to the connection lifecycle, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide and the Suricata firewall mode documentation.If the service returns an enum value that is not available in the current SDK version,
hookwill returnHookKey.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromhookAsString().- Returns:
- The connection-state hook at which the firewall engine evaluates the rule. The hook encodes both the
protocol and the connection state, for example a TCP hook or a TLS
client_hellohook. For the hooks that the firewall engine supports and how they map to the connection lifecycle, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide and the Suricata firewall mode documentation. - See Also:
-
hookAsString
The connection-state hook at which the firewall engine evaluates the rule. The hook encodes both the protocol and the connection state, for example a TCP hook or a TLS
client_hellohook. For the hooks that the firewall engine supports and how they map to the connection lifecycle, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide and the Suricata firewall mode documentation.If the service returns an enum value that is not available in the current SDK version,
hookwill returnHookKey.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromhookAsString().- Returns:
- The connection-state hook at which the firewall engine evaluates the rule. The hook encodes both the
protocol and the connection state, for example a TCP hook or a TLS
client_hellohook. For the hooks that the firewall engine supports and how they map to the connection lifecycle, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide and the Suricata firewall mode documentation. - See Also:
-
protocol
The protocol of the rule's hook. The protocol is derived from the hook and must match the hook's protocol prefix. Network Firewall rejects a rule whose protocol doesn't match its hook.
If the service returns an enum value that is not available in the current SDK version,
protocolwill returnFirewallRuleProtocol.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromprotocolAsString().- Returns:
- The protocol of the rule's hook. The protocol is derived from the hook and must match the hook's protocol prefix. Network Firewall rejects a rule whose protocol doesn't match its hook.
- See Also:
-
protocolAsString
The protocol of the rule's hook. The protocol is derived from the hook and must match the hook's protocol prefix. Network Firewall rejects a rule whose protocol doesn't match its hook.
If the service returns an enum value that is not available in the current SDK version,
protocolwill returnFirewallRuleProtocol.UNKNOWN_TO_SDK_VERSION. The raw value returned by the service is available fromprotocolAsString().- Returns:
- The protocol of the rule's hook. The protocol is derived from the hook and must match the hook's protocol prefix. Network Firewall rejects a rule whose protocol doesn't match its hook.
- See Also:
-
sourceIPs
The source IP addresses and address ranges to inspect for, in CIDR notation. A firewall rule always compiles to a forward-direction rule, so you express inbound compared to outbound traffic through the source and destination addresses.
- Returns:
- The source IP addresses and address ranges to inspect for, in CIDR notation. A firewall rule always compiles to a forward-direction rule, so you express inbound compared to outbound traffic through the source and destination addresses.
-
destIPs
The destination IP addresses and address ranges to inspect for, in CIDR notation. A firewall rule always compiles to a forward-direction rule, so you express inbound compared to outbound traffic through the source and destination addresses.
- Returns:
- The destination IP addresses and address ranges to inspect for, in CIDR notation. A firewall rule always compiles to a forward-direction rule, so you express inbound compared to outbound traffic through the source and destination addresses.
-
sourcePorts
The source ports to inspect for.
- Returns:
- The source ports to inspect for.
-
destPorts
The destination ports to inspect for.
- Returns:
- The destination ports to inspect for.
-
hasRuleOptions
public final boolean hasRuleOptions()For responses, this returns true if the service returned a value for the RuleOptions property. This DOES NOT check that the value is non-empty (for which, you should check theisEmpty()method on the property). This is useful because the SDK will never return a null collection or map, but you may need to differentiate between the service returning nothing (or null) and the service returning an empty collection or map. For requests, this returns true if a value for the property was specified in the request builder, and false if a value was not specified. -
ruleOptions
Additional options for the rule. These are the Suricata
RuleOptionssettings, such as the signature ID (sid) and match keywords.Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
This method will never return null. If you would like to know whether the service returned this field (so that you can differentiate between null and empty), you can use the
hasRuleOptions()method.- Returns:
- Additional options for the rule. These are the Suricata
RuleOptionssettings, such as the signature ID (sid) and match keywords.
-
acceptPriorHooks
Whether Network Firewall automatically accepts the earlier application-layer hooks that a connection must pass to reach this rule's hook. Because the firewall engine is drop by default, accepting prior hooks lets you author a single rule for the hook you care about, instead of also authoring a rule for each earlier hook. This setting accepts the earlier application-layer hooks only; it doesn't accept the TCP layer. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide.
- Returns:
- Whether Network Firewall automatically accepts the earlier application-layer hooks that a connection must pass to reach this rule's hook. Because the firewall engine is drop by default, accepting prior hooks lets you author a single rule for the hook you care about, instead of also authoring a rule for each earlier hook. This setting accepts the earlier application-layer hooks only; it doesn't accept the TCP layer. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide.
-
alertEnabled
Specifies whether the rule also generates an alert log for the traffic that it matches. Turning on alerting adds a secondary alert action to the rule, so that Network Firewall logs the match in addition to taking the rule's primary action.
- Returns:
- Specifies whether the rule also generates an alert log for the traffic that it matches. Turning on alerting adds a secondary alert action to the rule, so that Network Firewall logs the match in addition to taking the rule's primary action.
-
bypassIPSEnabled
Specifies whether an accepted connection bypasses the IPS engine. By default, traffic that the firewall engine accepts advances to the IPS engine for threat inspection. When you turn on this setting for an accept rule, the accepted traffic goes straight to its destination without IPS inspection. You can set the bypass only on accept rules, and it uses the same scope as the rule's accept action; only the
flowandpacketscopes support a bypass. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide.- Returns:
- Specifies whether an accepted connection bypasses the IPS engine. By default, traffic that the firewall
engine accepts advances to the IPS engine for threat inspection. When you turn on this setting for an
accept rule, the accepted traffic goes straight to its destination without IPS inspection. You can set
the bypass only on accept rules, and it uses the same scope as the rule's accept action; only the
flowandpacketscopes support a bypass. For more information, see Rule groups for a firewall using a Next Generation policy in the Network Firewall Developer Guide.
-
ruleMetadata
Optional metadata for the rule: whether the rule is enabled and a description. Metadata doesn't change how the rule matches or acts on traffic.
- Returns:
- Optional metadata for the rule: whether the rule is enabled and a description. Metadata doesn't change how the rule matches or acts on traffic.
-
toBuilder
Description copied from interface:ToCopyableBuilderTake this object and create a builder that contains all of the current property values of this object.- Specified by:
toBuilderin interfaceToCopyableBuilder<FirewallRule.Builder,FirewallRule> - Returns:
- a builder for type T
-
builder
-
serializableBuilderClass
-
hashCode
-
equals
-
equalsBySdkFields
Description copied from interface:SdkPojoIndicates whether some other object is "equal to" this one by SDK fields. An SDK field is a modeled, non-inherited field in anSdkPojoclass, and is generated based on a service model.If an
SdkPojoclass does not have any inherited fields,equalsBySdkFieldsandequalsare essentially the same.- Specified by:
equalsBySdkFieldsin interfaceSdkPojo- Parameters:
obj- the object to be compared with- Returns:
- true if the other object equals to this object by sdk fields, false otherwise.
-
toString
-
getValueForField
-
sdkFields
-
sdkFieldNameToField
- Specified by:
sdkFieldNameToFieldin interfaceSdkPojo- Returns:
- The mapping between the field name and its corresponding field.
-