CfnRuleGroup
- class aws_cdk.aws_networkfirewall.CfnRuleGroup(scope, id, *, capacity, rule_group_name, type, description=None, rule_group=None, tags=None)
Bases:
CfnResource
Use the
RuleGroup
to define a reusable collection of stateless or stateful network traffic filtering rules.You use rule groups in an
FirewallPolicy
to specify the filtering behavior of anFirewall
.- See:
- CloudformationResource:
AWS::NetworkFirewall::RuleGroup
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall cfn_rule_group = networkfirewall.CfnRuleGroup(self, "MyCfnRuleGroup", capacity=123, rule_group_name="ruleGroupName", type="type", # the properties below are optional description="description", rule_group=networkfirewall.CfnRuleGroup.RuleGroupProperty( rules_source=networkfirewall.CfnRuleGroup.RulesSourceProperty( rules_source_list=networkfirewall.CfnRuleGroup.RulesSourceListProperty( generated_rules_type="generatedRulesType", targets=["targets"], target_types=["targetTypes"] ), rules_string="rulesString", stateful_rules=[networkfirewall.CfnRuleGroup.StatefulRuleProperty( action="action", header=networkfirewall.CfnRuleGroup.HeaderProperty( destination="destination", destination_port="destinationPort", direction="direction", protocol="protocol", source="source", source_port="sourcePort" ), rule_options=[networkfirewall.CfnRuleGroup.RuleOptionProperty( keyword="keyword", # the properties below are optional settings=["settings"] )] )], stateless_rules_and_custom_actions=networkfirewall.CfnRuleGroup.StatelessRulesAndCustomActionsProperty( stateless_rules=[networkfirewall.CfnRuleGroup.StatelessRuleProperty( priority=123, rule_definition=networkfirewall.CfnRuleGroup.RuleDefinitionProperty( actions=["actions"], match_attributes=networkfirewall.CfnRuleGroup.MatchAttributesProperty( destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], destinations=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], protocols=[123], source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], sources=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )] ) ) )], # the properties below are optional custom_actions=[networkfirewall.CfnRuleGroup.CustomActionProperty( action_definition=networkfirewall.CfnRuleGroup.ActionDefinitionProperty( publish_metric_action=networkfirewall.CfnRuleGroup.PublishMetricActionProperty( dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )] ) ), action_name="actionName" )] ) ), # the properties below are optional reference_sets=networkfirewall.CfnRuleGroup.ReferenceSetsProperty( ip_set_references={ "ip_set_references_key": { "reference_arn": "referenceArn" } } ), rule_variables=networkfirewall.CfnRuleGroup.RuleVariablesProperty( ip_sets={ "ip_sets_key": { "definition": ["definition"] } }, port_sets={ "port_sets_key": networkfirewall.CfnRuleGroup.PortSetProperty( definition=["definition"] ) } ), stateful_rule_options=networkfirewall.CfnRuleGroup.StatefulRuleOptionsProperty( rule_order="ruleOrder" ) ), tags=[CfnTag( key="key", value="value" )] )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).capacity (
Union
[int
,float
]) – The maximum operating resources that this rule group can use. You can’t change a rule group’s capacity setting after you create the rule group. When you update a rule group, you are limited to this capacity. When you reference a rule group from a firewall policy, Network Firewall reserves this capacity for the rule group.rule_group_name (
str
) – The descriptive name of the rule group. You can’t change the name of a rule group after you create it.type (
str
) – Indicates whether the rule group is stateless or stateful. If the rule group is stateless, it contains stateless rules. If it is stateful, it contains stateful rules.description (
Optional
[str
]) – A description of the rule group.rule_group (
Union
[IResolvable
,RuleGroupProperty
,Dict
[str
,Any
],None
]) – An object that defines the rule group rules.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – An array of key-value pairs to apply to this resource. For more information, see Tag .
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_dependency(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::NetworkFirewall::RuleGroup'
- attr_rule_group_arn
The Amazon Resource Name (ARN) of the
RuleGroup
.- CloudformationAttribute:
RuleGroupArn
- attr_rule_group_id
The unique ID of the
RuleGroup
resource.- CloudformationAttribute:
RuleGroupId
- capacity
The maximum operating resources that this rule group can use.
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- description
A description of the rule group.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The tree node.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- rule_group
An object that defines the rule group rules.
- rule_group_name
The descriptive name of the rule group.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- tags
Tag Manager which manages the tags for this resource.
- tags_raw
An array of key-value pairs to apply to this resource.
- type
Indicates whether the rule group is stateless or stateful.
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
ActionDefinitionProperty
- class CfnRuleGroup.ActionDefinitionProperty(*, publish_metric_action=None)
Bases:
object
A custom action to use in stateless rule actions settings.
- Parameters:
publish_metric_action (
Union
[IResolvable
,PublishMetricActionProperty
,Dict
[str
,Any
],None
]) – Stateless inspection criteria that publishes the specified metrics to Amazon CloudWatch for the matching packet. This setting defines a CloudWatch dimension value to be published. You can pair this custom action with any of the standard stateless rule actions. For example, you could pair this in a rule action with the standard action that forwards the packet for stateful inspection. Then, when a packet matches the rule, Network Firewall publishes metrics for the packet and forwards it.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall action_definition_property = networkfirewall.CfnRuleGroup.ActionDefinitionProperty( publish_metric_action=networkfirewall.CfnRuleGroup.PublishMetricActionProperty( dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )] ) )
Attributes
- publish_metric_action
Stateless inspection criteria that publishes the specified metrics to Amazon CloudWatch for the matching packet.
This setting defines a CloudWatch dimension value to be published.
You can pair this custom action with any of the standard stateless rule actions. For example, you could pair this in a rule action with the standard action that forwards the packet for stateful inspection. Then, when a packet matches the rule, Network Firewall publishes metrics for the packet and forwards it.
AddressProperty
- class CfnRuleGroup.AddressProperty(*, address_definition)
Bases:
object
A single IP address specification.
This is used in the
RuleGroup.MatchAttributes
source and destination specifications.- Parameters:
address_definition (
str
) – Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4 and IPv6. Examples: - To configure Network Firewall to inspect for the IP address 192.0.2.44, specify192.0.2.44/32
. - To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify192.0.2.0/24
. - To configure Network Firewall to inspect for the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify1111:0000:0000:0000:0000:0000:0000:0111/128
. - To configure Network Firewall to inspect for IP addresses from 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify1111:0000:0000:0000:0000:0000:0000:0000/64
. For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall address_property = networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )
Attributes
- address_definition
Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation.
Network Firewall supports all address ranges for IPv4 and IPv6.
Examples:
To configure Network Firewall to inspect for the IP address 192.0.2.44, specify
192.0.2.44/32
.To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify
192.0.2.0/24
.To configure Network Firewall to inspect for the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify
1111:0000:0000:0000:0000:0000:0000:0111/128
.To configure Network Firewall to inspect for IP addresses from 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify
1111:0000:0000:0000:0000:0000:0000:0000/64
.
For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
CustomActionProperty
- class CfnRuleGroup.CustomActionProperty(*, action_definition, action_name)
Bases:
object
An optional, non-standard action to use for stateless packet handling.
You can define this in addition to the standard action that you must specify.
You define and name the custom actions that you want to be able to use, and then you reference them by name in your actions settings.
You can use custom actions in the following places:
In an
RuleGroup.StatelessRulesAndCustomActions
. The custom actions are available for use by name inside theStatelessRulesAndCustomActions
where you define them. You can use them for your stateless rule actions to specify what to do with a packet that matches the rule’s match attributes.In an
FirewallPolicy
specification, inStatelessCustomActions
. The custom actions are available for use inside the policy where you define them. You can use them for the policy’s default stateless actions settings to specify what to do with packets that don’t match any of the policy’s stateless rules.
- Parameters:
action_definition (
Union
[IResolvable
,ActionDefinitionProperty
,Dict
[str
,Any
]]) – The custom action associated with the action name.action_name (
str
) – The descriptive name of the custom action. You can’t change the name of a custom action after you create it.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall custom_action_property = networkfirewall.CfnRuleGroup.CustomActionProperty( action_definition=networkfirewall.CfnRuleGroup.ActionDefinitionProperty( publish_metric_action=networkfirewall.CfnRuleGroup.PublishMetricActionProperty( dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )] ) ), action_name="actionName" )
Attributes
- action_definition
The custom action associated with the action name.
- action_name
The descriptive name of the custom action.
You can’t change the name of a custom action after you create it.
DimensionProperty
- class CfnRuleGroup.DimensionProperty(*, value)
Bases:
object
The value to use in an Amazon CloudWatch custom metric dimension.
This is used in the
PublishMetrics
custom action. A CloudWatch custom metric dimension is a name/value pair that’s part of the identity of a metric.AWS Network Firewall sets the dimension name to
CustomAction
and you provide the dimension value.For more information about CloudWatch custom metric dimensions, see Publishing Custom Metrics in the Amazon CloudWatch User Guide .
- Parameters:
value (
str
) – The value to use in the custom metric dimension.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall dimension_property = networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )
Attributes
- value
The value to use in the custom metric dimension.
HeaderProperty
- class CfnRuleGroup.HeaderProperty(*, destination, destination_port, direction, protocol, source, source_port)
Bases:
object
The 5-tuple criteria for AWS Network Firewall to use to inspect packet headers in stateful traffic flow inspection.
Traffic flows that match the criteria are a match for the corresponding stateful rule.
- Parameters:
destination (
str
) –The destination IP address or address range to inspect for, in CIDR notation. To match with any address, specify
ANY
. Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4 and IPv6. Examples: - To configure Network Firewall to inspect for the IP address 192.0.2.44, specify192.0.2.44/32
. - To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify192.0.2.0/24
. - To configure Network Firewall to inspect for the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify1111:0000:0000:0000:0000:0000:0000:0111/128
. - To configure Network Firewall to inspect for IP addresses from 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify1111:0000:0000:0000:0000:0000:0000:0000/64
. For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .destination_port (
str
) – The destination port to inspect for. You can specify an individual port, for example1994
and you can specify a port range, for example1990:1994
. To match with any port, specifyANY
.direction (
str
) – The direction of traffic flow to inspect. If set toANY
, the inspection matches bidirectional traffic, both from the source to the destination and from the destination to the source. If set toFORWARD
, the inspection only matches traffic going from the source to the destination.protocol (
str
) – The protocol to inspect for. To specify all, you can useIP
, because all traffic on AWS and on the internet is IP.source (
str
) –The source IP address or address range to inspect for, in CIDR notation. To match with any address, specify
ANY
. Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4 and IPv6. Examples: - To configure Network Firewall to inspect for the IP address 192.0.2.44, specify192.0.2.44/32
. - To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify192.0.2.0/24
. - To configure Network Firewall to inspect for the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify1111:0000:0000:0000:0000:0000:0000:0111/128
. - To configure Network Firewall to inspect for IP addresses from 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify1111:0000:0000:0000:0000:0000:0000:0000/64
. For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .source_port (
str
) – The source port to inspect for. You can specify an individual port, for example1994
and you can specify a port range, for example1990:1994
. To match with any port, specifyANY
.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall header_property = networkfirewall.CfnRuleGroup.HeaderProperty( destination="destination", destination_port="destinationPort", direction="direction", protocol="protocol", source="source", source_port="sourcePort" )
Attributes
- destination
The destination IP address or address range to inspect for, in CIDR notation.
To match with any address, specify
ANY
.Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4 and IPv6.
Examples:
To configure Network Firewall to inspect for the IP address 192.0.2.44, specify
192.0.2.44/32
.To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify
192.0.2.0/24
.To configure Network Firewall to inspect for the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify
1111:0000:0000:0000:0000:0000:0000:0111/128
.To configure Network Firewall to inspect for IP addresses from 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify
1111:0000:0000:0000:0000:0000:0000:0000/64
.
For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
- destination_port
The destination port to inspect for.
You can specify an individual port, for example
1994
and you can specify a port range, for example1990:1994
. To match with any port, specifyANY
.
- direction
The direction of traffic flow to inspect.
If set to
ANY
, the inspection matches bidirectional traffic, both from the source to the destination and from the destination to the source. If set toFORWARD
, the inspection only matches traffic going from the source to the destination.
- protocol
The protocol to inspect for.
To specify all, you can use
IP
, because all traffic on AWS and on the internet is IP.
- source
The source IP address or address range to inspect for, in CIDR notation.
To match with any address, specify
ANY
.Specify an IP address or a block of IP addresses in Classless Inter-Domain Routing (CIDR) notation. Network Firewall supports all address ranges for IPv4 and IPv6.
Examples:
To configure Network Firewall to inspect for the IP address 192.0.2.44, specify
192.0.2.44/32
.To configure Network Firewall to inspect for IP addresses from 192.0.2.0 to 192.0.2.255, specify
192.0.2.0/24
.To configure Network Firewall to inspect for the IP address 1111:0000:0000:0000:0000:0000:0000:0111, specify
1111:0000:0000:0000:0000:0000:0000:0111/128
.To configure Network Firewall to inspect for IP addresses from 1111:0000:0000:0000:0000:0000:0000:0000 to 1111:0000:0000:0000:ffff:ffff:ffff:ffff, specify
1111:0000:0000:0000:0000:0000:0000:0000/64
.
For more information about CIDR notation, see the Wikipedia entry Classless Inter-Domain Routing .
- source_port
The source port to inspect for.
You can specify an individual port, for example
1994
and you can specify a port range, for example1990:1994
. To match with any port, specifyANY
.
IPSetProperty
- class CfnRuleGroup.IPSetProperty(*, definition=None)
Bases:
object
A list of IP addresses and address ranges, in CIDR notation.
This is part of a
RuleGroup.RuleVariables
.- Parameters:
definition (
Optional
[Sequence
[str
]]) – The list of IP addresses and address ranges, in CIDR notation.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall i_pSet_property = { "definition": ["definition"] }
Attributes
- definition
The list of IP addresses and address ranges, in CIDR notation.
IPSetReferenceProperty
- class CfnRuleGroup.IPSetReferenceProperty(*, reference_arn=None)
Bases:
object
Configures one or more
IPSetReferences
for a Suricata-compatible rule group.An IP set reference is a rule variable that references a resource that you create and manage in another AWS service, such as an Amazon VPC prefix list. Network Firewall IP set references enable you to dynamically update the contents of your rules. When you create, update, or delete the IP set you are referencing in your rule, Network Firewall automatically updates the rule’s content with the changes. For more information about IP set references in Network Firewall , see Using IP set references in the Network Firewall Developer Guide .
- Parameters:
reference_arn (
Optional
[str
]) – The Amazon Resource Name (ARN) of the resource to include in theRuleGroup.IPSetReference
.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall i_pSet_reference_property = { "reference_arn": "referenceArn" }
Attributes
- reference_arn
The Amazon Resource Name (ARN) of the resource to include in the
RuleGroup.IPSetReference
.
MatchAttributesProperty
- class CfnRuleGroup.MatchAttributesProperty(*, destination_ports=None, destinations=None, protocols=None, source_ports=None, sources=None, tcp_flags=None)
Bases:
object
Criteria for Network Firewall to use to inspect an individual packet in stateless rule inspection.
Each match attributes set can include one or more items such as IP address, CIDR range, port number, protocol, and TCP flags.
- Parameters:
destination_ports (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PortRangeProperty
,Dict
[str
,Any
]]],None
]) – The destination ports to inspect for. If not specified, this matches with any destination port. This setting is only used for protocols 6 (TCP) and 17 (UDP). You can specify individual ports, for example1994
and you can specify port ranges, for example1990:1994
.destinations (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,AddressProperty
,Dict
[str
,Any
]]],None
]) – The destination IP addresses and address ranges to inspect for, in CIDR notation. If not specified, this matches with any destination address.protocols (
Union
[IResolvable
,Sequence
[Union
[int
,float
]],None
]) – The protocols to inspect for, specified using each protocol’s assigned internet protocol number (IANA). If not specified, this matches with any protocol.source_ports (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,PortRangeProperty
,Dict
[str
,Any
]]],None
]) – The source ports to inspect for. If not specified, this matches with any source port. This setting is only used for protocols 6 (TCP) and 17 (UDP). You can specify individual ports, for example1994
and you can specify port ranges, for example1990:1994
.sources (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,AddressProperty
,Dict
[str
,Any
]]],None
]) – The source IP addresses and address ranges to inspect for, in CIDR notation. If not specified, this matches with any source address.tcp_flags (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,TCPFlagFieldProperty
,Dict
[str
,Any
]]],None
]) – The TCP flags and masks to inspect for. If not specified, this matches with any settings. This setting is only used for protocol 6 (TCP).
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall match_attributes_property = networkfirewall.CfnRuleGroup.MatchAttributesProperty( destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], destinations=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], protocols=[123], source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], sources=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )] )
Attributes
- destination_ports
The destination ports to inspect for.
If not specified, this matches with any destination port. This setting is only used for protocols 6 (TCP) and 17 (UDP).
You can specify individual ports, for example
1994
and you can specify port ranges, for example1990:1994
.
- destinations
The destination IP addresses and address ranges to inspect for, in CIDR notation.
If not specified, this matches with any destination address.
- protocols
The protocols to inspect for, specified using each protocol’s assigned internet protocol number (IANA).
If not specified, this matches with any protocol.
- source_ports
The source ports to inspect for.
If not specified, this matches with any source port. This setting is only used for protocols 6 (TCP) and 17 (UDP).
You can specify individual ports, for example
1994
and you can specify port ranges, for example1990:1994
.
- sources
The source IP addresses and address ranges to inspect for, in CIDR notation.
If not specified, this matches with any source address.
- tcp_flags
The TCP flags and masks to inspect for.
If not specified, this matches with any settings. This setting is only used for protocol 6 (TCP).
PortRangeProperty
- class CfnRuleGroup.PortRangeProperty(*, from_port, to_port)
Bases:
object
A single port range specification.
This is used for source and destination port ranges in the stateless
RuleGroup.MatchAttributes
.- Parameters:
from_port (
Union
[int
,float
]) – The lower limit of the port range. This must be less than or equal to theToPort
specification.to_port (
Union
[int
,float
]) – The upper limit of the port range. This must be greater than or equal to theFromPort
specification.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall port_range_property = networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )
Attributes
- from_port
The lower limit of the port range.
This must be less than or equal to the
ToPort
specification.
- to_port
The upper limit of the port range.
This must be greater than or equal to the
FromPort
specification.
PortSetProperty
- class CfnRuleGroup.PortSetProperty(*, definition=None)
Bases:
object
A set of port ranges for use in the rules in a rule group.
- Parameters:
definition (
Optional
[Sequence
[str
]]) – The set of port ranges.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall port_set_property = networkfirewall.CfnRuleGroup.PortSetProperty( definition=["definition"] )
Attributes
PublishMetricActionProperty
- class CfnRuleGroup.PublishMetricActionProperty(*, dimensions)
Bases:
object
Stateless inspection criteria that publishes the specified metrics to Amazon CloudWatch for the matching packet.
This setting defines a CloudWatch dimension value to be published.
- Parameters:
dimensions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,DimensionProperty
,Dict
[str
,Any
]]]]) –- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall publish_metric_action_property = networkfirewall.CfnRuleGroup.PublishMetricActionProperty( dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )] )
Attributes
ReferenceSetsProperty
- class CfnRuleGroup.ReferenceSetsProperty(*, ip_set_references=None)
Bases:
object
Configures the
ReferenceSets
for a stateful rule group.For more information, see the Using IP set references in Suricata compatible rule groups in the Network Firewall User Guide .
- Parameters:
ip_set_references (
Union
[IResolvable
,Mapping
[str
,Union
[IResolvable
,IPSetReferenceProperty
,Dict
[str
,Any
]]],None
]) – The IP set references to use in the stateful rule group.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall reference_sets_property = networkfirewall.CfnRuleGroup.ReferenceSetsProperty( ip_set_references={ "ip_set_references_key": { "reference_arn": "referenceArn" } } )
Attributes
- ip_set_references
The IP set references to use in the stateful rule group.
RuleDefinitionProperty
- class CfnRuleGroup.RuleDefinitionProperty(*, actions, match_attributes)
Bases:
object
The inspection criteria and action for a single stateless rule.
AWS Network Firewall inspects each packet for the specified matching criteria. When a packet matches the criteria, Network Firewall performs the rule’s actions on the packet.
- Parameters:
actions (
Sequence
[str
]) – The actions to take on a packet that matches one of the stateless rule definition’s match attributes. You must specify a standard action and you can add custom actions. .. epigraph:: Network Firewall only forwards a packet for stateful rule inspection if you specifyaws:forward_to_sfe
for a rule that the packet matches, or if the packet doesn’t match any stateless rule and you specifyaws:forward_to_sfe
for theStatelessDefaultActions
setting for theFirewallPolicy
. For every rule, you must specify exactly one of the following standard actions. - aws:pass - Discontinues all inspection of the packet and permits it to go to its intended destination. - aws:drop - Discontinues all inspection of the packet and blocks it from going to its intended destination. - aws:forward_to_sfe - Discontinues stateless inspection of the packet and forwards it to the stateful rule engine for inspection. Additionally, you can specify a custom action. To do this, you define a custom action by name and type, then provide the name you’ve assigned to the action in thisActions
setting. To provide more than one action in this setting, separate the settings with a comma. For example, if you have a publish metrics custom action that you’ve namedMyMetricsAction
, then you could specify the standard actionaws:pass
combined with the custom action using[“aws:pass”, “MyMetricsAction”]
.match_attributes (
Union
[IResolvable
,MatchAttributesProperty
,Dict
[str
,Any
]]) – Criteria for Network Firewall to use to inspect an individual packet in stateless rule inspection. Each match attributes set can include one or more items such as IP address, CIDR range, port number, protocol, and TCP flags.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall rule_definition_property = networkfirewall.CfnRuleGroup.RuleDefinitionProperty( actions=["actions"], match_attributes=networkfirewall.CfnRuleGroup.MatchAttributesProperty( destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], destinations=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], protocols=[123], source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], sources=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )] ) )
Attributes
- actions
The actions to take on a packet that matches one of the stateless rule definition’s match attributes.
You must specify a standard action and you can add custom actions. .. epigraph:
Network Firewall only forwards a packet for stateful rule inspection if you specify ``aws:forward_to_sfe`` for a rule that the packet matches, or if the packet doesn't match any stateless rule and you specify ``aws:forward_to_sfe`` for the ``StatelessDefaultActions`` setting for the ``FirewallPolicy`` .
For every rule, you must specify exactly one of the following standard actions.
aws:pass - Discontinues all inspection of the packet and permits it to go to its intended destination.
aws:drop - Discontinues all inspection of the packet and blocks it from going to its intended destination.
aws:forward_to_sfe - Discontinues stateless inspection of the packet and forwards it to the stateful rule engine for inspection.
Additionally, you can specify a custom action. To do this, you define a custom action by name and type, then provide the name you’ve assigned to the action in this
Actions
setting.To provide more than one action in this setting, separate the settings with a comma. For example, if you have a publish metrics custom action that you’ve named
MyMetricsAction
, then you could specify the standard actionaws:pass
combined with the custom action using[“aws:pass”, “MyMetricsAction”]
.
- match_attributes
Criteria for Network Firewall to use to inspect an individual packet in stateless rule inspection.
Each match attributes set can include one or more items such as IP address, CIDR range, port number, protocol, and TCP flags.
RuleGroupProperty
- class CfnRuleGroup.RuleGroupProperty(*, rules_source, reference_sets=None, rule_variables=None, stateful_rule_options=None)
Bases:
object
The object that defines the rules in a rule group.
AWS Network Firewall uses a rule group to inspect and control network traffic. You define stateless rule groups to inspect individual packets and you define stateful rule groups to inspect packets in the context of their traffic flow.
To use a rule group, you include it by reference in an Network Firewall firewall policy, then you use the policy in a firewall. You can reference a rule group from more than one firewall policy, and you can use a firewall policy in more than one firewall.
- Parameters:
rules_source (
Union
[IResolvable
,RulesSourceProperty
,Dict
[str
,Any
]]) – The stateful rules or stateless rules for the rule group.reference_sets (
Union
[IResolvable
,ReferenceSetsProperty
,Dict
[str
,Any
],None
]) – The reference sets for the stateful rule group.rule_variables (
Union
[IResolvable
,RuleVariablesProperty
,Dict
[str
,Any
],None
]) – Settings that are available for use in the rules in the rule group. You can only use these for stateful rule groups.stateful_rule_options (
Union
[IResolvable
,StatefulRuleOptionsProperty
,Dict
[str
,Any
],None
]) – Additional options governing how Network Firewall handles stateful rules. The policies where you use your stateful rule group must have stateful rule options settings that are compatible with these settings. Some limitations apply; for more information, see Strict evaluation order in the AWS Network Firewall Developer Guide .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall rule_group_property = networkfirewall.CfnRuleGroup.RuleGroupProperty( rules_source=networkfirewall.CfnRuleGroup.RulesSourceProperty( rules_source_list=networkfirewall.CfnRuleGroup.RulesSourceListProperty( generated_rules_type="generatedRulesType", targets=["targets"], target_types=["targetTypes"] ), rules_string="rulesString", stateful_rules=[networkfirewall.CfnRuleGroup.StatefulRuleProperty( action="action", header=networkfirewall.CfnRuleGroup.HeaderProperty( destination="destination", destination_port="destinationPort", direction="direction", protocol="protocol", source="source", source_port="sourcePort" ), rule_options=[networkfirewall.CfnRuleGroup.RuleOptionProperty( keyword="keyword", # the properties below are optional settings=["settings"] )] )], stateless_rules_and_custom_actions=networkfirewall.CfnRuleGroup.StatelessRulesAndCustomActionsProperty( stateless_rules=[networkfirewall.CfnRuleGroup.StatelessRuleProperty( priority=123, rule_definition=networkfirewall.CfnRuleGroup.RuleDefinitionProperty( actions=["actions"], match_attributes=networkfirewall.CfnRuleGroup.MatchAttributesProperty( destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], destinations=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], protocols=[123], source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], sources=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )] ) ) )], # the properties below are optional custom_actions=[networkfirewall.CfnRuleGroup.CustomActionProperty( action_definition=networkfirewall.CfnRuleGroup.ActionDefinitionProperty( publish_metric_action=networkfirewall.CfnRuleGroup.PublishMetricActionProperty( dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )] ) ), action_name="actionName" )] ) ), # the properties below are optional reference_sets=networkfirewall.CfnRuleGroup.ReferenceSetsProperty( ip_set_references={ "ip_set_references_key": { "reference_arn": "referenceArn" } } ), rule_variables=networkfirewall.CfnRuleGroup.RuleVariablesProperty( ip_sets={ "ip_sets_key": { "definition": ["definition"] } }, port_sets={ "port_sets_key": networkfirewall.CfnRuleGroup.PortSetProperty( definition=["definition"] ) } ), stateful_rule_options=networkfirewall.CfnRuleGroup.StatefulRuleOptionsProperty( rule_order="ruleOrder" ) )
Attributes
- reference_sets
The reference sets for the stateful rule group.
- rule_variables
Settings that are available for use in the rules in the rule group.
You can only use these for stateful rule groups.
- rules_source
The stateful rules or stateless rules for the rule group.
- stateful_rule_options
Additional options governing how Network Firewall handles stateful rules.
The policies where you use your stateful rule group must have stateful rule options settings that are compatible with these settings. Some limitations apply; for more information, see Strict evaluation order in the AWS Network Firewall Developer Guide .
RuleOptionProperty
- class CfnRuleGroup.RuleOptionProperty(*, keyword, settings=None)
Bases:
object
Additional settings for a stateful rule.
- Parameters:
keyword (
str
) – The Suricata rule option keywords. For Network Firewall , the keyword signature ID (sid) is required in the formatsid:112233
. The sid must be unique within the rule group. For information about Suricata rule option keywords, see Rule options .settings (
Optional
[Sequence
[str
]]) –The Suricata rule option settings. Settings have zero or more values, and the number of possible settings and required settings depends on the keyword. The format for Settings is
number
. For information about Suricata rule option settings, see Rule options .
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall rule_option_property = networkfirewall.CfnRuleGroup.RuleOptionProperty( keyword="keyword", # the properties below are optional settings=["settings"] )
Attributes
- keyword
The Suricata rule option keywords.
For Network Firewall , the keyword signature ID (sid) is required in the format
sid:112233
. The sid must be unique within the rule group. For information about Suricata rule option keywords, see Rule options .
- settings
The Suricata rule option settings.
Settings have zero or more values, and the number of possible settings and required settings depends on the keyword. The format for Settings is
number
. For information about Suricata rule option settings, see Rule options .
RuleVariablesProperty
- class CfnRuleGroup.RuleVariablesProperty(*, ip_sets=None, port_sets=None)
Bases:
object
Settings that are available for use in the rules in the
RuleGroup
where this is defined.- Parameters:
ip_sets (
Union
[IResolvable
,Mapping
[str
,Union
[IResolvable
,IPSetProperty
,Dict
[str
,Any
]]],None
]) – A list of IP addresses and address ranges, in CIDR notation.port_sets (
Union
[IResolvable
,Mapping
[str
,Union
[IResolvable
,PortSetProperty
,Dict
[str
,Any
]]],None
]) – A list of port ranges.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall rule_variables_property = networkfirewall.CfnRuleGroup.RuleVariablesProperty( ip_sets={ "ip_sets_key": { "definition": ["definition"] } }, port_sets={ "port_sets_key": networkfirewall.CfnRuleGroup.PortSetProperty( definition=["definition"] ) } )
Attributes
- ip_sets
A list of IP addresses and address ranges, in CIDR notation.
RulesSourceListProperty
- class CfnRuleGroup.RulesSourceListProperty(*, generated_rules_type, targets, target_types)
Bases:
object
Stateful inspection criteria for a domain list rule group.
For HTTPS traffic, domain filtering is SNI-based. It uses the server name indicator extension of the TLS handshake.
By default, Network Firewall domain list inspection only includes traffic coming from the VPC where you deploy the firewall. To inspect traffic from IP addresses outside of the deployment VPC, you set the
HOME_NET
rule variable to include the CIDR range of the deployment VPC plus the other CIDR ranges. For more information, seeRuleGroup.RuleVariables
in this guide and Stateful domain list rule groups in AWS Network Firewall in the Network Firewall Developer Guide- Parameters:
generated_rules_type (
str
) – Whether you want to allow or deny access to the domains in your target list.targets (
Sequence
[str
]) – The domains that you want to inspect for in your traffic flows. Valid domain specifications are the following:. - Explicit names. For example,abc.example.com
matches only the domainabc.example.com
. - Names that use a domain wildcard, which you indicate with an initial ‘.
‘. For example,.example.com
matchesexample.com
and matches all subdomains ofexample.com
, such asabc.example.com
andwww.example.com
.target_types (
Sequence
[str
]) – The types of targets to inspect for. Valid values areTLS_SNI
andHTTP_HOST
.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall rules_source_list_property = networkfirewall.CfnRuleGroup.RulesSourceListProperty( generated_rules_type="generatedRulesType", targets=["targets"], target_types=["targetTypes"] )
Attributes
- generated_rules_type
Whether you want to allow or deny access to the domains in your target list.
- target_types
The types of targets to inspect for.
Valid values are
TLS_SNI
andHTTP_HOST
.
- targets
.
Explicit names. For example,
abc.example.com
matches only the domainabc.example.com
.Names that use a domain wildcard, which you indicate with an initial ‘
.
‘. For example,.example.com
matchesexample.com
and matches all subdomains ofexample.com
, such asabc.example.com
andwww.example.com
.
- See:
- Type:
The domains that you want to inspect for in your traffic flows. Valid domain specifications are the following
RulesSourceProperty
- class CfnRuleGroup.RulesSourceProperty(*, rules_source_list=None, rules_string=None, stateful_rules=None, stateless_rules_and_custom_actions=None)
Bases:
object
The stateless or stateful rules definitions for use in a single rule group.
Each rule group requires a single
RulesSource
. You can use an instance of this for either stateless rules or stateful rules.- Parameters:
rules_source_list (
Union
[IResolvable
,RulesSourceListProperty
,Dict
[str
,Any
],None
]) – Stateful inspection criteria for a domain list rule group.rules_string (
Optional
[str
]) – Stateful inspection criteria, provided in Suricata compatible rules. Suricata is an open-source threat detection framework that includes a standard rule-based language for network traffic inspection. These rules contain the inspection criteria and the action to take for traffic that matches the criteria, so this type of rule group doesn’t have a separate action setting. .. epigraph:: You can’t use thepriority
keyword if theRuleOrder
option inStatefulRuleOptions
is set toSTRICT_ORDER
.stateful_rules (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,StatefulRuleProperty
,Dict
[str
,Any
]]],None
]) – An array of individual stateful rules inspection criteria to be used together in a stateful rule group. Use this option to specify simple Suricata rules with protocol, source and destination, ports, direction, and rule options. For information about the SuricataRules
format, see Rules Format .stateless_rules_and_custom_actions (
Union
[IResolvable
,StatelessRulesAndCustomActionsProperty
,Dict
[str
,Any
],None
]) – Stateless inspection criteria to be used in a stateless rule group.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall rules_source_property = networkfirewall.CfnRuleGroup.RulesSourceProperty( rules_source_list=networkfirewall.CfnRuleGroup.RulesSourceListProperty( generated_rules_type="generatedRulesType", targets=["targets"], target_types=["targetTypes"] ), rules_string="rulesString", stateful_rules=[networkfirewall.CfnRuleGroup.StatefulRuleProperty( action="action", header=networkfirewall.CfnRuleGroup.HeaderProperty( destination="destination", destination_port="destinationPort", direction="direction", protocol="protocol", source="source", source_port="sourcePort" ), rule_options=[networkfirewall.CfnRuleGroup.RuleOptionProperty( keyword="keyword", # the properties below are optional settings=["settings"] )] )], stateless_rules_and_custom_actions=networkfirewall.CfnRuleGroup.StatelessRulesAndCustomActionsProperty( stateless_rules=[networkfirewall.CfnRuleGroup.StatelessRuleProperty( priority=123, rule_definition=networkfirewall.CfnRuleGroup.RuleDefinitionProperty( actions=["actions"], match_attributes=networkfirewall.CfnRuleGroup.MatchAttributesProperty( destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], destinations=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], protocols=[123], source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], sources=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )] ) ) )], # the properties below are optional custom_actions=[networkfirewall.CfnRuleGroup.CustomActionProperty( action_definition=networkfirewall.CfnRuleGroup.ActionDefinitionProperty( publish_metric_action=networkfirewall.CfnRuleGroup.PublishMetricActionProperty( dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )] ) ), action_name="actionName" )] ) )
Attributes
- rules_source_list
Stateful inspection criteria for a domain list rule group.
- rules_string
Stateful inspection criteria, provided in Suricata compatible rules.
Suricata is an open-source threat detection framework that includes a standard rule-based language for network traffic inspection.
These rules contain the inspection criteria and the action to take for traffic that matches the criteria, so this type of rule group doesn’t have a separate action setting. .. epigraph:
You can't use the ``priority`` keyword if the ``RuleOrder`` option in ``StatefulRuleOptions`` is set to ``STRICT_ORDER`` .
- stateful_rules
An array of individual stateful rules inspection criteria to be used together in a stateful rule group.
Use this option to specify simple Suricata rules with protocol, source and destination, ports, direction, and rule options. For information about the Suricata
Rules
format, see Rules Format .
- stateless_rules_and_custom_actions
Stateless inspection criteria to be used in a stateless rule group.
StatefulRuleOptionsProperty
- class CfnRuleGroup.StatefulRuleOptionsProperty(*, rule_order=None)
Bases:
object
Additional options governing how Network Firewall handles the rule group.
You can only use these for stateful rule groups.
- Parameters:
rule_order (
Optional
[str
]) – Indicates how to manage the order of the rule evaluation for the rule group.DEFAULT_ACTION_ORDER
is the default behavior. Stateful rules are provided to the rule engine as Suricata compatible strings, and Suricata evaluates them based on certain settings. For more information, see Evaluation order for stateful rules in the AWS Network Firewall Developer Guide .- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall stateful_rule_options_property = networkfirewall.CfnRuleGroup.StatefulRuleOptionsProperty( rule_order="ruleOrder" )
Attributes
- rule_order
Indicates how to manage the order of the rule evaluation for the rule group.
DEFAULT_ACTION_ORDER
is the default behavior. Stateful rules are provided to the rule engine as Suricata compatible strings, and Suricata evaluates them based on certain settings. For more information, see Evaluation order for stateful rules in the AWS Network Firewall Developer Guide .
StatefulRuleProperty
- class CfnRuleGroup.StatefulRuleProperty(*, action, header, rule_options)
Bases:
object
A single Suricata rules specification, for use in a stateful rule group.
Use this option to specify a simple Suricata rule with protocol, source and destination, ports, direction, and rule options. For information about the Suricata
Rules
format, see Rules Format .- Parameters:
action (
str
) – Defines what Network Firewall should do with the packets in a traffic flow when the flow matches the stateful rule criteria. For all actions, Network Firewall performs the specified action and discontinues stateful inspection of the traffic flow. The actions for a stateful rule are defined as follows: - PASS - Permits the packets to go to the intended destination. - DROP - Blocks the packets from going to the intended destination and sends an alert log message, if alert logging is configured in theFirewall
LoggingConfiguration
. - REJECT - Drops traffic that matches the conditions of the stateful rule and sends a TCP reset packet back to sender of the packet. A TCP reset packet is a packet with no payload and aRST
bit contained in the TCP header flags.REJECT
is available only for TCP traffic. - ALERT - Permits the packets to go to the intended destination and sends an alert log message, if alert logging is configured in theFirewall
LoggingConfiguration
. You can use this action to test a rule that you intend to use to drop traffic. You can enable the rule withALERT
action, verify in the logs that the rule is filtering as you want, then change the action toDROP
. - REJECT - Drops TCP traffic that matches the conditions of the stateful rule, and sends a TCP reset packet back to sender of the packet. A TCP reset packet is a packet with no payload and aRST
bit contained in the TCP header flags. Also sends an alert log mesage if alert logging is configured in theFirewall
LoggingConfiguration
.REJECT
isn’t currently available for use with IMAP and FTP protocols.header (
Union
[IResolvable
,HeaderProperty
,Dict
[str
,Any
]]) – The stateful inspection criteria for this rule, used to inspect traffic flows.rule_options (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,RuleOptionProperty
,Dict
[str
,Any
]]]]) – Additional settings for a stateful rule, provided as keywords and settings.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall stateful_rule_property = networkfirewall.CfnRuleGroup.StatefulRuleProperty( action="action", header=networkfirewall.CfnRuleGroup.HeaderProperty( destination="destination", destination_port="destinationPort", direction="direction", protocol="protocol", source="source", source_port="sourcePort" ), rule_options=[networkfirewall.CfnRuleGroup.RuleOptionProperty( keyword="keyword", # the properties below are optional settings=["settings"] )] )
Attributes
- action
Defines what Network Firewall should do with the packets in a traffic flow when the flow matches the stateful rule criteria.
For all actions, Network Firewall performs the specified action and discontinues stateful inspection of the traffic flow.
The actions for a stateful rule are defined as follows:
PASS - Permits the packets to go to the intended destination.
DROP - Blocks the packets from going to the intended destination and sends an alert log message, if alert logging is configured in the
Firewall
LoggingConfiguration
.REJECT - Drops traffic that matches the conditions of the stateful rule and sends a TCP reset packet back to sender of the packet. A TCP reset packet is a packet with no payload and a
RST
bit contained in the TCP header flags.REJECT
is available only for TCP traffic.ALERT - Permits the packets to go to the intended destination and sends an alert log message, if alert logging is configured in the
Firewall
LoggingConfiguration
.
You can use this action to test a rule that you intend to use to drop traffic. You can enable the rule with
ALERT
action, verify in the logs that the rule is filtering as you want, then change the action toDROP
.REJECT - Drops TCP traffic that matches the conditions of the stateful rule, and sends a TCP reset packet back to sender of the packet. A TCP reset packet is a packet with no payload and a
RST
bit contained in the TCP header flags. Also sends an alert log mesage if alert logging is configured in theFirewall
LoggingConfiguration
.
REJECT
isn’t currently available for use with IMAP and FTP protocols.
- header
The stateful inspection criteria for this rule, used to inspect traffic flows.
- rule_options
Additional settings for a stateful rule, provided as keywords and settings.
StatelessRuleProperty
- class CfnRuleGroup.StatelessRuleProperty(*, priority, rule_definition)
Bases:
object
A single stateless rule.
This is used in
RuleGroup.StatelessRulesAndCustomActions
.- Parameters:
priority (
Union
[int
,float
]) – Indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group. Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group. Each stateless rule group uses exactly oneStatelessRulesAndCustomActions
object, and eachStatelessRulesAndCustomActions
contains exactly oneStatelessRules
object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any singleStatelessRules
object. You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there’s a wide range in between, for example use 100, 200, and so on.rule_definition (
Union
[IResolvable
,RuleDefinitionProperty
,Dict
[str
,Any
]]) – Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall stateless_rule_property = networkfirewall.CfnRuleGroup.StatelessRuleProperty( priority=123, rule_definition=networkfirewall.CfnRuleGroup.RuleDefinitionProperty( actions=["actions"], match_attributes=networkfirewall.CfnRuleGroup.MatchAttributesProperty( destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], destinations=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], protocols=[123], source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], sources=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )] ) ) )
Attributes
- priority
Indicates the order in which to run this rule relative to all of the rules that are defined for a stateless rule group.
Network Firewall evaluates the rules in a rule group starting with the lowest priority setting. You must ensure that the priority settings are unique for the rule group.
Each stateless rule group uses exactly one
StatelessRulesAndCustomActions
object, and eachStatelessRulesAndCustomActions
contains exactly oneStatelessRules
object. To ensure unique priority settings for your rule groups, set unique priorities for the stateless rules that you define inside any singleStatelessRules
object.You can change the priority settings of your rules at any time. To make it easier to insert rules later, number them so there’s a wide range in between, for example use 100, 200, and so on.
- rule_definition
Defines the stateless 5-tuple packet inspection criteria and the action to take on a packet that matches the criteria.
StatelessRulesAndCustomActionsProperty
- class CfnRuleGroup.StatelessRulesAndCustomActionsProperty(*, stateless_rules, custom_actions=None)
Bases:
object
Stateless inspection criteria.
Each stateless rule group uses exactly one of these data types to define its stateless rules.
- Parameters:
stateless_rules (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,StatelessRuleProperty
,Dict
[str
,Any
]]]]) – Defines the set of stateless rules for use in a stateless rule group.custom_actions (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CustomActionProperty
,Dict
[str
,Any
]]],None
]) – Defines an array of individual custom action definitions that are available for use by the stateless rules in thisStatelessRulesAndCustomActions
specification. You name each custom action that you define, and then you can use it by name in your stateless ruleRuleGroup.RuleDefinition
Actions
specification.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall stateless_rules_and_custom_actions_property = networkfirewall.CfnRuleGroup.StatelessRulesAndCustomActionsProperty( stateless_rules=[networkfirewall.CfnRuleGroup.StatelessRuleProperty( priority=123, rule_definition=networkfirewall.CfnRuleGroup.RuleDefinitionProperty( actions=["actions"], match_attributes=networkfirewall.CfnRuleGroup.MatchAttributesProperty( destination_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], destinations=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], protocols=[123], source_ports=[networkfirewall.CfnRuleGroup.PortRangeProperty( from_port=123, to_port=123 )], sources=[networkfirewall.CfnRuleGroup.AddressProperty( address_definition="addressDefinition" )], tcp_flags=[networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )] ) ) )], # the properties below are optional custom_actions=[networkfirewall.CfnRuleGroup.CustomActionProperty( action_definition=networkfirewall.CfnRuleGroup.ActionDefinitionProperty( publish_metric_action=networkfirewall.CfnRuleGroup.PublishMetricActionProperty( dimensions=[networkfirewall.CfnRuleGroup.DimensionProperty( value="value" )] ) ), action_name="actionName" )] )
Attributes
- custom_actions
Defines an array of individual custom action definitions that are available for use by the stateless rules in this
StatelessRulesAndCustomActions
specification.You name each custom action that you define, and then you can use it by name in your stateless rule
RuleGroup.RuleDefinition
Actions
specification.
- stateless_rules
Defines the set of stateless rules for use in a stateless rule group.
TCPFlagFieldProperty
- class CfnRuleGroup.TCPFlagFieldProperty(*, flags, masks=None)
Bases:
object
TCP flags and masks to inspect packets for. This is used in the
RuleGroup.MatchAttributes
specification.For example:
"TCPFlags": [ { "Flags": [ "ECE", "SYN" ], "Masks": [ "SYN", "ECE" ] } ]
- Parameters:
flags (
Sequence
[str
]) – Used in conjunction with theMasks
setting to define the flags that must be set and flags that must not be set in order for the packet to match. This setting can only specify values that are also specified in theMasks
setting. For the flags that are specified in the masks setting, the following must be true for the packet to match: - The ones that are set in this flags setting must be set in the packet. - The ones that are not set in this flags setting must also not be set in the packet.masks (
Optional
[Sequence
[str
]]) – The set of flags to consider in the inspection. To inspect all flags in the valid values list, leave this with no setting.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_networkfirewall as networkfirewall t_cPFlag_field_property = networkfirewall.CfnRuleGroup.TCPFlagFieldProperty( flags=["flags"], # the properties below are optional masks=["masks"] )
Attributes
- flags
Used in conjunction with the
Masks
setting to define the flags that must be set and flags that must not be set in order for the packet to match.This setting can only specify values that are also specified in the
Masks
setting.For the flags that are specified in the masks setting, the following must be true for the packet to match:
The ones that are set in this flags setting must be set in the packet.
The ones that are not set in this flags setting must also not be set in the packet.
- masks
The set of flags to consider in the inspection.
To inspect all flags in the valid values list, leave this with no setting.