@mavogel/awscdk-rootmail 0.0.18 → 0.0.20
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 +10 -6
- package/API.md +23 -1
- package/README.md +23 -1
- package/lib/index-cli-synth.js +22 -11
- package/lib/rootmail.js +1 -1
- package/lib/scripts/publish-assets.js +18 -22
- package/lib/ses-receive.js +1 -1
- package/package.json +11 -6
package/.jsii
CHANGED
|
@@ -3502,10 +3502,14 @@
|
|
|
3502
3502
|
"docs": {
|
|
3503
3503
|
"stability": "stable"
|
|
3504
3504
|
},
|
|
3505
|
-
"homepage": "https://github.com/
|
|
3505
|
+
"homepage": "https://github.com/MV-Consulting/awscdk-rootmail",
|
|
3506
3506
|
"jsiiVersion": "5.3.18 (build 4f1b2de)",
|
|
3507
3507
|
"keywords": [
|
|
3508
|
-
"
|
|
3508
|
+
"aws",
|
|
3509
|
+
"cdk",
|
|
3510
|
+
"construct",
|
|
3511
|
+
"rootmail",
|
|
3512
|
+
"ses"
|
|
3509
3513
|
],
|
|
3510
3514
|
"license": "Apache-2.0",
|
|
3511
3515
|
"metadata": {
|
|
@@ -3518,11 +3522,11 @@
|
|
|
3518
3522
|
},
|
|
3519
3523
|
"name": "@mavogel/awscdk-rootmail",
|
|
3520
3524
|
"readme": {
|
|
3521
|
-
"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 `npm run projen` to install it\n2. In you `main.ts` file add the following code\n```ts\nimport {\n App,\n Stack,\n aws_route53 as r53\n} from 'aws-cdk-lib';\nimport { Rootmail } from '@mavogel/awscdk-rootmail';\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.test'\n\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 // 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 // wired / delegated automatically\n autowireDNSParentHostedZoneID: hostedZone.hostedZoneId,\n env: {\n // 3. or any other region SES is available\n region: 'eu-west-1',\n },\n });\n }\n}\n```\n2. run on your commandline\n```sh\nnpm 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```\n\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```\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 `npm 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 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 `npm run projen` to install it\n2. In you `main.ts` file add the following code\n```ts\nimport {\n App,\n Stack,\n aws_route53 as r53\n} from 'aws-cdk-lib';\nimport { Rootmail } from '@mavogel/awscdk-rootmail';\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.test'\n\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 // 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 // wired / delegated automatically\n autowireDNSParentHostedZoneID: hostedZone.hostedZoneId,\n env: {\n // 3. or any other region SES is available\n region: 'eu-west-1',\n },\n });\n }\n}\n```\n2. run on your commandline\n```sh\nnpm 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 `npm 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`)."
|
|
3522
3526
|
},
|
|
3523
3527
|
"repository": {
|
|
3524
3528
|
"type": "git",
|
|
3525
|
-
"url": "https://github.com/
|
|
3529
|
+
"url": "https://github.com/MV-Consulting/awscdk-rootmail"
|
|
3526
3530
|
},
|
|
3527
3531
|
"schema": "jsii/0.10.0",
|
|
3528
3532
|
"targets": {
|
|
@@ -3873,6 +3877,6 @@
|
|
|
3873
3877
|
"symbolId": "src/ses-receive:SESReceiveProps"
|
|
3874
3878
|
}
|
|
3875
3879
|
},
|
|
3876
|
-
"version": "0.0.
|
|
3877
|
-
"fingerprint": "
|
|
3880
|
+
"version": "0.0.20",
|
|
3881
|
+
"fingerprint": "NuM+0aDoc4T6fItcq7GgYdE0JzUFFy5aN5fwv89q++8="
|
|
3878
3882
|
}
|
package/API.md
CHANGED
|
@@ -145,7 +145,7 @@ export const handler = async (event: SESEventRecordsToLambda) => {
|
|
|
145
145
|
|
|
146
146
|
};
|
|
147
147
|
```
|
|
148
|
-
|
|
148
|
+
and you create a separate `NodejsFunction` as follows with the additionally needed IAM permissions:
|
|
149
149
|
```ts
|
|
150
150
|
const customSesReceiveFunction = new NodejsFunction(stackUnderTest, 'custom-ses-receive-function', {
|
|
151
151
|
functionName: PhysicalName.GENERATE_IF_NEEDED,
|
|
@@ -163,6 +163,28 @@ customSesReceiveFunction.addToRolePolicy(new iam.PolicyStatement({
|
|
|
163
163
|
resources: ['*'],
|
|
164
164
|
}))
|
|
165
165
|
```
|
|
166
|
+
and then pass it into the `Rootmail` Stack
|
|
167
|
+
```ts
|
|
168
|
+
export class MyStack extends Stack {
|
|
169
|
+
constructor(scope: Construct, id: string, props: StackProps = {}) {
|
|
170
|
+
super(scope, id, props);
|
|
171
|
+
|
|
172
|
+
const domain = 'mycompany.test'
|
|
173
|
+
const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {
|
|
174
|
+
domainName: domain,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const rootmail = new Rootmail(this, 'rootmail-stack', {
|
|
178
|
+
domain: domain;
|
|
179
|
+
autowireDNSParentHostedZoneID: hostedZone.hostedZoneId,
|
|
180
|
+
env: {
|
|
181
|
+
region: 'eu-west-1',
|
|
182
|
+
},
|
|
183
|
+
customSesReceiveFunction: customSesReceiveFunction, // <- pass it in here
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
166
188
|
|
|
167
189
|
#### Cloudformation
|
|
168
190
|
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).
|
package/README.md
CHANGED
|
@@ -145,7 +145,7 @@ export const handler = async (event: SESEventRecordsToLambda) => {
|
|
|
145
145
|
|
|
146
146
|
};
|
|
147
147
|
```
|
|
148
|
-
|
|
148
|
+
and you create a separate `NodejsFunction` as follows with the additionally needed IAM permissions:
|
|
149
149
|
```ts
|
|
150
150
|
const customSesReceiveFunction = new NodejsFunction(stackUnderTest, 'custom-ses-receive-function', {
|
|
151
151
|
functionName: PhysicalName.GENERATE_IF_NEEDED,
|
|
@@ -163,6 +163,28 @@ customSesReceiveFunction.addToRolePolicy(new iam.PolicyStatement({
|
|
|
163
163
|
resources: ['*'],
|
|
164
164
|
}))
|
|
165
165
|
```
|
|
166
|
+
and then pass it into the `Rootmail` Stack
|
|
167
|
+
```ts
|
|
168
|
+
export class MyStack extends Stack {
|
|
169
|
+
constructor(scope: Construct, id: string, props: StackProps = {}) {
|
|
170
|
+
super(scope, id, props);
|
|
171
|
+
|
|
172
|
+
const domain = 'mycompany.test'
|
|
173
|
+
const hostedZone = r53.HostedZone.fromLookup(this, 'rootmail-parent-hosted-zone', {
|
|
174
|
+
domainName: domain,
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
const rootmail = new Rootmail(this, 'rootmail-stack', {
|
|
178
|
+
domain: domain;
|
|
179
|
+
autowireDNSParentHostedZoneID: hostedZone.hostedZoneId,
|
|
180
|
+
env: {
|
|
181
|
+
region: 'eu-west-1',
|
|
182
|
+
},
|
|
183
|
+
customSesReceiveFunction: customSesReceiveFunction, // <- pass it in here
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
```
|
|
166
188
|
|
|
167
189
|
#### Cloudformation
|
|
168
190
|
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).
|
package/lib/index-cli-synth.js
CHANGED
|
@@ -39,19 +39,30 @@ class RootmailStack extends aws_cdk_lib_1.Stack {
|
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
|
-
let
|
|
43
|
-
if (!process.env.
|
|
44
|
-
console.log('
|
|
45
|
-
|
|
42
|
+
let releaseVersion = process.env.RELEASE_VERSION;
|
|
43
|
+
if (!process.env.RELEASE_VERSION || process.env.RELEASE_VERSION === '') {
|
|
44
|
+
console.log('RELEASE_VERSION is not set. Using default \'0.0.0-DEVELOPMENT\'');
|
|
45
|
+
releaseVersion = '0.0.0-DEVELOPMENT';
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
new
|
|
49
|
-
|
|
47
|
+
if (!process.env.RELEASE_NAME || process.env.RELEASE_NAME === '') {
|
|
48
|
+
throw new Error('RELEASE_NAME environment variable must be set');
|
|
49
|
+
}
|
|
50
|
+
const releaseName = process.env.RELEASE_NAME;
|
|
51
|
+
if (!process.env.RELEASE_PREFIX || process.env.RELEASE_PREFIX === '') {
|
|
52
|
+
throw new Error('RELEASE_PREFIX environment variable must be set');
|
|
53
|
+
}
|
|
54
|
+
const releasePrefix = process.env.RELEASE_PREFIX;
|
|
55
|
+
if (!process.env.S3_FILE_ASSETS_BUCKET_PREFIX || process.env.S3_FILE_ASSETS_BUCKET_PREFIX === '') {
|
|
56
|
+
throw new Error('S3_FILE_ASSETS_BUCKET_PREFIX environment variable must be set');
|
|
57
|
+
}
|
|
58
|
+
const s3FileAssetsBucketPrefix = process.env.S3_FILE_ASSETS_BUCKET_PREFIX;
|
|
59
|
+
console.log(`Using RELEASE_NAME: '${releaseName}' RELEASE_VERSION Version: '${releaseVersion}' with prefix: '${releasePrefix}'`);
|
|
60
|
+
new RootmailStack(app, releaseName, {
|
|
61
|
+
version: releaseVersion,
|
|
50
62
|
synthesizer: new aws_cdk_lib_1.CliCredentialsStackSynthesizer({
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
bucketPrefix: `rootmail/${rootmailVersion}/`,
|
|
63
|
+
fileAssetsBucketName: `${s3FileAssetsBucketPrefix}-\${AWS::Region}`,
|
|
64
|
+
bucketPrefix: `${releasePrefix}/${releaseVersion}/`,
|
|
54
65
|
}),
|
|
55
66
|
});
|
|
56
67
|
app.synth();
|
|
57
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
68
|
+
//# sourceMappingURL=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/rootmail.js
CHANGED
|
@@ -74,7 +74,7 @@ class Rootmail extends constructs_1.Construct {
|
|
|
74
74
|
}
|
|
75
75
|
exports.Rootmail = Rootmail;
|
|
76
76
|
_a = JSII_RTTI_SYMBOL_1;
|
|
77
|
-
Rootmail[_a] = { fqn: "@mavogel/awscdk-rootmail.Rootmail", version: "0.0.
|
|
77
|
+
Rootmail[_a] = { fqn: "@mavogel/awscdk-rootmail.Rootmail", version: "0.0.20" };
|
|
78
78
|
/**
|
|
79
79
|
* Aspect for setting all removal policies to DESTROY
|
|
80
80
|
*/
|
|
@@ -3,41 +3,37 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const child_process_1 = require("child_process");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const retry = require("async-retry");
|
|
6
|
-
|
|
7
|
-
'
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const retries = 20;
|
|
20
|
-
// Publish assets into all regional buckets
|
|
21
|
-
// e.g. superwerker-assets-eu-central-1 etc.
|
|
6
|
+
if (!process.env.RELEASE_NAME || process.env.RELEASE_NAME === '') {
|
|
7
|
+
throw new Error('RELEASE_NAME environment variable must be set');
|
|
8
|
+
}
|
|
9
|
+
if (!process.env.RELEASE_RETRIES || process.env.RELEASE_RETRIES === '') {
|
|
10
|
+
throw new Error('RELEASE_RETRIES environment variable must be set');
|
|
11
|
+
}
|
|
12
|
+
if (!process.env.RELEASE_REGIONS || process.env.RELEASE_REGIONS.length === 0) {
|
|
13
|
+
throw new Error('RELEASE_REGIONS environment variable must be set and not empty');
|
|
14
|
+
}
|
|
15
|
+
const releaseName = process.env.RELEASE_NAME;
|
|
16
|
+
const releaseRetries = process.env.RELEASE_RETRIES;
|
|
17
|
+
const releaseRegions = process.env.RELEASE_REGIONS.split(',');
|
|
18
|
+
console.log(`Publishing assets for release ${releaseName} with ${releaseRetries} retries to regions: ${releaseRegions}`);
|
|
22
19
|
const main = async () => {
|
|
23
|
-
const assetManifestPath = path.resolve(__dirname, '..', '..', 'cdk.out',
|
|
24
|
-
for (const region of
|
|
20
|
+
const assetManifestPath = path.resolve(__dirname, '..', '..', 'cdk.out', `${releaseName}.assets.json`);
|
|
21
|
+
for (const region of releaseRegions) {
|
|
25
22
|
const command = `AWS_REGION=${region} yarn cdk-assets publish -p ${assetManifestPath}`;
|
|
26
23
|
console.log(command);
|
|
27
24
|
await retry(async (_, attempt) => {
|
|
28
|
-
console.log(`Attempt ${attempt} of ${
|
|
25
|
+
console.log(`Attempt ${attempt} of ${releaseRetries} in region ${region}`);
|
|
29
26
|
const execResult = await (0, child_process_1.execSync)(command);
|
|
30
27
|
console.log(execResult.toString());
|
|
31
28
|
}, {
|
|
32
|
-
retries:
|
|
29
|
+
retries: releaseRetries,
|
|
33
30
|
factor: 2,
|
|
34
31
|
minTimeout: 1000,
|
|
35
32
|
maxTimeout: 30000,
|
|
36
33
|
});
|
|
37
34
|
}
|
|
38
35
|
};
|
|
39
|
-
// top level await madness
|
|
40
36
|
(async () => { await main(); })().catch(e => {
|
|
41
37
|
console.error(e);
|
|
42
38
|
});
|
|
43
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
39
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGlzaC1hc3NldHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvc2NyaXB0cy9wdWJsaXNoLWFzc2V0cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLGlEQUF5QztBQUN6Qyw2QkFBNkI7QUFDN0IscUNBQXFDO0FBRXJDLElBQUksQ0FBQyxPQUFPLENBQUMsR0FBRyxDQUFDLFlBQVksSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLFlBQVksS0FBSyxFQUFFLE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7XG4gIGNvbnN0IGFzc2V0TWFuaWZlc3RQYXRoID0gcGF0aC5yZXNvbHZlKF9fZGlybmFtZSwgJy4uJywgJy4uJywgJ2Nkay5vdXQnLCBgJHtyZWxlYXNlTmFtZX0uYXNzZXRzLmpzb25gKTtcbiAgZm9yIChjb25zdCByZWdpb24gb2YgcmVsZWFzZVJlZ2lvbnMpIHtcbiAgICBjb25zdCBjb21tYW5kID0gYEFXU19SRUdJT049JHtyZWdpb259IHlhcm4gY2RrLWFzc2V0cyBwdWJsaXNoIC1wICR7YXNzZXRNYW5pZmVzdFBhdGh9YDtcbiAgICBjb25zb2xlLmxvZyhjb21tYW5kKTtcbiAgICBhd2FpdCByZXRyeShhc3luYyAoXzogYW55LCBhdHRlbXB0OiBudW1iZXIpID0+IHtcbiAgICAgIGNvbnNvbGUubG9nKGBBdHRlbXB0ICR7YXR0ZW1wdH0gb2YgJHtyZWxlYXNlUmV0cmllc30gaW4gcmVnaW9uICR7cmVnaW9ufWApO1xuICAgICAgY29uc3QgZXhlY1Jlc3VsdCA9IGF3YWl0IGV4ZWNTeW5jKGNvbW1hbmQpO1xuICAgICAgY29uc29sZS5sb2coZXhlY1Jlc3VsdC50b1N0cmluZygpKTtcbiAgICB9LCB7XG4gICAgICByZXRyaWVzOiByZWxlYXNlUmV0cmllcyxcbiAgICAgIGZhY3RvcjogMixcbiAgICAgIG1pblRpbWVvdXQ6IDEwMDAsXG4gICAgICBtYXhUaW1lb3V0OiAzMDAwMCxcbiAgICB9KTtcbiAgfVxufTtcblxuKGFzeW5jICgpID0+IHsgYXdhaXQgbWFpbigpOyB9KSgpLmNhdGNoKGUgPT4ge1xuICBjb25zb2xlLmVycm9yKGUpO1xufSk7XG4iXX0=
|
package/lib/ses-receive.js
CHANGED
|
@@ -124,7 +124,7 @@ class SESReceive extends constructs_1.Construct {
|
|
|
124
124
|
}
|
|
125
125
|
exports.SESReceive = SESReceive;
|
|
126
126
|
_a = JSII_RTTI_SYMBOL_1;
|
|
127
|
-
SESReceive[_a] = { fqn: "@mavogel/awscdk-rootmail.SESReceive", version: "0.0.
|
|
127
|
+
SESReceive[_a] = { fqn: "@mavogel/awscdk-rootmail.SESReceive", version: "0.0.20" };
|
|
128
128
|
/**
|
|
129
129
|
* Aspect for setting all removal policies to DESTROY
|
|
130
130
|
*/
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "An opinionated way to secure root email addresses for AWS accounts.",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
|
-
"url": "https://github.com/
|
|
6
|
+
"url": "https://github.com/MV-Consulting/awscdk-rootmail"
|
|
7
7
|
},
|
|
8
8
|
"scripts": {
|
|
9
9
|
"build": "npx projen build",
|
|
@@ -28,10 +28,11 @@
|
|
|
28
28
|
"upgrade": "npx projen upgrade",
|
|
29
29
|
"watch": "npx projen watch",
|
|
30
30
|
"projen": "npx projen",
|
|
31
|
+
"synth": "npx cdk synth -q",
|
|
32
|
+
"publish-assets": "npx ts-node -P tsconfig.json --prefer-ts-exts src/scripts/publish-assets.ts",
|
|
31
33
|
"prepare": "husky install",
|
|
32
|
-
"integ-test": "
|
|
33
|
-
"
|
|
34
|
-
"publish-assets": "npx ts-node -P tsconfig.json --prefer-ts-exts src/scripts/publish-assets.ts"
|
|
34
|
+
"prepare-integ-test": "rm -rf cdk.out && npx cdk synth -q",
|
|
35
|
+
"integ-test": "integ-runner --directory ./integ-tests --parallel-regions eu-west-2 --parallel-regions eu-west-1 --update-on-failed"
|
|
35
36
|
},
|
|
36
37
|
"author": {
|
|
37
38
|
"name": "Manuel Vogel",
|
|
@@ -103,14 +104,18 @@
|
|
|
103
104
|
"uuid"
|
|
104
105
|
],
|
|
105
106
|
"keywords": [
|
|
106
|
-
"
|
|
107
|
+
"aws",
|
|
108
|
+
"cdk",
|
|
109
|
+
"construct",
|
|
110
|
+
"rootmail",
|
|
111
|
+
"ses"
|
|
107
112
|
],
|
|
108
113
|
"main": "lib/index.js",
|
|
109
114
|
"license": "Apache-2.0",
|
|
110
115
|
"publishConfig": {
|
|
111
116
|
"access": "public"
|
|
112
117
|
},
|
|
113
|
-
"version": "0.0.
|
|
118
|
+
"version": "0.0.20",
|
|
114
119
|
"jest": {
|
|
115
120
|
"testMatch": [
|
|
116
121
|
"<rootDir>/src/**/__tests__/**/*.ts?(x)",
|