Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Monitoring MX Records
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Monitoring MX Records

Problem
Sometimes we see deals on domain renewals at another registrar or just the transfer price of a domain is cheaper than the renewal price. So we transfer the domain, and if we were using the original registrars DNS it may be some time before we realize that no mail is incoming. I have made this mistake more than once before.

One Possible solution
I wrote a small script and put it into /etc/cron.hourly that will check the first MX record listed for a given domain against an expected value.

The Script
https://pastebin.pl/view/f572cb4c [ The forum wont let me post the code ]

Feedback
Does this look like a good idea? Can you offer any comments or suggestions as to how this can be improved or is it good as it.

Thanks in advance.

Comments

  • When I try too post the script

    Why have I been blocked?

    This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.
    What can I do to resolve this?

    You can email the site owner to let them know you were blocked. Please include what you were doing when this page came up and the Cloudflare Ray ID found at the bottom of this page.

  • @andreb said: if we were using the original registrars DNS

    Well, I think i found the problem..?

  • @sanvit said:

    @andreb said: if we were using the original registrars DNS

    Well, I think i found the problem..?

    I will take this into consideration.

    This sometimes happens when you use your own DNS.
    Are the registrars DNS usually more reliable than your own VPS DNS?

  • @andreb said: Are the registrars DNS usually more reliable than your own VPS DNS?

    Probably... I would highly recommend using Cloudflare though

  • LeviLevi Member

    Here is a bit shorter and more clear dig command for MX:

    dig google.com MX +short | sort -u | head -n1 | awk '{print $NF}'

  • @LTniger said:
    Here is a bit shorter and more clear dig command for MX:

    dig google.com MX +short | sort -u | head -n1 | awk '{print $NF}'

    Thanks. I am guessing that -u will sort 1 10 2 20 as 1 2 10 20. Also awk '{print $NF}' is shorter which is good.

    Do you think the way I chose to go about this is reasonable?

  • BTW sort -u broke the script. For example I got the 3rd Google MX record instead of the First. So I will keep sort -n.

  • LeviLevi Member

    sort -u shows unique records as there can be repeating ones. Implement DNSSEC if you care about your domain security https://www.icann.org/resources/pages/dnssec-what-is-it-why-important-2019-03-05-en

Sign In or Register to comment.