-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws-ses: DKIM records are created with incorrect name from EmailIdentity #21306
Comments
Hi @Booligoosh, Thanks for reporting this. How are you creating/importing your hosted zone here? The integ test at https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/aws-ses/test/integ.email-identity.ts deploys successfully. |
OK, got it, I see the duplication in the record. |
Because `route53.determineFullyQualifiedDomainName()` doesn't correctly handles tokens we get the zone name twice here. Another way to solve this would be to fix `determineFullyQualifiedDomainName()`. There is already a discussion there aws#20435 for the hosted zone name part, not the record name. Closes aws#21306
I am also having this same issue. Thanks, @Booligoosh , for the work around! |
Because `route53.determineFullyQualifiedDomainName()` doesn't correctly handles tokens we get the zone name twice here. Another way to solve this would be to fix `determineFullyQualifiedDomainName()`. There is already a discussion there #20435 for the hosted zone name part, not the record name. Closes #21306 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Because `route53.determineFullyQualifiedDomainName()` doesn't correctly handles tokens we get the zone name twice here. Another way to solve this would be to fix `determineFullyQualifiedDomainName()`. There is already a discussion there aws#20435 for the hosted zone name part, not the record name. Closes aws#21306 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Thanks for the fix! Just a note for @derekmurawsky and anyone else that was using the workaround I mentioned in the original issue and is wanting to upgrade to the fixed version of CDK. When upgrading the version to get rid of the need for the workaround, we weren't able to do it all in 1 deployment, as the DKIM records created by the workaround got deleted, but did not get re-created by the now fixed EmailIdentity. We had to do the following:
|
Is it intended that if the On cdk version 2.72.1 |
@tqhoughton This is actually DNS level stuff. The . makes it an FQDN, otherwise it's assumed to be a sub record of the zone it's in. See: Basically, So changing this may make some level of sense to some users, but it would make this implementation "quirky" for the way DNS works under the hood. I would suggest we stick with the specs and maybe document it a bit better for folks that aren't as familiar with the nuances of DNS. |
Describe the bug
When creating a new
ses.EmailIdentity
construct, the names of the DKIM records that get created in Route53 are incorrect.Expected Behavior
If the DKIM record name is
x.y.example.com
, and the hosted zone isy.example.com
, the name of the record that gets set in Route53 should bex.y.example.com
Current Behavior
If the DKIM record name is
x.y.example.com
, and the hosted zone isy.example.com
, the name of the record that gets set in Route53 should isx.y.example.com.y.example.com
Reproduction Steps
Here is a simple reproduction case:
Possible Solution
The reason for the incorrect record names is because of the function here in the source code:.
aws-cdk/packages/@aws-cdk/aws-ses/lib/email-identity.ts
Lines 220 to 237 in ac32340
It calls
route53.CnameRecord
, which accepts a record name excluding the hosted zone suffix - eg. forx.y.example.com
where the hosted zone isy.example.com
, the record name should just bex
.However, it's passing in
dkimDnsTokenName1
etc, which according to the Cloudformation docs, is the entire host for the record, including the hosted zone.This means that
route53.CnameRecord
tried to append the hosted zone name onto the end of the record name which already includes the hosted zone name, leading to the duplication.This can be seen in a
cdk synth
:There are 2 fixes that I can think of:
CfnRecordSet
rather thanCnameRecord
- eg:CnameRecord
- by combiningcdk.Fn.select
andcdk.Fn.split
to remove the last part of the string. Here's how that would look:Additional Information/Context
No response
CDK CLI Version
2.29.0 (build 47d7ec4)
Framework Version
2.33.0
Node.js Version
v16.15.1
OS
MacOS
Language
Typescript
Language Version
No response
Other information
Workaround
For anyone else experiencing this issue - we've opted to go with the
CfnRecordSet
option as it's a bit simpler to see what's going on. Simply map through each of thedkimRecords
after creating theEmailIdentity
and create the correct records - note that this won't remove the incorrect ones unfortunately.Code below:
The text was updated successfully, but these errors were encountered: