aws-samples / aws-opensource-mailserver

MIT No Attribution
8 stars 9 forks source link

DNS on the EC2 instance seems to have overridden the root DNS stored on Route 53 #2

Closed David-Slack closed 10 months ago

David-Slack commented 10 months ago

I have a domain, and on that domain is a website (using Amplfiy). I have installed the mailserver as per the readme (great tutorial, did exactly what I needed, thanks).

Problem is, this stack seems to use it's own DNS server on the EC2 instance of Ubuntu, but I can't find the settings for this! Can you tell me: A. Where the DNS settings are (is it Bind9)? B. How to remove the main domain DNS settings and keep only the subdomains need for the mail server?

When I've done this before I've usually done it on a subdomain (like mailserver.example.com or box.example.com) and that doesn't touch the root domain settings. Might need a warning on the readme or a change to the stack, unless I've missed something (which is likely).

Thanks

mmeidlinger commented 10 months ago

Thanks for your comment David.

Mail-in-a-box comes with a DNS server installation you can use to manage DNS for your domain. The sample / blog describes the case where this capability is used to manage your entire domain, i.e., we do not use any external DNS service such as Route53 Resolver / Public Hosted Zones. We only use Route53 to register the domain, but not as act as a DNS server for it (by creating a PHZ). With this approach, at your registrar you set your NS entries (also referred to as "Glue Records") to the IP address of the box. Any DNS request for your domain will then be handled by the box going forward.

If you don't intend this behavior, you essentially can take two approaches, both of which involve setting up a DNS service external to Mail-in-a-box ( e.g. configuring and using a Route53 Public Hosted Zone to handle your DNS):

  1. You can delegate a subdomain to your Mail-in-a-box installation. In context of Route53 Public Hosted Zones, this means you configure an NS entry for subdomain.yourdomain.com and point that to your box and have the DNS server on the box only handle the subdomain.
  2. You do not use the DNS capability of Mail-in-a-box at all, but rather configure external DNS. With that approach, you copy your DNS records to your external DNS service (Route53). There is a page on the WebUi of Mail-in-a-box admin interface from where you can copy these records that you then need to add to your Route53 PHZ (or any other external DNS service for that matter).
David-Slack commented 10 months ago

Hi @mmeidlinger

Option 2 sounds like the cleaner choice of these 2, as option 1 will end up with sub.sub.example.com. However, for simplicity and time constraints I may need to use option 1.

Is the best way to achieve option 1 to:

  1. Destroy all as shown in the cleaning up section
  2. Create a subdomain in Route 53
  3. Wait for DNS to propagate and test all working
  4. Start the process again using the subdomain

or is there a simple way to do this?

Thanks

David-Slack commented 10 months ago

Just in case anyone finds this, the answer was to use the external DNS (option 2), not using a subdomain.

The page in the Mail in a Box System->External DNS explains most of this, but Route 53 will error when you add the zonefile, so you will have to manually remove the erroring values and manually add them back in later (e.g. txt needed splitting).

Also, Route 53 has a missing type (SSHFP) so that will error too. Not sure what this missing type will mean for the future, I'll need to look into that.

Good luck all and thanks again @mmeidlinger, amazing bit of kit and well written docs.