Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding mailserver with namecheap domain not working #48

Open
tecknicaltom opened this issue Mar 28, 2023 · 3 comments
Open

adding mailserver with namecheap domain not working #48

tecknicaltom opened this issue Mar 28, 2023 · 3 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@tecknicaltom
Copy link
Contributor

Attempting to add a mailserver to an existing operation using a namecheap domain is failing with an error.

command:

python3 terry.py --operation [redacted] --verbose --no_elastic add   server --provider aws --type mailserver --fqdn [redacted].com:namecheap

generates the following plan for dns resources:

  # namecheap_domain_records._dmarc-mx-TXT-id-6f170dfd-ba29-4af1-90f8-2308125247fa will be created
  + resource "namecheap_domain_records" "_dmarc-mx-TXT-id-6f170dfd-ba29-4af1-90f8-2308125247fa" {
      + domain     = "[redacted].com"
      + email_type = "NONE"
      + id         = (known after apply)
      + mode       = "MERGE"

      + record {
          + address  = "v=DMARC1; p=none"
          + hostname = "_dmarc.mx"
          + mx_pref  = 10
          + ttl      = 1799
          + type     = "TXT"
        }
    }

  # namecheap_domain_records.mx-A-id-6f170dfd-ba29-4af1-90f8-2308125247fa will be created
  + resource "namecheap_domain_records" "mx-A-id-6f170dfd-ba29-4af1-90f8-2308125247fa" {
      + domain     = "[redacted].com"
      + email_type = "NONE"
      + id         = (known after apply)
      + mode       = "MERGE"

      + record {
          + address  = (known after apply)
          + hostname = "mx"
          + mx_pref  = 10
          + ttl      = 1799
          + type     = "A"
        }
    }

  # namecheap_domain_records.mx-MX-id-6f170dfd-ba29-4af1-90f8-2308125247fa will be created
  + resource "namecheap_domain_records" "mx-MX-id-6f170dfd-ba29-4af1-90f8-2308125247fa" {
      + domain     = "[redacted].com"
      + email_type = "MX"
      + id         = (known after apply)
      + mode       = "MERGE"

      + record {
          + address  = "mx.[redacted].com."
          + hostname = "mx"
          + mx_pref  = 10
          + ttl      = 1799
          + type     = "MX"
        }
    }

After accepting the actions, it appears that the MX record is properly created, but the other two records fail, with errors such as:

Error: Records[1].RecordType MX is not allowed for EmailType=NONE

  with namecheap_domain_records.mx-A-id-6f170dfd-ba29-4af1-90f8-2308125247fa,
  on [redacted]_plan.tf line 176, in resource "namecheap_domain_records" "mx-A-id-6f170dfd-ba29-4af1-90f8-2308125247fa":
 176: resource "namecheap_domain_records" "mx-A-id-6f170dfd-ba29-4af1-90f8-2308125247fa" { 

[X] Fatal Error: Terraform returned an error: No stderr was returned, this is likely a logic issue or partial error within the plan. (Example: if AWS, a bad AMI given the region)

This is with the current github version of Terry, commit dcf6861

@ezra-buckingham ezra-buckingham added bug Something isn't working help wanted Extra attention is needed labels Mar 31, 2023
@ezra-buckingham
Copy link
Owner

I was never able to fully get mailservers working. This is mainly due to the main email hosting providers (google, msft, etc) require you to use the SMTP relay of your chosen cloud provider. I have yet to have enough time to really dig into getting that built out and likely will not have the time to do that unfortunately :(

@tecknicaltom
Copy link
Contributor Author

tecknicaltom commented Mar 31, 2023

looking into my specific issue further, it looks like maybe namecheap requires that once you add an MX record, all new record add api calls require the RecordType parameter to be MX, even if you're only adding an A record. I'm not completely positive that's what's going on (and I've moved away from trying to use Terry for the mailserver for the time being) but it's what it looks like to me.

@ezra-buckingham
Copy link
Owner

Could be a multitude of things. Ultimately, configuring mailservers is difficult given you must create the DNS records after creation of the infrastructure as the DMARC / DKIM records will rely on the keys generated on that host. I had gotten most of the skeleton for that built into Terry, but never got it finalized given the roadblocker of needing to use SMTP relays inside of each cloud provider

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants