@mavogel/awscdk-rootmail 0.0.257 → 0.0.259
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/README.md +87 -107
- package/docs/adrs/solution-design-domain-same-aws-account.md +23 -0
- package/docs/adrs/solution-design-external-dns-provider.md +43 -0
- package/integ-tests/create-e2e-cfn-stack.bash +6 -0
- package/integ-tests/delete-e2e-cfn-stack.bash +6 -0
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/RootmailIntegTestStack.assets.json +29 -29
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/RootmailIntegTestStack.template.json +306 -28
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/SetupTestIntegStackDefaultTestDeployAssert6EB6FF77.assets.json +2 -2
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/SetupTestIntegStackDefaultTestDeployAssert6EB6FF77.template.json +2 -2
- package/integ-tests/{integ.rootmail.ts.snapshot/asset.409d1db869dd0ed635bff94c855031afc92e9ac918a5d09651dd0b5316db1433 → integ.rootmail-custom-santa.ts.snapshot/asset.157ba1713f7224463b621261792d18081588ff306a9bc3f75e6c468fabbe1a60}/index.js +1 -1
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/{asset.aca912f8a6aebc5dfd423aff79785b8fd7488473a4cf93aaa7ad0e442b548787 → asset.4c079063901e6478dbb5ace19e3123641ebf0da2ab648ecf52079c5bec154196}/index.js +1 -1
- package/integ-tests/{integ.rootmail.ts.snapshot/asset.7144c5a47b3904b1aa4b27be73803a4b684f4ef765d9df8fa767779d37106254 → integ.rootmail-custom-santa.ts.snapshot/asset.78b64aaf9aebb4eacbdd42197be10e9d5894360a642f7dcf79aeb84bb3552377}/index.js +1 -1
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/{asset.f61472ea141af20f69ebb7a7718158fcb95d72410c0c2a2e72cc59b1822873fc → asset.7e8a681794eff5fda1841caa360113df5488ecf944055a69b8f1e5a687e269f5}/index.js +1 -1
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/{asset.11768574bbd12c5ed10f463a68797423c366b61535ebc1b14951661b92657fa5 → asset.9572b451243318765beb576ae7528096b3879783dbaab795c02c01d7f4e83438}/index.js +1 -1
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/{asset.5407280701b87b2f099edc3024ed41a8c3a392c678cd6cf144fd099626ebe66d → asset.9ac6d29f0cc4b20ec46e4c186d9a6f6448c7ea11b689e70a5dda69671a9d6848}/index.js +181 -181
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/{asset.9709438d0fbb508ea9bfee8683a274b4f9492f5e527eb28e0bd9e2bc96b9a08f → asset.be7d56b509650f7f97c406a745d8335992726086995e4cb4aaf50417ab40e803}/index.js +1 -1
- package/integ-tests/{integ.rootmail.ts.snapshot/asset.ad34b204b794bb6638b7af71a62693ffbfcee3c07bdbd90bbf9f8787036bc7c3 → integ.rootmail-custom-santa.ts.snapshot/asset.d2b520d86fd9d964c83dc0d5ce2e4456dbde5fa7ae0c791a71865cbdfe2fb855}/index.js +1 -1
- package/integ-tests/{integ.rootmail.ts.snapshot/asset.a0f9d47d625e1e17d1946bc138cc46c9b7ecb7136dc54cf26af266b0e30b4e15 → integ.rootmail-custom-santa.ts.snapshot/asset.f75274dd7677b6ef41f29d2dfc2c885b4f4e069d3fb8e67636bd89efd3f0fcad}/index.js +1 -1
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/integ.json +1 -1
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/manifest.json +38 -2
- package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/tree.json +165 -9
- package/integ-tests/integ.rootmail-filter-subject.ts.snapshot/RootmailIntegTestStack.assets.json +2 -2
- package/integ-tests/integ.rootmail-filter-subject.ts.snapshot/RootmailIntegTestStack.template.json +297 -19
- package/integ-tests/integ.rootmail-filter-subject.ts.snapshot/SetupTestIntegStackDefaultTestDeployAssert6EB6FF77.assets.json +2 -2
- package/integ-tests/integ.rootmail-filter-subject.ts.snapshot/SetupTestIntegStackDefaultTestDeployAssert6EB6FF77.template.json +2 -2
- package/integ-tests/integ.rootmail-filter-subject.ts.snapshot/manifest.json +38 -2
- package/integ-tests/integ.rootmail-filter-subject.ts.snapshot/tree.json +156 -0
- package/integ-tests/integ.rootmail.ts.snapshot/RootmailIntegTestStack.assets.json +32 -32
- package/integ-tests/integ.rootmail.ts.snapshot/RootmailIntegTestStack.template.json +307 -29
- package/integ-tests/integ.rootmail.ts.snapshot/SetupTestIntegStackDefaultTestDeployAssert6EB6FF77.assets.json +2 -2
- package/integ-tests/integ.rootmail.ts.snapshot/SetupTestIntegStackDefaultTestDeployAssert6EB6FF77.template.json +3 -3
- package/integ-tests/integ.rootmail.ts.snapshot/{asset.d25bfd59a60ba15d60c7d58fe66a9c9930044da8f0592ac451a8760bbbfa6460 → asset.070f758ea9c89b8ceea9bb5141ea511633e1d72ab992b608da4efb3d6eeb2ba5}/index.js +1 -1
- package/integ-tests/{integ.rootmail-custom-santa.ts.snapshot/asset.409d1db869dd0ed635bff94c855031afc92e9ac918a5d09651dd0b5316db1433 → integ.rootmail.ts.snapshot/asset.157ba1713f7224463b621261792d18081588ff306a9bc3f75e6c468fabbe1a60}/index.js +1 -1
- package/integ-tests/integ.rootmail.ts.snapshot/{asset.aca912f8a6aebc5dfd423aff79785b8fd7488473a4cf93aaa7ad0e442b548787 → asset.4c079063901e6478dbb5ace19e3123641ebf0da2ab648ecf52079c5bec154196}/index.js +1 -1
- package/integ-tests/{integ.rootmail-custom-santa.ts.snapshot/asset.7144c5a47b3904b1aa4b27be73803a4b684f4ef765d9df8fa767779d37106254 → integ.rootmail.ts.snapshot/asset.78b64aaf9aebb4eacbdd42197be10e9d5894360a642f7dcf79aeb84bb3552377}/index.js +1 -1
- package/integ-tests/integ.rootmail.ts.snapshot/{asset.f61472ea141af20f69ebb7a7718158fcb95d72410c0c2a2e72cc59b1822873fc → asset.7e8a681794eff5fda1841caa360113df5488ecf944055a69b8f1e5a687e269f5}/index.js +1 -1
- package/integ-tests/integ.rootmail.ts.snapshot/{asset.11768574bbd12c5ed10f463a68797423c366b61535ebc1b14951661b92657fa5 → asset.9572b451243318765beb576ae7528096b3879783dbaab795c02c01d7f4e83438}/index.js +1 -1
- package/integ-tests/integ.rootmail.ts.snapshot/{asset.b0a80de4302e54c024e3dd1233407ed7b1b3ab3bae801ce319e6d8660b2a8db3 → asset.adf960437fc6c552bee317e122c1e6839152590b199f7c44c0eee7bfbb744187}/index.js +181 -181
- package/integ-tests/integ.rootmail.ts.snapshot/{asset.9709438d0fbb508ea9bfee8683a274b4f9492f5e527eb28e0bd9e2bc96b9a08f → asset.be7d56b509650f7f97c406a745d8335992726086995e4cb4aaf50417ab40e803}/index.js +1 -1
- package/integ-tests/{integ.rootmail-custom-santa.ts.snapshot/asset.ad34b204b794bb6638b7af71a62693ffbfcee3c07bdbd90bbf9f8787036bc7c3 → integ.rootmail.ts.snapshot/asset.d2b520d86fd9d964c83dc0d5ce2e4456dbde5fa7ae0c791a71865cbdfe2fb855}/index.js +1 -1
- package/integ-tests/{integ.rootmail-custom-santa.ts.snapshot/asset.a0f9d47d625e1e17d1946bc138cc46c9b7ecb7136dc54cf26af266b0e30b4e15 → integ.rootmail.ts.snapshot/asset.f75274dd7677b6ef41f29d2dfc2c885b4f4e069d3fb8e67636bd89efd3f0fcad}/index.js +1 -1
- package/integ-tests/integ.rootmail.ts.snapshot/integ.json +1 -1
- package/integ-tests/integ.rootmail.ts.snapshot/manifest.json +38 -2
- package/integ-tests/integ.rootmail.ts.snapshot/tree.json +166 -10
- package/lib/hosted-zone-dkim-propagation.js +11 -12
- package/lib/hosted-zone-dkim-verification-records.js +4 -3
- package/lib/rootmail-autowire-dns.js +7 -3
- package/lib/rootmail.js +3 -2
- package/lib/ses-receipt-ruleset-activation.js +4 -4
- package/lib/ses-receive.js +1 -1
- package/package.json +1 -1
package/.jsii
CHANGED
|
@@ -3522,7 +3522,7 @@
|
|
|
3522
3522
|
},
|
|
3523
3523
|
"name": "@mavogel/awscdk-rootmail",
|
|
3524
3524
|
"readme": {
|
|
3525
|
-
"markdown": "# awscdk-rootmail\n\nA single rootmail box for all your AWS accounts. The cdk implementation and **adaption** of the [superwerker](https://superwerker.cloud/) rootmail feature. See [here](docs/adrs/rootmail.md) for a detailed Architectural Decision Record ([ADR](https://adr.github.io/))\n\n- [TL;DR](#tldr)\n- [Usage](#usage)\n - [Dependencies](#dependencies)\n - [Deploy](#deploy)\n - [CDK](#cdk)\n - [Cloudformation](#cloudformation)\n- [Solution design: Version 1 - Domain in the same AWS account](#solution-design-version-1---domain-in-the-same-aws-account)\n- [Solution design: Version 2 - external DNS provider](#solution-design-version-2---external-dns-provider)\n- [Uninstall](#uninstall)\n- [Known issues](#known-issues)\n- [Related projects](#related-projects)\n\n## TL;DR\nEach AWS account needs one unique email address (the so-called \"AWS account root user email address\").\n\nAccess to these email addresses must be adequately secured since they provide privileged access to AWS accounts, such as account deletion procedures.\n\nThis is why you only need 1 mailing list for the AWS Management (formerly *root*) account,\nwe recommend the following pattern `aws-roots+<uuid>@mycompany.test`\n\n> [!NOTE]\n> Maximum **64** characters are allowed for the whole address.\n\nAnd as you own the domain `mycompany.test` you can add a subdomain, e.g. `aws`, for which all EMails will then be received with this solution within this particular AWS Management account.\n\n## Usage\n### Dependencies\nAdministrative access to an AWS account and the following tools:\n```sh\nbrew install aws-cli node@18 esbuild\n```\n\n<details>\n <summary>... or a longer listing</summary>\n\n- Access to a development environment. It is recommended to use AWS Cloud9 to avoid having to set up the tools needed to deploy the solution. See [Getting started with AWS Cloud9](https://aws.amazon.com/cloud9/getting-started/).\n- Using Cloud9, all of the following have already been configured for you. If you choose not to use Cloud9, you will need to install the following.\n - AWS CLI. See [Installing, updating and uninstalling the AWS CLI version 2](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)\n - Set up the AWS CLI with IAM access credentials. See [Configuring the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)\n - Node.js version 10.13.0 or later\n - AWS CDK version 2.90.0 or later. For installation instructions see [Getting Started with the AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html#getting_started_install)\n - Docker version 20.10.x or later **OR** [esbuild](https://esbuild.github.io/)\n</details>\n\n### Deploy\nYou can chose via embedding the construct in your cdk-app or use is directly via Cloudformation.\n#### CDK\n1. To start a new project we recommend using [projen](https://projen.io/).\n 1. Create a new projen project\n ```sh\n npx projen new awscdk-app-ts\n ```\n 2. Add `@mavogel/awscdk-rootmail` as a dependency to your project in the `.projenrc.ts` file\n 3. Run `yarn run projen` to install it\n2. In you `main.ts` file add the following code\n```ts\nimport { Rootmail } from '@mavogel/awscdk-rootmail';\nimport {\n App,\n Stack,\n StackProps,\n aws_route53 as r53,\n} from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\n\nexport class MyStack extends Stack {\n constructor(scope: Construct, id: string, props: StackProps = {}) {\n super(scope, id, props);\n\n const domain = 'mycompany.com'\n\n const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {\n domainName: domain,\n });\n\n new Rootmail(this, 'rootmail', {\n // 1. a domain you own, registered via Route53 in the SAME account\n domain: domain,\n // 2. so the subdomain will be aws.mycompany.test and\n subdomain: 'aws',\n // 3. wired / delegated automatically to\n wireDNSToHostedZoneID: hostedZone.hostedZoneId,\n });\n }\n}\n```\n2. run on your commandline\n```sh\nyarn run deploy\n```\n1. No need to do anything, the NS records are **automatically** propagated as the parent Hosted Zone is in the same account!\n2. The `hosted-zone-dkim-propagation-provider.is-complete-handler` Lambda function checks every 10 seconds if the DNS for the subdomain is propagated. Details are in the Cloudwatch log group.\n\n### CDK with your own receiver function\nYou might also want to pass in you own function on what to do when an EMail is received\n\nfile `functions/custom-ses-receive-function.ts` which gets the 2 environment variables populated\n- `EMAIL_BUCKET`\n- `EMAIL_BUCKET_ARN`\n\nas well as `s3:GetObject` on the `RootMail/*` objects in the created Rootmail `S3` bucket.\n\n```ts\nimport { S3 } from '@aws-sdk/client-s3';\nimport { ParsedMail, simpleParser } from 'mailparser';\n// populated by default\nconst emailBucket = process.env.EMAIL_BUCKET;\nconst emailBucketArn = process.env.EMAIL_BUCKET_ARN;\nconst s3 = new S3();\n\n// SESEventRecordsToLambda\n// from https://docs.aws.amazon.com/ses/latest/dg/receiving-email-action-lambda-event.html\nexport const handler = async (event: SESEventRecordsToLambda) => {\n for (const record of event.Records) {\n\n const id = record.ses.mail.messageId;\n const key = `RootMail/${id}`;\n const response = await s3.getObject({ Bucket: emailBucket as string, Key: key });\n\n const msg: ParsedMail = await simpleParser(response.Body as unknown as Buffer);\n\n let title = msg.subject;\n console.log(`Title: ${title} from emailBucketArn: ${emailBucketArn}`);\n // use the content of the email body\n const body = msg.html;\n // add your custom code here ...\n\n // dummy example: list s3 buckets\n const buckets = await s3.listBuckets({});\n if (!buckets.Buckets) {\n console.log('No buckets found');\n return;\n }\n console.log('Buckets:');\n for (const bucket of buckets.Buckets || []) {\n console.log(bucket.Name);\n }\n }\n\n};\n```\nand you create a separate `NodejsFunction` as follows with the additionally needed IAM permissions:\n```ts\nconst customSesReceiveFunction = new NodejsFunction(stackUnderTest, 'custom-ses-receive-function', {\n functionName: PhysicalName.GENERATE_IF_NEEDED,\n entry: path.join(__dirname, 'functions', 'custom-ses-receive-function.ts'),\n runtime: lambda.Runtime.NODEJS_18_X,\n logRetention: 1,\n timeout: Duration.seconds(30),\n});\n\n// Note: any additional permissions you need to add to the function yourself!\ncustomSesReceiveFunction.addToRolePolicy(new iam.PolicyStatement({\n actions: [\n 's3:List*',\n ],\n resources: ['*'],\n}))\n```\nand then pass it into the `Rootmail` Stack\n```ts\nexport class MyStack extends Stack {\n constructor(scope: Construct, id: string, props: StackProps = {}) {\n super(scope, id, props);\n\n const domain = 'mycompany.test'\n const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {\n domainName: domain,\n });\n\n const rootmail = new Rootmail(this, 'rootmail-stack', {\n domain: domain;\n autowireDNSParentHostedZoneID: hostedZone.hostedZoneId,\n env: {\n region: 'eu-west-1',\n },\n customSesReceiveFunction: customSesReceiveFunction, // <- pass it in here\n });\n }\n}\n```\n\n#### Cloudformation\nor use it directly a Cloudformation template `yaml` from the URL [here](https://mvc-test4-bucket-eu-west-1.s3.eu-west-1.amazonaws.com/rootmail/0.0.13-DEVELOPMENT/rootmailStack.template.yaml).\n\n\n<details>\n <summary>... click to expand</summary>\n\nand fill out the parameters\n\n\n</details>\n\n## Solution design: Version 1 - Domain in the same AWS account\n\n\n1. You own a domain, e.g., `mycompany.test`, registered via `Route53` in the **same** AWS account.\n2. The stack creates a `Route53` public Hosted Zone for the subdomain, e.g., `aws.mycompany.test`. It also automatically adds the `TXT` and `CNAME` records for verifying the domain towards SES **and** adds the NS server entries automatically to the main domain `mycompany.test`.\n3. When the subdomain `aws.mycompany.test` is successfully propagated, the stack creates a verified Domain in AWS SES and adds a recipient rule for `root@aws.mycompany.test`. On a successful propagation you will get a mail as follows to the root Email address of the account you are installing the stack 👇\n\n4. Now, any mail going to `root+<any-string>@aws.mycompany.test` will be processed by OpsSanta 🎅🏽 Lambda function and also stored in the rootmail S3 bucket 🪣.\n5. The OpsSanta function verifies the verdicts (DKIM etc.) of the sender, also skips AWS Account welcome EMails, and processes all other EMails. If it is a password reset link EMail it stores the link in the parameter store (and does *not* create an OpsItem for now). For all other mails, which are not skipped an OpsItem is created to have a central location for all items.\n> [!NOTE]\n> You can also connect your Jira to the OpsCenter.\n6. The bucket where all mail to `root@aws.mycompany.test` are stored.\n7. The [SSM parameter store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html) for the password reset links.\n\n8. The OpsItem which is created. It is open and shall be further processed either in the OpsCenter or any other issue tracker.\n\n\n> [!NOTE]\n> SES support alias, so mail to `root+random-string@aws.mycompany.test` will also be catched and forwarded.\n\n## Solution design: Version 2 - external DNS provider\n<details>\n <summary>open for details</summary>\n\n\n\n```ts\nconst rootmail = new Rootmail(this, 'rootmail-stack', {\n // 1. a domain you own, registered via Route53 in the same account\n domain: 'mycompany.test';\n // 2. '' is the default, so you can also remove it\n // autowireDNSParentHostedZoneID: '',\n env: {\n // 3. or any other region SES is available\n region: 'eu-west-1',\n },\n});\n```\n\n1. You own a domain, e.g., `mycompany.test`. It can be at any registrar such as `godaddy`, also `Route53` itself in another AWS account.\n2. The stack creates a `Route53` public Hosted Zone for the subdomain, e.g., `aws.mycompany.test`. It also automatically adds the TXT and CNAME records (for DKIM etc.) for verifying the domain towards SES. **NOTE:** You must now add the NS server entries into the Domain provider which owns the main domain `mycompany.test`.\n3. items 3-7 are the same as in `v1`\n\n\n> [!NOTE]\n> After running `yarn run deploy` you need to do the following steps manually:\n\n1. watch out for the hosted zone `aws.mycompany.test` to be created\n By default you have **2 hours** to wire the DNS!\n2. Then create the NS record in your domain `mycompany.test` for the subdomain `aws.mycompany.test`. Here for Route53 in AWS:\n\n3. You can test it yourself via\n```sh\ndig +short NS 8.8.8.8 aws.mycompany.test\n# should return something like\nns-1111.your-dns-provider-10.org.\nns-2222.your-dns-provider-21.co.uk.\nns-33.your-dns-provider-04.com.\nns-444.your-dns-provider-12.net.\n```\nand also by sending an EMail, e.g. from Gmail to `root@aws.mycompany.test`\n\n</details>\n\n## Uninstall\n1. Delete the stack, the custom resources will delete most resources\n2. And by design you need to manually delete the S3 Bucket containing the mails. This is to prevent accidental deletion of the mails. You can find the bucket name in the stack output.\n\n3. Furthermore, the cloudwatch log groups are not deleted, since they might contain valuable information. You can delete them manually.\n\n## Known issues\n- [jsii/2071](https://github.com/aws/jsii/issues/2071): so adding `compilerOptions.\"esModuleInterop\": true,` in `tsconfig.json` is not possible. See aws-cdk usage with[typescript](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/#Usage_with_TypeScript). So we needed to change import from `import AWS from 'aws-sdk';` -> `import * as AWS from 'aws-sdk';` to be able to compile.\n\n## Related projects\n- [aws-account-factory-email](https://github.com/aws-samples/aws-account-factory-email): a similar approach with SES, however you need to manually configure it upfront and also it about delivering root mails for a specific account to a specific mailing list and mainly decouples the real email address from the one of the AWS account. The main difference is that we do not *hide* or decouple the email address, but more make those as unique and unguessable/bruteforable as possible (with `uuids`)."
|
|
3525
|
+
"markdown": "# awscdk-rootmail\n\nA single email box for all your root user emails in all AWS accounts of the organization.\n- The cdk implementation and **adaption** of the [superwerker](https://superwerker.cloud/) rootmail feature.\n- See [here](docs/adrs/rootmail.md) for a detailed Architectural Decision Record ([ADR](https://adr.github.io/))\n\n## TL;DR ⚡\nEach AWS account needs one unique email address (the so-called \"AWS account root user email address\").\n\nAccess to these email addresses must be adequately secured since they provide privileged access to AWS accounts, such as account deletion procedures.\n\nThis is why you only need 1 mailing list for the AWS Management (formerly *root*) account,\nwe recommend the following pattern `aws-roots+<uuid>@mycompany.test`\n\n> [!NOTE]\n> Maximum **64** characters are allowed for the whole address.\n\nAnd as you own the domain `mycompany.test` you can add a subdomain, e.g. `aws`, for which all EMails will then be received with this solution within this particular AWS Management account.\n\nFeel free to take a look at the design\n\n\n## Usage ✨\n\nInstall the dependencies:\n```sh\nbrew install aws-cli node@18 esbuild\n```\n\nYou can chose via embedding the construct in your cdk-app or use is directly via Cloudformation.\n### cdk 🤖\n1. To start a new project we recommend using [projen](https://projen.io/).\n 1. Create a new projen project\n ```sh\n npx projen new awscdk-app-ts\n ```\n 2. Add `@mavogel/awscdk-rootmail` as a dependency to your project in the `.projenrc.ts` file\n 3. Run `yarn run projen` to install it\n2. In you `main.ts` file add the following code\n```ts\nimport { Rootmail } from '@mavogel/awscdk-rootmail';\nimport {\n App,\n Stack,\n StackProps,\n aws_route53 as r53,\n} from 'aws-cdk-lib';\nimport { Construct } from 'constructs';\n\nexport class MyStack extends Stack {\n constructor(scope: Construct, id: string, props: StackProps = {}) {\n super(scope, id, props);\n\n const domain = 'mycompany.com' // registered via Route53 in the SAME account\n\n const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {\n domainName: domain,\n });\n\n new Rootmail(this, 'rootmail', {\n // 1. a domain you own, registered via Route53 in the SAME account\n domain: domain,\n // 2. so the subdomain will be aws.mycompany.test and\n subdomain: 'aws',\n // 3. wired / delegated automatically to\n wireDNSToHostedZoneID: hostedZone.hostedZoneId,\n });\n }\n}\n```\n2. run on your commandline\n```sh\nyarn run deploy\n```\n1. No need to do anything, the NS records are **automatically** propagated as the parent Hosted Zone is in the same account!\n2. The `hosted-zone-dkim-propagation-provider.is-complete-handler` Lambda function checks every 10 seconds if the DNS for the subdomain is propagated. Details are in the Cloudwatch log group.\n\n> [!TIP]\n> Take a look at the solution design [here](docs/adrs/solution-design-domain-same-aws-account.md) for more details.\n\n### cdk with your own receiver function 🏗️\nYou might also want to pass in you own function on what to do when an EMail is received\n\n> [!TIP]\n> You can add any custom code as receiver function you want.\n\n<details>\n <summary>... click here for the details</summary>\n\nfile `functions/custom-ses-receive-function.ts` which gets the 2 environment variables populated\n- `EMAIL_BUCKET`\n- `EMAIL_BUCKET_ARN`\n\nas well as `s3:GetObject` on the `RootMail/*` objects in the created Rootmail `S3` bucket.\n\n```ts\nimport { S3 } from '@aws-sdk/client-s3';\nimport { ParsedMail, simpleParser } from 'mailparser';\n// populated by default\nconst emailBucket = process.env.EMAIL_BUCKET;\nconst emailBucketArn = process.env.EMAIL_BUCKET_ARN;\nconst s3 = new S3();\n\n// SESEventRecordsToLambda\n// from https://docs.aws.amazon.com/ses/latest/dg/receiving-email-action-lambda-event.html\nexport const handler = async (event: SESEventRecordsToLambda) => {\n for (const record of event.Records) {\n\n const id = record.ses.mail.messageId;\n const key = `RootMail/${id}`;\n const response = await s3.getObject({ Bucket: emailBucket as string, Key: key });\n\n const msg: ParsedMail = await simpleParser(response.Body as unknown as Buffer);\n\n let title = msg.subject;\n console.log(`Title: ${title} from emailBucketArn: ${emailBucketArn}`);\n // use the content of the email body\n const body = msg.html;\n // add your custom code here ...\n\n // dummy example: list s3 buckets\n const buckets = await s3.listBuckets({});\n if (!buckets.Buckets) {\n console.log('No buckets found');\n return;\n }\n console.log('Buckets:');\n for (const bucket of buckets.Buckets || []) {\n console.log(bucket.Name);\n }\n }\n\n};\n```\nand you create a separate `NodejsFunction` as follows with the additionally needed IAM permissions:\n```ts\nconst customSesReceiveFunction = new NodejsFunction(stackUnderTest, 'custom-ses-receive-function', {\n functionName: PhysicalName.GENERATE_IF_NEEDED,\n entry: path.join(__dirname, 'functions', 'custom-ses-receive-function.ts'),\n runtime: lambda.Runtime.NODEJS_18_X,\n logRetention: 1,\n timeout: Duration.seconds(30),\n});\n\n// Note: any additional permissions you need to add to the function yourself!\ncustomSesReceiveFunction.addToRolePolicy(new iam.PolicyStatement({\n actions: [\n 's3:List*',\n ],\n resources: ['*'],\n}))\n```\nand then pass it into the `Rootmail` Stack\n```ts\nexport class MyStack extends Stack {\n constructor(scope: Construct, id: string, props: StackProps = {}) {\n super(scope, id, props);\n\n const domain = 'mycompany.test'\n const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {\n domainName: domain,\n });\n\n const rootmail = new Rootmail(this, 'rootmail-stack', {\n domain: domain;\n autowireDNSParentHostedZoneID: hostedZone.hostedZoneId,\n env: {\n region: 'eu-west-1',\n },\n customSesReceiveFunction: customSesReceiveFunction, // <- pass it in here\n });\n }\n}\n```\n\n\n> [!TIP]\n> Take a look at the solution design for external DNS [here](docs/adrs/solution-design-external-dns-provider.md) for more details.\n\n</details>\n\n### Cloudformation 📦\nor use it directly a Cloudformation template `yaml` from the URL [here](https://mvc-prod-releases.s3.eu-central-1.amazonaws.com/rootmail/v0.0.258/awscdk-rootmail.template.yaml).\n\n\n<details>\n <summary>... click here for the details</summary>\n\nand fill out the parameters\n\n\n</details>\n\n\n## Known issues\n- [jsii/2071](https://github.com/aws/jsii/issues/2071): so adding `compilerOptions.\"esModuleInterop\": true,` in `tsconfig.json` is not possible. See aws-cdk usage with[typescript](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/#Usage_with_TypeScript). So we needed to change import from `import AWS from 'aws-sdk';` -> `import * as AWS from 'aws-sdk';` to be able to compile.\n\n## Related projects / questions\n- [aws-account-factory-email](https://github.com/aws-samples/aws-account-factory-email): a similar approach with SES, however you need to manually configure it upfront and also it about delivering root mails for a specific account to a specific mailing list and mainly decouples the real email address from the one of the AWS account. The main difference is that we do not *hide* or decouple the email address, but more make those as unique and unguessable/bruteforable as possible (with `uuids`).\n- The question `Is it best practise to use a shared mailbox as AWS root user address?` from [stackoverflow](https://stackoverflow.com/questions/76739635/is-it-best-practise-to-use-a-shared-mailbox-as-aws-root-user-address): yes of course you can also use `root+alias-1@mycompany.com` and `root+alias-2@mycompany.com` etc. for your\nroot EMail boxes.\n\n## Unlock the full potention of your infrastructure - Partner with us!\n\n> [!TIP]\n> Bring your AWS Infrastructure with [MV Consulting](https://manuel-vogel.de/) to the next level. We ship well-architected, resilient, and cost-optimized AWS solutions designed to scale using Infrastructure as Code (IaC), tailoring cloud-native systems for businesses of all sizes.\n>\n> Our Approach:\n>\n> - **Tailored AWS Solutions**: Custom-built for your unique business needs\n> - **Future-Proof Architecture**: Scalable designs that grow with you\n> - **Empowerment Through Ownership**: Your vision, your infrastructure, our expertise\n>\n> Why Choose Us:\n> - 7+ Years of AWS Experience\n> - 12x AWS Certified, including DevOps Engineer & Solutions Architect Professional\n> - Proven Track Record and Testimonials\n>\n> Ready to elevate your AWS CDK Infrastructure?\n>\n> <a href=\"https://manuel-vogel.de/contact\"><img alt=\"Schedule your call\" src=\"https://img.shields.io/badge/schedule%20your%20call-success.svg?style=for-the-badge\"/></a>\n> <details><summary>☁️ <strong>Discover more about my one-person business: MV Consulting</strong></summary>\n>\n> <br/>\n>\n> Hi, I'm Manuel – AWS expert and founder of [MV Consulting](https://manuel-vogel.de). With over a decade of hands-on experience, I specialized myself in deploying well-architected, highly scalable and cost-effective AWS Solutions using Infrastructure as Code (IaC).\n>\n> #### When you work with me, you're getting a package deal of expertise and personalized service:\n>\n> - **AWS CDK Proficiency**: I bring deep AWS CDK knowledge to the table, ensuring your infrastructure is not just maintainable and scalable, but also fully automated.\n> - **AWS Certified**: [Equipped with 12 AWS Certifications](https://www.credly.com/users/manuel-vogel/badges), including DevOps Engineer & Solutions Architect Professional, to ensure best practices across diverse cloud scenarios.\n> - **Direct Access**: You work with me, not a team of managers. Expect quick decisions and high-quality work.\n> - **Tailored Solutions**: Understanding that no two businesses are alike, I Custom-fit cloud infrastructure for your unique needs.\n> - **Cost-Effective**: I'll optimize your AWS spending without cutting corners on performance or security.\n> - **Seamless CI/CD**: I'll set up smooth CI/CD processes using GitHub Actions, making changes a breeze through Pull Requests.\n>\n> *My mission is simple: I'll free you from infrastructure headaches so you can focus on what truly matters – your core business.*\n>\n> Ready to unlock the full potential of AWS Cloud?\n>\n> <a href=\"https://manuel-vogel.de/contact\"><img alt=\"Schedule your call\" src=\"https://img.shields.io/badge/schedule%20your%20call-success.svg?style=for-the-badge\"/></a>\n> </details>\n\n## Acknowledgements\n\nBig thank you to the creators of [projen](https://github.com/projen/projen). This project stands on the shoulders of giants, made possible by their pioneering work in simplifying cloud infrastructure projects!\n\n## Author\n\n[Manuel Vogel](https://manuel-vogel.de/about/)\n\n[](https://www.linkedin.com/in/manuel-vogel)\n[](https://github.com/mavogel)"
|
|
3526
3526
|
},
|
|
3527
3527
|
"repository": {
|
|
3528
3528
|
"type": "git",
|
|
@@ -3942,6 +3942,6 @@
|
|
|
3942
3942
|
"symbolId": "src/ses-receive:SESReceiveProps"
|
|
3943
3943
|
}
|
|
3944
3944
|
},
|
|
3945
|
-
"version": "0.0.
|
|
3946
|
-
"fingerprint": "
|
|
3945
|
+
"version": "0.0.259",
|
|
3946
|
+
"fingerprint": "8Tr//OORRL/Kx1ugffBRN9ML4iJbIXn92RKXINUG2u0="
|
|
3947
3947
|
}
|
package/README.md
CHANGED
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
# awscdk-rootmail
|
|
2
2
|
|
|
3
|
-
A single
|
|
4
|
-
|
|
5
|
-
- [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
- [Deploy](#deploy)
|
|
9
|
-
- [CDK](#cdk)
|
|
10
|
-
- [Cloudformation](#cloudformation)
|
|
11
|
-
- [Solution design: Version 1 - Domain in the same AWS account](#solution-design-version-1---domain-in-the-same-aws-account)
|
|
12
|
-
- [Solution design: Version 2 - external DNS provider](#solution-design-version-2---external-dns-provider)
|
|
13
|
-
- [Uninstall](#uninstall)
|
|
14
|
-
- [Known issues](#known-issues)
|
|
15
|
-
- [Related projects](#related-projects)
|
|
16
|
-
|
|
17
|
-
## TL;DR
|
|
3
|
+
A single email box for all your root user emails in all AWS accounts of the organization.
|
|
4
|
+
- The cdk implementation and **adaption** of the [superwerker](https://superwerker.cloud/) rootmail feature.
|
|
5
|
+
- See [here](docs/adrs/rootmail.md) for a detailed Architectural Decision Record ([ADR](https://adr.github.io/))
|
|
6
|
+
|
|
7
|
+
## TL;DR ⚡
|
|
18
8
|
Each AWS account needs one unique email address (the so-called "AWS account root user email address").
|
|
19
9
|
|
|
20
10
|
Access to these email addresses must be adequately secured since they provide privileged access to AWS accounts, such as account deletion procedures.
|
|
@@ -27,28 +17,18 @@ we recommend the following pattern `aws-roots+<uuid>@mycompany.test`
|
|
|
27
17
|
|
|
28
18
|
And as you own the domain `mycompany.test` you can add a subdomain, e.g. `aws`, for which all EMails will then be received with this solution within this particular AWS Management account.
|
|
29
19
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
20
|
+
Feel free to take a look at the design
|
|
21
|
+

|
|
22
|
+
|
|
23
|
+
## Usage ✨
|
|
24
|
+
|
|
25
|
+
Install the dependencies:
|
|
33
26
|
```sh
|
|
34
27
|
brew install aws-cli node@18 esbuild
|
|
35
28
|
```
|
|
36
29
|
|
|
37
|
-
<details>
|
|
38
|
-
<summary>... or a longer listing</summary>
|
|
39
|
-
|
|
40
|
-
- Access to a development environment. It is recommended to use AWS Cloud9 to avoid having to set up the tools needed to deploy the solution. See [Getting started with AWS Cloud9](https://aws.amazon.com/cloud9/getting-started/).
|
|
41
|
-
- Using Cloud9, all of the following have already been configured for you. If you choose not to use Cloud9, you will need to install the following.
|
|
42
|
-
- AWS CLI. See [Installing, updating and uninstalling the AWS CLI version 2](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html)
|
|
43
|
-
- Set up the AWS CLI with IAM access credentials. See [Configuring the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)
|
|
44
|
-
- Node.js version 10.13.0 or later
|
|
45
|
-
- AWS CDK version 2.90.0 or later. For installation instructions see [Getting Started with the AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html#getting_started_install)
|
|
46
|
-
- Docker version 20.10.x or later **OR** [esbuild](https://esbuild.github.io/)
|
|
47
|
-
</details>
|
|
48
|
-
|
|
49
|
-
### Deploy
|
|
50
30
|
You can chose via embedding the construct in your cdk-app or use is directly via Cloudformation.
|
|
51
|
-
|
|
31
|
+
### cdk 🤖
|
|
52
32
|
1. To start a new project we recommend using [projen](https://projen.io/).
|
|
53
33
|
1. Create a new projen project
|
|
54
34
|
```sh
|
|
@@ -71,7 +51,7 @@ export class MyStack extends Stack {
|
|
|
71
51
|
constructor(scope: Construct, id: string, props: StackProps = {}) {
|
|
72
52
|
super(scope, id, props);
|
|
73
53
|
|
|
74
|
-
const domain = 'mycompany.com'
|
|
54
|
+
const domain = 'mycompany.com' // registered via Route53 in the SAME account
|
|
75
55
|
|
|
76
56
|
const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {
|
|
77
57
|
domainName: domain,
|
|
@@ -95,9 +75,18 @@ yarn run deploy
|
|
|
95
75
|
1. No need to do anything, the NS records are **automatically** propagated as the parent Hosted Zone is in the same account!
|
|
96
76
|
2. The `hosted-zone-dkim-propagation-provider.is-complete-handler` Lambda function checks every 10 seconds if the DNS for the subdomain is propagated. Details are in the Cloudwatch log group.
|
|
97
77
|
|
|
98
|
-
|
|
78
|
+
> [!TIP]
|
|
79
|
+
> Take a look at the solution design [here](docs/adrs/solution-design-domain-same-aws-account.md) for more details.
|
|
80
|
+
|
|
81
|
+
### cdk with your own receiver function 🏗️
|
|
99
82
|
You might also want to pass in you own function on what to do when an EMail is received
|
|
100
83
|
|
|
84
|
+
> [!TIP]
|
|
85
|
+
> You can add any custom code as receiver function you want.
|
|
86
|
+
|
|
87
|
+
<details>
|
|
88
|
+
<summary>... click here for the details</summary>
|
|
89
|
+
|
|
101
90
|
file `functions/custom-ses-receive-function.ts` which gets the 2 environment variables populated
|
|
102
91
|
- `EMAIL_BUCKET`
|
|
103
92
|
- `EMAIL_BUCKET_ARN`
|
|
@@ -184,90 +173,81 @@ export class MyStack extends Stack {
|
|
|
184
173
|
}
|
|
185
174
|
```
|
|
186
175
|
|
|
187
|
-
#### Cloudformation
|
|
188
|
-
or use it directly a Cloudformation template `yaml` from the URL [here](https://mvc-test4-bucket-eu-west-1.s3.eu-west-1.amazonaws.com/rootmail/0.0.13-DEVELOPMENT/rootmailStack.template.yaml).
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
<details>
|
|
192
|
-
<summary>... click to expand</summary>
|
|
193
176
|
|
|
194
|
-
|
|
195
|
-
|
|
177
|
+
> [!TIP]
|
|
178
|
+
> Take a look at the solution design for external DNS [here](docs/adrs/solution-design-external-dns-provider.md) for more details.
|
|
196
179
|
|
|
197
180
|
</details>
|
|
198
181
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
1. You own a domain, e.g., `mycompany.test`, registered via `Route53` in the **same** AWS account.
|
|
203
|
-
2. The stack creates a `Route53` public Hosted Zone for the subdomain, e.g., `aws.mycompany.test`. It also automatically adds the `TXT` and `CNAME` records for verifying the domain towards SES **and** adds the NS server entries automatically to the main domain `mycompany.test`.
|
|
204
|
-
3. When the subdomain `aws.mycompany.test` is successfully propagated, the stack creates a verified Domain in AWS SES and adds a recipient rule for `root@aws.mycompany.test`. On a successful propagation you will get a mail as follows to the root Email address of the account you are installing the stack 👇
|
|
205
|
-

|
|
206
|
-
4. Now, any mail going to `root+<any-string>@aws.mycompany.test` will be processed by OpsSanta 🎅🏽 Lambda function and also stored in the rootmail S3 bucket 🪣.
|
|
207
|
-
5. The OpsSanta function verifies the verdicts (DKIM etc.) of the sender, also skips AWS Account welcome EMails, and processes all other EMails. If it is a password reset link EMail it stores the link in the parameter store (and does *not* create an OpsItem for now). For all other mails, which are not skipped an OpsItem is created to have a central location for all items.
|
|
208
|
-
> [!NOTE]
|
|
209
|
-
> You can also connect your Jira to the OpsCenter.
|
|
210
|
-
6. The bucket where all mail to `root@aws.mycompany.test` are stored.
|
|
211
|
-
7. The [SSM parameter store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html) for the password reset links.
|
|
212
|
-

|
|
213
|
-
8. The OpsItem which is created. It is open and shall be further processed either in the OpsCenter or any other issue tracker.
|
|
214
|
-

|
|
182
|
+
### Cloudformation 📦
|
|
183
|
+
or use it directly a Cloudformation template `yaml` from the URL [here](https://mvc-prod-releases.s3.eu-central-1.amazonaws.com/rootmail/v0.0.258/awscdk-rootmail.template.yaml).
|
|
215
184
|
|
|
216
|
-
> [!NOTE]
|
|
217
|
-
> SES support alias, so mail to `root+random-string@aws.mycompany.test` will also be catched and forwarded.
|
|
218
185
|
|
|
219
|
-
## Solution design: Version 2 - external DNS provider
|
|
220
186
|
<details>
|
|
221
|
-
<summary
|
|
222
|
-
|
|
223
|
-

|
|
224
|
-
|
|
225
|
-
```ts
|
|
226
|
-
const rootmail = new Rootmail(this, 'rootmail-stack', {
|
|
227
|
-
// 1. a domain you own, registered via Route53 in the same account
|
|
228
|
-
domain: 'mycompany.test';
|
|
229
|
-
// 2. '' is the default, so you can also remove it
|
|
230
|
-
// autowireDNSParentHostedZoneID: '',
|
|
231
|
-
env: {
|
|
232
|
-
// 3. or any other region SES is available
|
|
233
|
-
region: 'eu-west-1',
|
|
234
|
-
},
|
|
235
|
-
});
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
1. You own a domain, e.g., `mycompany.test`. It can be at any registrar such as `godaddy`, also `Route53` itself in another AWS account.
|
|
239
|
-
2. The stack creates a `Route53` public Hosted Zone for the subdomain, e.g., `aws.mycompany.test`. It also automatically adds the TXT and CNAME records (for DKIM etc.) for verifying the domain towards SES. **NOTE:** You must now add the NS server entries into the Domain provider which owns the main domain `mycompany.test`.
|
|
240
|
-
3. items 3-7 are the same as in `v1`
|
|
187
|
+
<summary>... click here for the details</summary>
|
|
241
188
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
> After running `yarn run deploy` you need to do the following steps manually:
|
|
245
|
-
|
|
246
|
-
1. watch out for the hosted zone `aws.mycompany.test` to be created
|
|
247
|
-
 By default you have **2 hours** to wire the DNS!
|
|
248
|
-
2. Then create the NS record in your domain `mycompany.test` for the subdomain `aws.mycompany.test`. Here for Route53 in AWS:
|
|
249
|
-

|
|
250
|
-
3. You can test it yourself via
|
|
251
|
-
```sh
|
|
252
|
-
dig +short NS 8.8.8.8 aws.mycompany.test
|
|
253
|
-
# should return something like
|
|
254
|
-
ns-1111.your-dns-provider-10.org.
|
|
255
|
-
ns-2222.your-dns-provider-21.co.uk.
|
|
256
|
-
ns-33.your-dns-provider-04.com.
|
|
257
|
-
ns-444.your-dns-provider-12.net.
|
|
258
|
-
```
|
|
259
|
-
and also by sending an EMail, e.g. from Gmail to `root@aws.mycompany.test`
|
|
189
|
+
and fill out the parameters
|
|
190
|
+

|
|
260
191
|
|
|
261
192
|
</details>
|
|
262
193
|
|
|
263
|
-
|
|
264
|
-
1. Delete the stack, the custom resources will delete most resources
|
|
265
|
-
2. And by design you need to manually delete the S3 Bucket containing the mails. This is to prevent accidental deletion of the mails. You can find the bucket name in the stack output.
|
|
266
|
-

|
|
267
|
-
3. Furthermore, the cloudwatch log groups are not deleted, since they might contain valuable information. You can delete them manually.
|
|
268
|
-

|
|
194
|
+
|
|
269
195
|
## Known issues
|
|
270
196
|
- [jsii/2071](https://github.com/aws/jsii/issues/2071): so adding `compilerOptions."esModuleInterop": true,` in `tsconfig.json` is not possible. See aws-cdk usage with[typescript](https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/#Usage_with_TypeScript). So we needed to change import from `import AWS from 'aws-sdk';` -> `import * as AWS from 'aws-sdk';` to be able to compile.
|
|
271
197
|
|
|
272
|
-
## Related projects
|
|
273
|
-
- [aws-account-factory-email](https://github.com/aws-samples/aws-account-factory-email): a similar approach with SES, however you need to manually configure it upfront and also it about delivering root mails for a specific account to a specific mailing list and mainly decouples the real email address from the one of the AWS account. The main difference is that we do not *hide* or decouple the email address, but more make those as unique and unguessable/bruteforable as possible (with `uuids`).
|
|
198
|
+
## Related projects / questions
|
|
199
|
+
- [aws-account-factory-email](https://github.com/aws-samples/aws-account-factory-email): a similar approach with SES, however you need to manually configure it upfront and also it about delivering root mails for a specific account to a specific mailing list and mainly decouples the real email address from the one of the AWS account. The main difference is that we do not *hide* or decouple the email address, but more make those as unique and unguessable/bruteforable as possible (with `uuids`).
|
|
200
|
+
- The question `Is it best practise to use a shared mailbox as AWS root user address?` from [stackoverflow](https://stackoverflow.com/questions/76739635/is-it-best-practise-to-use-a-shared-mailbox-as-aws-root-user-address): yes of course you can also use `root+alias-1@mycompany.com` and `root+alias-2@mycompany.com` etc. for your
|
|
201
|
+
root EMail boxes.
|
|
202
|
+
|
|
203
|
+
## Unlock the full potention of your infrastructure - Partner with us!
|
|
204
|
+
|
|
205
|
+
> [!TIP]
|
|
206
|
+
> Bring your AWS Infrastructure with [MV Consulting](https://manuel-vogel.de/) to the next level. We ship well-architected, resilient, and cost-optimized AWS solutions designed to scale using Infrastructure as Code (IaC), tailoring cloud-native systems for businesses of all sizes.
|
|
207
|
+
>
|
|
208
|
+
> Our Approach:
|
|
209
|
+
>
|
|
210
|
+
> - **Tailored AWS Solutions**: Custom-built for your unique business needs
|
|
211
|
+
> - **Future-Proof Architecture**: Scalable designs that grow with you
|
|
212
|
+
> - **Empowerment Through Ownership**: Your vision, your infrastructure, our expertise
|
|
213
|
+
>
|
|
214
|
+
> Why Choose Us:
|
|
215
|
+
> - 7+ Years of AWS Experience
|
|
216
|
+
> - 12x AWS Certified, including DevOps Engineer & Solutions Architect Professional
|
|
217
|
+
> - Proven Track Record and Testimonials
|
|
218
|
+
>
|
|
219
|
+
> Ready to elevate your AWS CDK Infrastructure?
|
|
220
|
+
>
|
|
221
|
+
> <a href="https://manuel-vogel.de/contact"><img alt="Schedule your call" src="https://img.shields.io/badge/schedule%20your%20call-success.svg?style=for-the-badge"/></a>
|
|
222
|
+
> <details><summary>☁️ <strong>Discover more about my one-person business: MV Consulting</strong></summary>
|
|
223
|
+
>
|
|
224
|
+
> <br/>
|
|
225
|
+
>
|
|
226
|
+
> Hi, I'm Manuel – AWS expert and founder of [MV Consulting](https://manuel-vogel.de). With over a decade of hands-on experience, I specialized myself in deploying well-architected, highly scalable and cost-effective AWS Solutions using Infrastructure as Code (IaC).
|
|
227
|
+
>
|
|
228
|
+
> #### When you work with me, you're getting a package deal of expertise and personalized service:
|
|
229
|
+
>
|
|
230
|
+
> - **AWS CDK Proficiency**: I bring deep AWS CDK knowledge to the table, ensuring your infrastructure is not just maintainable and scalable, but also fully automated.
|
|
231
|
+
> - **AWS Certified**: [Equipped with 12 AWS Certifications](https://www.credly.com/users/manuel-vogel/badges), including DevOps Engineer & Solutions Architect Professional, to ensure best practices across diverse cloud scenarios.
|
|
232
|
+
> - **Direct Access**: You work with me, not a team of managers. Expect quick decisions and high-quality work.
|
|
233
|
+
> - **Tailored Solutions**: Understanding that no two businesses are alike, I Custom-fit cloud infrastructure for your unique needs.
|
|
234
|
+
> - **Cost-Effective**: I'll optimize your AWS spending without cutting corners on performance or security.
|
|
235
|
+
> - **Seamless CI/CD**: I'll set up smooth CI/CD processes using GitHub Actions, making changes a breeze through Pull Requests.
|
|
236
|
+
>
|
|
237
|
+
> *My mission is simple: I'll free you from infrastructure headaches so you can focus on what truly matters – your core business.*
|
|
238
|
+
>
|
|
239
|
+
> Ready to unlock the full potential of AWS Cloud?
|
|
240
|
+
>
|
|
241
|
+
> <a href="https://manuel-vogel.de/contact"><img alt="Schedule your call" src="https://img.shields.io/badge/schedule%20your%20call-success.svg?style=for-the-badge"/></a>
|
|
242
|
+
> </details>
|
|
243
|
+
|
|
244
|
+
## Acknowledgements
|
|
245
|
+
|
|
246
|
+
Big thank you to the creators of [projen](https://github.com/projen/projen). This project stands on the shoulders of giants, made possible by their pioneering work in simplifying cloud infrastructure projects!
|
|
247
|
+
|
|
248
|
+
## Author
|
|
249
|
+
|
|
250
|
+
[Manuel Vogel](https://manuel-vogel.de/about/)
|
|
251
|
+
|
|
252
|
+
[](https://www.linkedin.com/in/manuel-vogel)
|
|
253
|
+
[](https://github.com/mavogel)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Solution design - Domain in the same AWS account
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## Steps
|
|
7
|
+
|
|
8
|
+
1. You own a domain, e.g., `mycompany.test`, registered via `Route53` in the **same** AWS account.
|
|
9
|
+
2. The stack creates a `Route53` public Hosted Zone for the subdomain, e.g., `aws.mycompany.test`. It also automatically adds the `TXT` and `CNAME` records for verifying the domain towards SES **and** adds the NS server entries automatically to the main domain `mycompany.test`.
|
|
10
|
+
3. When the subdomain `aws.mycompany.test` is successfully propagated, the stack creates a verified Domain in AWS SES and adds a recipient rule for `root@aws.mycompany.test`. On a successful propagation you will get a mail as follows to the root Email address of the account you are installing the stack 👇
|
|
11
|
+

|
|
12
|
+
4. Now, any mail going to `root+<any-string>@aws.mycompany.test` will be processed by OpsSanta 🎅🏽 Lambda function and also stored in the rootmail S3 bucket 🪣.
|
|
13
|
+
5. The OpsSanta function verifies the verdicts (DKIM etc.) of the sender, also skips AWS Account welcome EMails, and processes all other EMails. If it is a password reset link EMail it stores the link in the parameter store (and does *not* create an OpsItem for now). For all other mails, which are not skipped an OpsItem is created to have a central location for all items.
|
|
14
|
+
> [!NOTE]
|
|
15
|
+
> You can also connect your Jira to the OpsCenter.
|
|
16
|
+
6. The bucket where all mail to `root@aws.mycompany.test` are stored.
|
|
17
|
+
7. The [SSM parameter store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html) for the password reset links.
|
|
18
|
+

|
|
19
|
+
8. The OpsItem which is created. It is open and shall be further processed either in the OpsCenter or any other issue tracker.
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
> [!NOTE]
|
|
23
|
+
> SES support alias, so mail to `root+random-string@aws.mycompany.test` will also be catched and forwarded.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Solution design: external DNS provider
|
|
2
|
+
|
|
3
|
+
## Design
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## Steps for implementation
|
|
7
|
+
```ts
|
|
8
|
+
const rootmail = new Rootmail(this, 'rootmail-stack', {
|
|
9
|
+
// 1. a domain you own, registered via Route53 in the same account
|
|
10
|
+
domain: 'mycompany.test';
|
|
11
|
+
// 2. '' is the default, so you can also remove it
|
|
12
|
+
// autowireDNSParentHostedZoneID: '',
|
|
13
|
+
env: {
|
|
14
|
+
// 3. or any other region SES is available
|
|
15
|
+
region: 'eu-west-1',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
1. You own a domain, e.g., `mycompany.test`. It can be at any registrar such as `godaddy`, also `Route53` itself in another AWS account.
|
|
21
|
+
2. The stack creates a `Route53` public Hosted Zone for the subdomain, e.g., `aws.mycompany.test`. It also automatically adds the TXT and CNAME records (for DKIM etc.) for verifying the domain towards SES. **NOTE:** You must now add the NS server entries into the Domain provider which owns the main domain `mycompany.test`.
|
|
22
|
+
3. items 3-7 are the same as in `v1`
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
> [!NOTE]
|
|
26
|
+
> After running `yarn run deploy` you need to do the following steps manually:
|
|
27
|
+
|
|
28
|
+
1. watch out for the hosted zone `aws.mycompany.test` to be created
|
|
29
|
+
 By default you have **2 hours** to wire the DNS!
|
|
30
|
+
2. Then create the NS record in your domain `mycompany.test` for the subdomain `aws.mycompany.test`. Here for Route53 in AWS:
|
|
31
|
+

|
|
32
|
+
3. You can test it yourself via
|
|
33
|
+
```sh
|
|
34
|
+
dig +short NS 8.8.8.8 aws.mycompany.test
|
|
35
|
+
# should return something like
|
|
36
|
+
ns-1111.your-dns-provider-10.org.
|
|
37
|
+
ns-2222.your-dns-provider-21.co.uk.
|
|
38
|
+
ns-33.your-dns-provider-04.com.
|
|
39
|
+
ns-444.your-dns-provider-12.net.
|
|
40
|
+
```
|
|
41
|
+
and also by sending an EMail, e.g. from Gmail to `root@aws.mycompany.test`
|
|
42
|
+
|
|
43
|
+
</details>
|
|
@@ -31,5 +31,11 @@ while [[ ! "$STACK_STATUS" == *"_FAILED" ]] && [[ ! "$STACK_STATUS" == *"_COMPLE
|
|
|
31
31
|
fi
|
|
32
32
|
done
|
|
33
33
|
|
|
34
|
+
# check if CREATE_FAILED
|
|
35
|
+
if [[ "$STACK_STATUS" == *"_FAILED" ]]; then
|
|
36
|
+
echo "Stack creation failed."
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
34
40
|
echo "Stack creation successful. Sleep for 5 seconds."
|
|
35
41
|
sleep 5
|
|
@@ -23,4 +23,10 @@ while [[ ! "$STACK_STATUS" == *"_FAILED" ]] && [[ ! "$STACK_STATUS" == *"_COMPLE
|
|
|
23
23
|
fi
|
|
24
24
|
done
|
|
25
25
|
|
|
26
|
+
# check for CREATE_FAILED
|
|
27
|
+
if [[ "$STACK_STATUS" == *"_FAILED" ]]; then
|
|
28
|
+
echo "Stack deletion failed."
|
|
29
|
+
exit 1
|
|
30
|
+
fi
|
|
31
|
+
|
|
26
32
|
echo "E2E test for CloudFormation template finished."
|
package/integ-tests/integ.rootmail-custom-santa.ts.snapshot/RootmailIntegTestStack.assets.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "33.0.0",
|
|
3
3
|
"files": {
|
|
4
|
-
"
|
|
4
|
+
"9ac6d29f0cc4b20ec46e4c186d9a6f6448c7ea11b689e70a5dda69671a9d6848": {
|
|
5
5
|
"source": {
|
|
6
|
-
"path": "asset.
|
|
6
|
+
"path": "asset.9ac6d29f0cc4b20ec46e4c186d9a6f6448c7ea11b689e70a5dda69671a9d6848",
|
|
7
7
|
"packaging": "zip"
|
|
8
8
|
},
|
|
9
9
|
"destinations": {
|
|
10
10
|
"current_account-current_region": {
|
|
11
11
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
12
|
-
"objectKey": "
|
|
12
|
+
"objectKey": "9ac6d29f0cc4b20ec46e4c186d9a6f6448c7ea11b689e70a5dda69671a9d6848.zip",
|
|
13
13
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
@@ -27,15 +27,15 @@
|
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
"
|
|
30
|
+
"f75274dd7677b6ef41f29d2dfc2c885b4f4e069d3fb8e67636bd89efd3f0fcad": {
|
|
31
31
|
"source": {
|
|
32
|
-
"path": "asset.
|
|
32
|
+
"path": "asset.f75274dd7677b6ef41f29d2dfc2c885b4f4e069d3fb8e67636bd89efd3f0fcad",
|
|
33
33
|
"packaging": "zip"
|
|
34
34
|
},
|
|
35
35
|
"destinations": {
|
|
36
36
|
"current_account-current_region": {
|
|
37
37
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
38
|
-
"objectKey": "
|
|
38
|
+
"objectKey": "f75274dd7677b6ef41f29d2dfc2c885b4f4e069d3fb8e67636bd89efd3f0fcad.zip",
|
|
39
39
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -53,98 +53,98 @@
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
},
|
|
56
|
-
"
|
|
56
|
+
"157ba1713f7224463b621261792d18081588ff306a9bc3f75e6c468fabbe1a60": {
|
|
57
57
|
"source": {
|
|
58
|
-
"path": "asset.
|
|
58
|
+
"path": "asset.157ba1713f7224463b621261792d18081588ff306a9bc3f75e6c468fabbe1a60",
|
|
59
59
|
"packaging": "zip"
|
|
60
60
|
},
|
|
61
61
|
"destinations": {
|
|
62
62
|
"current_account-current_region": {
|
|
63
63
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
64
|
-
"objectKey": "
|
|
64
|
+
"objectKey": "157ba1713f7224463b621261792d18081588ff306a9bc3f75e6c468fabbe1a60.zip",
|
|
65
65
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
"
|
|
69
|
+
"4c079063901e6478dbb5ace19e3123641ebf0da2ab648ecf52079c5bec154196": {
|
|
70
70
|
"source": {
|
|
71
|
-
"path": "asset.
|
|
71
|
+
"path": "asset.4c079063901e6478dbb5ace19e3123641ebf0da2ab648ecf52079c5bec154196",
|
|
72
72
|
"packaging": "zip"
|
|
73
73
|
},
|
|
74
74
|
"destinations": {
|
|
75
75
|
"current_account-current_region": {
|
|
76
76
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
77
|
-
"objectKey": "
|
|
77
|
+
"objectKey": "4c079063901e6478dbb5ace19e3123641ebf0da2ab648ecf52079c5bec154196.zip",
|
|
78
78
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
81
|
},
|
|
82
|
-
"
|
|
82
|
+
"7e8a681794eff5fda1841caa360113df5488ecf944055a69b8f1e5a687e269f5": {
|
|
83
83
|
"source": {
|
|
84
|
-
"path": "asset.
|
|
84
|
+
"path": "asset.7e8a681794eff5fda1841caa360113df5488ecf944055a69b8f1e5a687e269f5",
|
|
85
85
|
"packaging": "zip"
|
|
86
86
|
},
|
|
87
87
|
"destinations": {
|
|
88
88
|
"current_account-current_region": {
|
|
89
89
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
90
|
-
"objectKey": "
|
|
90
|
+
"objectKey": "7e8a681794eff5fda1841caa360113df5488ecf944055a69b8f1e5a687e269f5.zip",
|
|
91
91
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
},
|
|
95
|
-
"
|
|
95
|
+
"9572b451243318765beb576ae7528096b3879783dbaab795c02c01d7f4e83438": {
|
|
96
96
|
"source": {
|
|
97
|
-
"path": "asset.
|
|
97
|
+
"path": "asset.9572b451243318765beb576ae7528096b3879783dbaab795c02c01d7f4e83438",
|
|
98
98
|
"packaging": "zip"
|
|
99
99
|
},
|
|
100
100
|
"destinations": {
|
|
101
101
|
"current_account-current_region": {
|
|
102
102
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
103
|
-
"objectKey": "
|
|
103
|
+
"objectKey": "9572b451243318765beb576ae7528096b3879783dbaab795c02c01d7f4e83438.zip",
|
|
104
104
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
},
|
|
108
|
-
"
|
|
108
|
+
"be7d56b509650f7f97c406a745d8335992726086995e4cb4aaf50417ab40e803": {
|
|
109
109
|
"source": {
|
|
110
|
-
"path": "asset.
|
|
110
|
+
"path": "asset.be7d56b509650f7f97c406a745d8335992726086995e4cb4aaf50417ab40e803",
|
|
111
111
|
"packaging": "zip"
|
|
112
112
|
},
|
|
113
113
|
"destinations": {
|
|
114
114
|
"current_account-current_region": {
|
|
115
115
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
116
|
-
"objectKey": "
|
|
116
|
+
"objectKey": "be7d56b509650f7f97c406a745d8335992726086995e4cb4aaf50417ab40e803.zip",
|
|
117
117
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
},
|
|
121
|
-
"
|
|
121
|
+
"78b64aaf9aebb4eacbdd42197be10e9d5894360a642f7dcf79aeb84bb3552377": {
|
|
122
122
|
"source": {
|
|
123
|
-
"path": "asset.
|
|
123
|
+
"path": "asset.78b64aaf9aebb4eacbdd42197be10e9d5894360a642f7dcf79aeb84bb3552377",
|
|
124
124
|
"packaging": "zip"
|
|
125
125
|
},
|
|
126
126
|
"destinations": {
|
|
127
127
|
"current_account-current_region": {
|
|
128
128
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
129
|
-
"objectKey": "
|
|
129
|
+
"objectKey": "78b64aaf9aebb4eacbdd42197be10e9d5894360a642f7dcf79aeb84bb3552377.zip",
|
|
130
130
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
|
-
"
|
|
134
|
+
"d2b520d86fd9d964c83dc0d5ce2e4456dbde5fa7ae0c791a71865cbdfe2fb855": {
|
|
135
135
|
"source": {
|
|
136
|
-
"path": "asset.
|
|
136
|
+
"path": "asset.d2b520d86fd9d964c83dc0d5ce2e4456dbde5fa7ae0c791a71865cbdfe2fb855",
|
|
137
137
|
"packaging": "zip"
|
|
138
138
|
},
|
|
139
139
|
"destinations": {
|
|
140
140
|
"current_account-current_region": {
|
|
141
141
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
142
|
-
"objectKey": "
|
|
142
|
+
"objectKey": "d2b520d86fd9d964c83dc0d5ce2e4456dbde5fa7ae0c791a71865cbdfe2fb855.zip",
|
|
143
143
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
144
144
|
}
|
|
145
145
|
}
|
|
146
146
|
},
|
|
147
|
-
"
|
|
147
|
+
"43f46a8a4352e5d8823b3dc3e2f367cf50c48a4b4d1da8ed6e0d1463299d34ba": {
|
|
148
148
|
"source": {
|
|
149
149
|
"path": "RootmailIntegTestStack.template.json",
|
|
150
150
|
"packaging": "file"
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"destinations": {
|
|
153
153
|
"current_account-current_region": {
|
|
154
154
|
"bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}",
|
|
155
|
-
"objectKey": "
|
|
155
|
+
"objectKey": "43f46a8a4352e5d8823b3dc3e2f367cf50c48a4b4d1da8ed6e0d1463299d34ba.json",
|
|
156
156
|
"assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}"
|
|
157
157
|
}
|
|
158
158
|
}
|