serverwentdown / alias

CoreDNS plugin for replacing CNAME records on zone apex
https://coredns.io/explugins/alias/
Apache License 2.0
19 stars 9 forks source link

Doesn't work with MX record. #3

Closed hamano closed 4 years ago

hamano commented 6 years ago

if we set CNAME to zone apex. coredns returns only CNAME record with MX query.

example.com.    300 IN  MX  mx.example.org.
example.com.    300 IN  CNAME   some.magic.example.org.
some.magic.example.org. 300 IN A    123.123.45.67

$ dig example.org mx

;; ANSWER SECTION:
example.org.                300      IN      CNAME   some.magic.example.org.

Your plugin just remove the CNAME, so we get empty response. :-(

serverwentdown commented 6 years ago

I'll look into this. Can you also post your config?

hamano commented 6 years ago

Corefile:

example.com {
  file example.com.db {
    upstream 8.8.8.8
  }
  alias
}

example.com.db:

@   IN  SOA ns.example.com.  postmaster.example.com.   (
    2018052501  ; serial number
    1h      ; Refresh
    2m      ; Retry
    14d     ; Expire
    1h      ; Min TTL
)

@       300     IN      NS      127.0.0.1.
@       300     IN      MX      10 mx.example.com.
@       300     IN      CNAME   www.example.com.
mx      300     IN      A       127.0.0.2
www     300     IN      A       127.0.0.3
% dig example.com @127.0.0.1 a +short
127.0.0.3 # expected

% dig example.com @127.0.0.1 mx +short

# empty response
serverwentdown commented 6 years ago

erm, currently alias respects that CNAMEs cannot exist alongside A records. so you have to put your MX records on the target domain name.