AWS ses: Expand Mail Manager traffic policy evaluation and IAM guidance
Summary
Rewrites and greatly expands SES Mail Manager traffic policy documentation, adding evaluation order, JSON/CLI examples, Email Add On conditions, IAM permission examples, default-DENY/TLS/logging recommendations, and limitations.
Security assessment
The change documents IAM policy examples with condition keys that restrict traffic policy and rule set assignment for ingress points, plus hardening guidance such as default DENY and minimum TLS versions. It does not reference a specific vulnerability, CVE, or incident.
Evidence
+The `ses:MailManagerTrafficPolicyArn`, `ses:MailManagerRuleSetArn`, and `ses:MailManagerIngressPointType` condition keys restrict the resources that can be assigned when an ingress point is created or updated.
Diff
diff --git a/ses/latest/dg/eb-filters.md b/ses/latest/dg/eb-filters.md index 3849f9f..881470d 100644 --- a//ses/latest/dg/eb-filters.md +++ b//ses/latest/dg/eb-filters.md @@ -7 +7 @@ -Creating traffic policies & policy statements (console)Policy statement conditions +How traffic policies workTraffic policy examplesUsing Email Add OnsManaging traffic policies with the AWS CLITraffic policy permissionsCreating traffic policies & policy statements (console)Policy statement conditionsTraffic policy recommendationsTraffic policy limitations @@ -11 +11 @@ Creating traffic policies & policy statements (console)Policy statement conditio -A traffic policy is a container for policy statements that you assign to an ingress endpoint so that it can sort the incoming mail by allowing or blocking specific types of email when the conditions of the policy statements are met. A traffic policy can be used by multiple ingress endpoints. +A traffic policy provides firewall-like filtering for incoming Simple Mail Transfer Protocol (SMTP) traffic at an ingress endpoint. With a traffic policy, you protect the ingress endpoint and downstream mail systems by allowing or rejecting recipients before accepted messages enter rule set processing. @@ -13 +13 @@ A traffic policy is a container for policy statements that you assign to an ingr -###### Tip +Each policy statement checks information available while an email is being received, such as the recipient address, sender IPv4 or IPv6 address, Transport Layer Security (TLS) version, address list membership, or an Email Add On result. A matching statement applies an `ALLOW` or `DENY` action. You can also set a maximum message size in bytes when you create or update the traffic policy. Use this setting to prevent messages that are larger than your downstream mail systems can accept or process from entering rule set processing. @@ -15 +15 @@ A traffic policy is a container for policy statements that you assign to an ingr -You can think of a traffic policy as a "filter set", and a policy statement as a "filter". The traffic policy (filter set) contains polices (filters) that you use to _filter_ your incoming mail. +An ingress endpoint references one traffic policy and one rule set. The traffic policy checks each recipient before the rule set processes the message. If the recipient is accepted and the message is within the maximum message size, Mail Manager passes the message to the rule set. A traffic policy is reusable and can be assigned to multiple ingress endpoints. @@ -17 +17 @@ You can think of a traffic policy as a "filter set", and a policy statement as a -When you create a traffic policy, you have the option to set a maximum message size (in bytes). When a message exceeds that size, it is discarded. You can also set the default action of the policy to allow or block email that falls outside of the conditions of your policy statements—think of this as a “catch all” action for the traffic policy. +You define policy statements when you create or update the traffic policy. Policy statements are not separate resources. @@ -19 +19 @@ When you create a traffic policy, you have the option to set a maximum message s -Policy statements are also created with either an allow or block action that is taken when the statements' conditions are met. You build the conditions by selecting an email property and a conditional operator for a value you enter that must be matched by the incoming message before the policy statement will allow or block it. Each policy statement can have multiple conditions. +## How traffic policy evaluation works @@ -21 +21 @@ Policy statements are also created with either an allow or block action that is -A traffic policy can contain multiple policy statements and executes them in an order that's based on the implicit hierarchy of how it evaluates email: +A traffic policy contains one or more policy statements. Each statement has one action and one or more conditions. Each condition contains one expression. String and IP expressions contain one or more comparison values. @@ -23 +23 @@ A traffic policy can contain multiple policy statements and executes them in an - * Policy statements that block – These statements are evaluated first and block any message that meets the statement's conditions. +###### **How traffic policy elements combine** @@ -25 +25 @@ A traffic policy can contain multiple policy statements and executes them in an - * Policy statements that allow – These statements are evaluated next and allow any message that meets the statement's conditions. +Any listed value can make an expression match. Every condition must match before its statement matches. Any statement with the same action can match. The following diagram shows how these levels connect: @@ -27 +27 @@ A traffic policy can contain multiple policy statements and executes them in an - * Default action of traffic policy – The remainder of messages that fall outside of the policy statements are allowed or blocked based on how you've defined this parameter. + * Within one expression, any listed value can match. For example, a recipient that ends with `@example.com` or `@example.org` matches a `RECIPIENT` expression that uses `ENDS_WITH`. @@ -29 +29 @@ A traffic policy can contain multiple policy statements and executes them in an - * Maximum message size – If this optional parameter is set, any message greater than this size is discarded. + * Within one statement, every condition must match. For example, the sender IP must be in `192.0.2.0/24` and the recipient must end with `@example.com`. @@ -30,0 +31 @@ A traffic policy can contain multiple policy statements and executes them in an + * Among statements with the same action, any statement can match. For example, separate `ALLOW` statements can match `[email protected]` or `[email protected]`. @@ -34 +34,0 @@ A traffic policy can contain multiple policy statements and executes them in an -A traffic policy is an independent resource which can be used by more than one ingress endpoint, but policy statements belong exclusively to the traffic policy in which they were created. Thus, you must first create a traffic policy, or edit an existing one, before you can create policy statements to evaluate the email coming into your ingress endpoint. @@ -36 +36,477 @@ A traffic policy is an independent resource which can be used by more than one i -The procedure in the next section explains how to create traffic policies and their policy statements in the SES console. +Read the following diagram from left to right. In the first panel, either recipient suffix makes the expression match. In the second panel, the sender IP and recipient conditions must both match. In the third panel, either `ALLOW` statement can match. + + + +Any listed value can make an expression match. Every condition must match before its statement matches. Any statement with the same action can match. The policy evaluates `DENY` statements before `ALLOW` statements, and then applies the default action if needed. + +The traffic policy evaluates `DENY` statements first. A match rejects the recipient. If none match and the default action is `ALLOW`, the default action accepts the recipient without evaluating `ALLOW` statements. If the default action is `DENY`, the policy evaluates `ALLOW` statements. The first match accepts the recipient. If none match, the default `DENY` action rejects the recipient. The following diagram shows these branches: + + + +### Combining policy elements + +_Any listed value can match._ With `EQUALS`, `STARTS_WITH`, `ENDS_WITH`, `CONTAINS`, or `CIDR_MATCHES`, an expression matches when the value being checked matches at least one entry in the `Values` list. In the following example, `[email protected]` and `[email protected]` both match: + + + { + "StringExpression": { + "Evaluate": {"Attribute": "RECIPIENT"}, + "Operator": "ENDS_WITH", + "Values": ["@example.com", "@example.org"] + } + } + +With `NOT_EQUALS` or `NOT_CIDR_MATCHES`, an expression matches only when the value being checked matches none of the listed values. + +_Every condition in a statement must match._ The statement's action applies only after all its conditions match. The following statement allows a recipient only when the sender is in `192.0.2.0/24` and the recipient address ends with `@example.com`: + + + { + "Action": "ALLOW", + "Conditions": [ + { + "IpExpression": { + "Evaluate": {"Attribute": "SENDER_IP"}, + "Operator": "CIDR_MATCHES", + "Values": ["192.0.2.0/24"] + } + }, + { + "StringExpression": { + "Evaluate": {"Attribute": "RECIPIENT"}, + "Operator": "ENDS_WITH", + "Values": ["@example.com"] + } + } + ] + } + +_A match on any statement with the same action is enough._ Statements are checked in their policy order. The first matching statement applies its action, and later statements with that action are not checked. In the following example, either `[email protected]` or `[email protected]` matches an `ALLOW` statement: + + + { + "DefaultAction": "DENY", + "PolicyStatements": [ + { + "Action": "ALLOW", + "Conditions": [{ + "StringExpression": { + "Evaluate": {"Attribute": "RECIPIENT"}, + "Operator": "EQUALS", + "Values": ["[email protected]"] + } + }] + }, + { + "Action": "ALLOW", + "Conditions": [{ + "StringExpression": { + "Evaluate": {"Attribute": "RECIPIENT"}, + "Operator": "EQUALS", + "Values": ["[email protected]"] + } + }] + } + ] + } + +###### Use an address list for a large recipient set + +To allow a large number of recipients, store them in an address list instead of creating one statement for each recipient. One address-list membership condition can allow every matching recipient. + +In the following example, replace the AWS Region, account ID, and address list ID with your own values. The policy statement allows every recipient in the address list: + + + { + "Action": "ALLOW", + "Conditions": [{ + "BooleanExpression": { + "Evaluate": { + "IsInAddressList": { + "Attribute": "RECIPIENT", + "AddressLists": ["arn:aws:ses:us-east-1:123456789012:mailmanager-address-list/al-0123456789abcdef"] + } + }, + "Operator": "IS_TRUE" + } + }] + } + +For instructions on creating and maintaining address lists, see [Address Lists](./eb-addlist.html). + +### Evaluating policy statements in order + +The traffic policy applies the value and condition logic described in Combining policy elements. For each SMTP recipient, it evaluates statements in the following order: + + 1. The traffic policy evaluates `DENY` statements first, in the order in which they appear in the policy. The first matching `DENY` statement stops evaluation and rejects the recipient. + + 2. If no `DENY` statement matches and the default action is `ALLOW`, the default action accepts the recipient. The `ALLOW` statements are not evaluated. + + 3. If no `DENY` statement matches and the default action is `DENY`, the traffic policy evaluates `ALLOW` statements in the order in which they appear in the policy. The first matching `ALLOW` statement stops evaluation and accepts the recipient. + + 4. If no `ALLOW` statement matches, the default `DENY` action rejects the recipient. + + + + +###### Note + +A matching `DENY` statement always takes precedence over a matching `ALLOW` statement because all `DENY` statements are evaluated first. + +### Reviewing evaluation examples + +The following JSON fragments include only the fields needed to show evaluation behavior. + +The following policy uses a default `DENY` action with a `DENY` statement and an `ALLOW` statement: + + + { + "DefaultAction": "DENY", + "PolicyStatements": [ + { + "Action": "DENY", + "Conditions": [{ + "StringExpression": { + "Evaluate": {"Attribute": "RECIPIENT"}, + "Operator": "EQUALS", + "Values": ["[email protected]"] + } + }] + }, + { + "Action": "ALLOW", + "Conditions": [{ + "StringExpression": { + "Evaluate": {"Attribute": "RECIPIENT"}, + "Operator": "ENDS_WITH", + "Values": ["@example.com"] + } + }] + } + ] + } + + * `[email protected]` matches both statements. The `DENY` statement is evaluated first and rejects the recipient. + + * `[email protected]` does not match the `DENY` statement. It matches the `ALLOW` statement and is accepted. +