AWS ses: Mail Manager SMTP relay docs: TLS, auth, and credential guidance
Summary
Major rewrite of the SES Mail Manager SMTP relay page: adds a 'How SMTP relay works' flow, a destination authentication/port selection table (NoAuthentication on port 25 vs SecretArn on port 587), prerequisites, CLI examples for create-relay, Secrets Manager credential format and rotation procedure, ingress/rule interaction guidance, monitoring, and recommendations (DENY default traffic policy, Archive-before-Relay, DROP failure policy, avoiding duplicate delivery). Also renames Google Workspaces/Microsoft Office 365 sections and clarifies use of regional Mail Manager SMTP relay IP ranges.
Security assessment
The rewrite documents concrete security controls for Mail Manager relays: mandatory TLS to the destination, Secrets Manager-backed SMTP credentials with required resource/KMS key policies, credential rotation with overlapping validity, and a DENY-by-default traffic policy recommendation. No specific vulnerability, CVE, or incident is referenced, so it is security documentation/hardening guidance rather than a fix.
Evidence
The destination must provide a public SMTP endpoint. Private SMTP endpoints are not supported. Mail Manager requires TLS when it connects to the destination.
Diff
diff --git a/ses/latest/dg/eb-relay.md b/ses/latest/dg/eb-relay.md index f757859..ed07ebf 100644 --- a//ses/latest/dg/eb-relay.md +++ b//ses/latest/dg/eb-relay.md @@ -7 +7 @@ -Creating an SMTP relay (console)Setting up Google WorkspacesSetting up Microsoft Office 365 +How SMTP relay worksChoosing destination authentication and portBefore you create an SMTP relayCreate and manage an SMTP relayUsing SMTP relays with ingress points and rulesMonitoring relay deliveryRecommendationsSMTP relay use cases @@ -11 +11 @@ Creating an SMTP relay (console)Setting up Google WorkspacesSetting up Microsoft -Because Mail Manager is deployed between your email environment (such as Microsoft 365, Google Workspace, or On-Premise Exchange) and the internet, Mail Manager uses SMTP relays to route incoming emails that are processed by Mail Manager to your email environment. It can also route outbound emails to another email infrastructure such as another Exchange server or a third-party email gateway before sending to end recipients. +Simple Mail Transfer Protocol (SMTP) can transfer email through one or more servers before the message reaches its final recipient. An SMTP server that passes the message to the next server is a relay. For the SMTP relay model, see [RFC 5321, section 3.6](https://www.rfc-editor.org/rfc/rfc5321.html#section-3.6). @@ -13 +13 @@ Because Mail Manager is deployed between your email environment (such as Microso -A SMTP relay is a vital component of your email infrastructure, responsible for efficiently routing emails between servers when designated by a rule action defined in a rule set. +An SES Mail Manager SMTP relay is a reusable destination configuration. It specifies the public SMTP server hostname, port, and authentication that a rule action uses to deliver email. Use a relay when Mail Manager must filter, scan, modify, or archive email before handing it to an existing mailbox provider, on-premises mail server, or email gateway. @@ -15 +15 @@ A SMTP relay is a vital component of your email infrastructure, responsible for -Specifically, a SMTP relay can redirect incoming email between SES Mail Manager and an external email infrastructure such as Exchange, on-premise or third-party email gateways, and others. Incoming emails to an ingress endpoint will be processed by a rule that will route specified email to the designated SMTP relay, which in turn, will pass it on to the external email infrastructure defined in the SMTP relay. +The relay resource and SMTP relay action have different purposes. The relay resource defines where and how Mail Manager connects. The action selects the current email and SMTP envelope recipients to send through that relay. For action fields, envelope-sender behavior, failure handling, and action order, see [SMTP relay](./eb-rules-actions.html#eb-rules-actions-relay). @@ -17 +17 @@ Specifically, a SMTP relay can redirect incoming email between SES Mail Manager -When your ingress endpoint receives email, it uses a traffic policy to determine which emails to block or allow. The email you allow in passes to a rule set that applies conditional rules to execute the actions you've defined for specific types of email. One of the rule actions you can define is _SMTPRelay action_ —if you select this action, the email will be passed along to the external SMTP server defined in your SMTP relay. +The following list provides a text equivalent for the diagram. @@ -19 +19,22 @@ When your ingress endpoint receives email, it uses a traffic policy to determine -For example, you could use the _SMTPRelay action_ to send email from your ingress endpoint to your on-premise Microsoft Exchange Server. You would set up your Exchange server to have a _public_ SMTP endpoint that can only be accessed using certain credentials. When you create the SMTP relay, you enter the server name, port, and credentials of your Exchange server and give your SMTP relay a unique name, say, "RelayToMyExchangeServer". Then, you create a rule in your ingress endpoint's rule set that says, "When _From address_ contains _'gmail.com'_ , then perform _SMTPRelay action_ using the SMTP relay called _RelayToMyExchangeServer_ ". +Google Workspace mailbox delivery + + +Internet senders connect to an _Open ingress point_ for `example.com` on port 25. A traffic policy with a `DENY` default action allows the intended recipients and requires TLS 1.2 or later. An ordered rule set archives the accepted email and runs the relay action. The unauthenticated SMTP relay connects over TLS to `aspmx.l.google.com` on port 25. Google Workspace then delivers the email to the corporate mailbox. + +Microsoft 365 mailbox delivery + + +Internet senders connect to an _Open ingress point_ for `example.org` on port 25. A traffic policy with a `DENY` default action allows the intended recipients and requires TLS 1.2 or later. An ordered rule set archives the accepted email and runs the relay action. The unauthenticated SMTP relay connects over TLS to `example-org.mail.protection.outlook.com` on port 25. Microsoft 365 then delivers the email to the corporate mailbox. + +Authenticated SMTP gateway + + +An application or mail server connects to an _Authenticated ingress point_ on port 587. A traffic policy with a `DENY` default action allows the approved domains and limits the maximum message size to 30 MiB. An ordered rule set scans and archives the accepted email before it runs the relay action. The SMTP relay uses the destination username and password from AWS Secrets Manager to connect over TLS to `smtp.gateway.example.net` on port 587. + +For every flow, a traffic-policy rejection returns an SMTP rejection before rule-set processing. For accepted email, rule-set application logs record action status, destination SMTP responses, and rejected recipients. Relay metrics count delivered and rejected recipients by relay ID. The final relay outcome changes from `IN_PROGRESS` to `SUCCESS` or `FAILURE`. + +The following diagram illustrates these flows. + + + +For an unauthenticated destination, configure the destination to accept connections from the [Mail Manager SMTP relay IP ranges](https://docs.aws.amazon.com/general/latest/gr/ses.html#ses_mm_relay_ip_ranges) for your AWS Region. Do not add these shared IP ranges to your domain's SPF record. @@ -23 +44,22 @@ Note -All SMTP endpoints you configure with Amazon SES SMTP relay must be public as private SMTP endpoints are not supported. +The destination must provide a public SMTP endpoint. Private SMTP endpoints are not supported. Mail Manager requires TLS when it connects to the destination. + +## How SMTP relay works + +Email follows these steps when a rule uses an SMTP relay action. + + 1. A sender connects to an open or authenticated ingress endpoint. + + 2. The ingress endpoint's traffic policy accepts or rejects each SMTP envelope recipient. Rejected recipients do not enter rule-set processing. + + 3. The assigned rule set evaluates its rules and runs actions in order for the selected recipients. + + 4. Earlier actions can archive the email, add headers, or replace SMTP envelope recipients before the relay action runs. + + 5. The relay action loads the destination from the relay resource and sends the current MIME email to the selected recipients. + + 6. Rule-set processing waits for a final delivery or rejection outcome for each selected recipient. For logs and metrics, see [Monitor and troubleshoot rule sets](./eb-rules-monitoring.html). + + + + +A relay uses the configured hostname as a fixed next-hop SMTP server. To let SES resolve recipient domains and deliver directly to their mail servers, use the [Send to internet action](./eb-rules-actions.html#eb-rules-actions-send) instead. @@ -25 +67 @@ All SMTP endpoints you configure with Amazon SES SMTP relay must be public as pr -Now, when email from _gmail.com_ arrives to your ingress endpoint, the rule will trigger the _SMTPRelay action_ and contact your Exchange server using the credentials you provided when creating your SMTP relay and deliver the email to your Exchange server. Thus, email received from _gmail.com_ is _relayed_ to your Exchange server. +## Choosing destination authentication and port @@ -27 +69 @@ Now, when email from _gmail.com_ arrives to your ingress endpoint, the rule will -You must first create an SMTP relay before it can be designated in a rule action. The procedure in the next section will walk you through creating an SMTP relay in the SES console. +Choose authentication and a port according to the service exposed by the destination SMTP server. Authentication on the source ingress endpoint is independent from authentication on the destination relay. @@ -29 +71,4 @@ You must first create an SMTP relay before it can be designated in a rule action -## Creating an SMTP relay in the SES console +Destination | Authentication | Common port | When to use +---|---|---|--- +Mail server or inbound gateway | `NoAuthentication`. Configure the destination to accept the regional Mail Manager SMTP relay IP ranges. | `25` | Relaying email between mail servers, including delivery to Google Workspace and Microsoft 365. +Authenticated SMTP server | `SecretArn`. The AWS Secrets Manager secret contains the destination username and password. | `587`, when supported | Submitting email to a public SMTP server that requires SMTP credentials. @@ -31 +76 @@ You must first create an SMTP relay before it can be designated in a rule action -The following procedure shows you how to use the **SMTP relays** page in the SES console to create SMTP relays and manage the ones you've already created. +[RFC 6409](https://www.rfc-editor.org/rfc/rfc6409.html) separates message relay from message submission. SMTP relay between mail servers continues to use port 25. Authenticated message submission normally uses port 587. Always use the port documented by the destination provider. @@ -33 +78,20 @@ The following procedure shows you how to use the **SMTP relays** page in the SES -###### To create and manage SMTP relays using the console +## Before you create an SMTP relay + + 1. Configure a public SMTP hostname and port on the destination. Confirm that it accepts TLS connections from Mail Manager. + + 2. For an unauthenticated destination, allow the [regional Mail Manager SMTP relay IP ranges](https://docs.aws.amazon.com/general/latest/gr/ses.html#ses_mm_relay_ip_ranges). Verify every intended recipient email identity in SES. For identity instructions, see [Creating a domain identity](./creating-identities.html#verify-domain-procedure). + + 3. For an authenticated destination, create an AWS Secrets Manager secret that contains `username` and `password`. Configure the resource and AWS KMS key policies described in [Permission policies for SMTP relay](./eb-policies.html#eb-policies-relay). + + 4. Create the rule set that selects the messages and recipients to relay. For setup instructions, see [Create and manage rule sets](./eb-rules-setup.html). + + + + +Warning + +An unauthenticated relay requires verified recipient identities. If any selected recipient is not verified, the relay action rejects the complete send before delivery starts. + +## Creating and managing an SMTP relay + +###### To create an SMTP relay in the SES console @@ -37 +101 @@ The following procedure shows you how to use the **SMTP relays** page in the SES - 2. In the left navigation panel, choose **SMTP relays** under **Mail Manager**. + 2. In the navigation pane, under **Mail Manager** , choose **SMTP relays**. @@ -39 +103 @@ The following procedure shows you how to use the **SMTP relays** page in the SES - 3. On the **SMTP relays** page, select **Create SMTP relay**. + 3. Choose **Create SMTP relay** , and enter a unique relay name. @@ -41 +105 @@ The following procedure shows you how to use the **SMTP relays** page in the SES - 4. On the **Create SMTP relay** page, enter a unique name for your SMTP relay. + 4. Enter the public destination SMTP server hostname and port. @@ -43 +107 @@ The following procedure shows you how to use the **SMTP relays** page in the SES - 5. Depending on whether you want to configure an inbound (non-authenticated) or outbound (authenticated) SMTP relay, follow the respective instructions: + 5. For an unauthenticated destination, choose **No authentication**. For an authenticated destination, select the AWS Secrets Manager secret that contains its SMTP username and password. @@ -45 +109 @@ The following procedure shows you how to use the **SMTP relays** page in the SES -Inbound + 6. Choose **Create SMTP relay**. @@ -48 +111,0 @@ Inbound -###### To configure an inbound SMTP relay @@ -50 +112,0 @@ Inbound - 1. When SMTP relay is used as an inbound gateway to route incoming emails processed by Mail Manager to your external email environment, you will first need to configure the email hosting environment. While every email hosting provider has their own GUI and configuration workflow unique to them, the principals of configuring them to work with inbound gateways, such as your Mail Manager SMTP relay, will be similar. @@ -52 +114 @@ Inbound -To help illustrate this, we have provided examples of how to configure Google Workspaces and Microsoft Office 365 to work with your SMTP relay as an inbound gateway in the following sections: +To update a relay, select its name and change its name, destination hostname, port, or authentication. To delete a relay, remove its references from rule sets, and then choose **Delete** on the **SMTP relays** page. @@ -54 +116 @@ To help illustrate this, we have provided examples of how to configure Google Wo - * Setting up Google Workspaces +### Creating an SMTP relay with the AWS CLI @@ -56 +118 @@ To help illustrate this, we have provided examples of how to configure Google Wo - * Setting up Microsoft Office 365 +The following command creates an unauthenticated relay to Google Workspace on port 25. @@ -58 +119,0 @@ To help illustrate this, we have provided examples of how to configure Google Wo -Note @@ -60 +121,6 @@ Note -Ensure that your intended recipient destinations are SES verified email identities. For example, if you want to deliver email to recipients [email protected]_ , [email protected]_ , [email protected]_ , and [email protected]_ , then we'd recommend that you verify the `example.com` and `acme.com` domains in SES. If a recipient destination is not verified, SES will not attempt to deliver the email to the public SMTP server. + PROMPT> aws mailmanager create-relay \ + --region us-east-1 \ + --relay-name google-workspace \ + --server-name aspmx.l.google.com \ + --server-port 25 \ + --authentication '{"NoAuthentication": {}}' @@ -62 +128 @@ Ensure that your intended recipient destinations are SES verified email identiti - 2. After you've configured Google Workspaces or Microsoft Office 365 to work with inbound gateways, enter the host name of the public SMTP server with the values below respective to your provider: +Replace the AWS Region and relay name with your values. Before using the relay, configure Google Workspace as described in Setting up Google Workspace for inbound (unauthenticated) SMTP relay. @@ -64 +130 @@ Ensure that your intended recipient destinations are SES verified email identiti - * Google Workspaces: `aspmx.l.google.com` +The following command creates an authenticated relay to a public SMTP submission server on port 587. @@ -66 +131,0 @@ Ensure that your intended recipient destinations are SES verified email identiti - * Microsoft Office 365: `_< your_domain>_.mail.protection.outlook.com` @@ -68 +133,8 @@ Ensure that your intended recipient destinations are SES verified email identiti -Replace the dots with "-" in your domain name. For example, if your domain is _acme.com_ , you would enter `acme-com.mail.protection.outlook.com` + PROMPT> aws mailmanager create-relay \ + --region us-east-1 \ + --relay-name corporate-submission \ + --server-name smtp.gateway.example.com \ + --server-port 587 \ + --authentication '{ + "SecretArn": "arn:aws:secretsmanager:us-east-1:123456789012:secret:mail-manager-relay-credentials" + }' @@ -70 +142 @@ Replace the dots with "-" in your domain name. For example, if your domain is _a - 3. Enter port number 25 for the public SMTP server. +Replace the AWS Region, account ID, relay name, destination hostname, and secret name with your values. For complete field constraints, see [`CreateRelay`](https://docs.aws.amazon.com/sesmailmanager/latest/APIReference/API_CreateRelay.html). To manage the resource with CloudFormation, see [`AWS::SES::MailManagerRelay`](https://docs.aws.amazon.com/AWSCloudFormation/latest/TemplateReference/aws-resource-ses-mailmanagerrelay.html). @@ -72 +144 @@ Replace the dots with "-" in your domain name. For example, if your domain is _a - 4. Leave the Authentication section blank (do not select or create a secret ARN). +### Using Secrets Manager credentials @@ -74 +146 @@ Replace the dots with "-" in your domain name. For example, if your domain is _a -Outbound +An authenticated relay reads the destination SMTP username and password from the secret referenced by `SecretArn`. Store the secret as a JSON object with the following keys. @@ -77 +149,4 @@ Outbound -###### To configure an outbound SMTP relay + { + "username": "smtp-user", + "password": "smtp-password" + } @@ -79 +154 @@ Outbound - 1. Enter the host name of the public SMTP server you want your relay to connect to. +Use the exact lowercase keys `username` and `password`. The values must match credentials accepted by the destination SMTP server. For the required secret resource policy and AWS KMS key policy, see [Secrets resource policy](./eb-policies.html#eb-policies-relay-secrets) and [KMS CMK policy](./eb-policies.html#eb-policies-relay-cmk). @@ -81 +156 @@ Outbound - 2. Enter the port number for the public SMTP server. +#### Rotating destination credentials @@ -83 +158 @@ Outbound - 3. Setup authentication for your public SMTP server by selecting one of your secrets from **Secret ARN**. _If you select a previously created secret, it must contain the policies indicated in the following steps for creating a new secret._ +Updating the secret does not update the credential on the destination SMTP server. Coordinate both changes to avoid authentication failures. @@ -85 +160,9 @@ Outbound - * You have the option to create a new secret by choosing **Create new** —the AWS Secrets Manager console will open where you can continue to create a new key: +###### To rotate SMTP relay credentials + + 1. Configure the destination SMTP server to accept the new credential while the previous credential remains valid. + + 2. Update the secret's `AWSCURRENT` version with the new `username` and `password`. + + 3. Confirm successful relay deliveries in the rule-set logs and relay metrics. + + 4. Remove the previous credential from the destination SMTP server. @@ -87 +169,0 @@ Outbound - 1. Choose **Other type of secret** in **Secret type**. @@ -89 +170,0 @@ Outbound - 2. Enter the following keys and values in **Key/value pairs** : @@ -91,4 +171,0 @@ Outbound