Results 1 to 4 of 4

Thread: Bulk DNS modification...

  1. #1
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    675

    Default Bulk DNS modification...

    Hi,

    I was wondering if someone could possibly advise me on the following...

    I'd like to change the MX records of all domains on a server and make sure that those changes are correctly propagated to the cpanel nameservers.

    The reason for this is that we will be installing an anti spam appliance which requires the mx record to be changed for any domain that will be using it.

    There are two ways to go about that - let the customer do it themselves if they require the new anti spam solution - or do the changes all in one go. On some servers we want to let them do it themselves but on others I'd like to change the MX records for all the domains.

    Would you recommend that we write a script to do this - or is there some trickery that could be done form the command line ?

    Thanks in advance.

  2. #2
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    675

    Default

    Think I've found what I need.

    If we can write a script that will update the zone files on the main dns servers, I can then use this utility (zsu) to update the serial numbers so the changes are correctly synchronised

    http://www.dns.net/dist/zsu/

    The only remaining question is how to change the mx record from the domain name itself to the new appliance hostname...

    In the zone file, the mx is written as follows...

    domain.net. IN MX 0 domain.net.

    the script would have to look for the string "IN MX 0" and then compare the text to the right of that with the text to the left, using the . as a marker to show the end of the string.

    If the two values match then it means the MX is currently controlled by cpanel and not externally. If they dont match then it means the MX is already pointing elswhere and that file shouldnt be edited.

    So if the string to the left of "IN MX 0" matches the string to the right of it - the string to the right can be replaced with the new hostname.

    That sounds pretty straight forward actually.

    Can you see any flaws in that ?

    edit - I can...

    Because of domains containing more than one dot - i.e domain.co.uk. The script would need to determine the end of the string to the right of "IN MX 0" by identifying the final "." - i.e where there is no other character of any kind after it.

    would that be possible ?
    Last edited by 4u123; 01-15-2008 at 08:51 AM.

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jan 2006
    Posts
    675

    Default

    I now have a script that will change the MX records in all the zone files in /var/named - but it will only change the MX records that are pointing directly to the main domain specified in each zone file - so this will not have any effect on MX records that are already pointing externally.

    Question....

    If I change the records on the main nameservers and update the serials on the files - will all the hosting servers set the domains to remote - i.e add them to the remotedomains file automatically ? If so, How could I prevent that from happening ? We still need the domains to accept mail locally.
    Last edited by 4u123; 01-16-2008 at 05:10 AM.

  4. #4
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Apr 2003
    Location
    Houston, TX
    Posts
    396
    cPanel/WHM Access Level

    Root Administrator

    Default Re: Bulk DNS modification...

    I know this is a 3 year old thread but just ran across and wanted to ask if you shared the bulk mx change script you made as I like the way you approached it to only edit the MX if the left and right part of the line matched (domain.tld. and domain.tld.) to avoid disrupting zones using external MX records already.

    Also, in case you still wonder, adding the spam filtering appliance under "Configure Remote Service IPs" to have the local server accept mail for the domain still.

Similar Threads

  1. Bulk DNS insert
    By e0xbr in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 03-12-2012, 02:28 AM
  2. Bulk edit DNS zones
    By vanessafan in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 05-30-2011, 04:27 AM
  3. DNS modification of a domain
    By Dante78 in forum cPanel & WHM Discussions
    Replies: 7
    Last Post: 10-29-2010, 07:59 AM
  4. DNS Zone Modification
    By WireNine in forum cPanel & WHM Discussions
    Replies: 8
    Last Post: 08-07-2008, 03:18 PM
  5. Multi Account DNS Modification
    By AA2004 in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 03-22-2005, 12:55 PM