mass insertion of MX records for all virtual-servers

hello all -

if i wanted to make each and every one of my virtual-servers have the same identical MX records, is there some fast “batch” way to do it?

an earlier post mentioned doing it command-line style… would this be using some dns/bind command-line options, bypassing virtualmin? that sounded to me as if i would be doing them one at a time.

i have become something of a google-mail fan, so i wish all of my MX records to point to google.

THANK YOU ALL !

If it’s just about manipulating MX records and having them all point to the same target, you can use Webmin’s BIND module. There’s a “Update/Add/Delete Records in selected” button which applies to all zones you select in the list.

Locutus - its difficult for me to express my full gratitude over a public forum, but please understand i am grateful to you!

sorry to be such a bother…

i am trying to enter these google MX records for all my domains (please see 00-google-mx attachment).

each MX record has a priority associated with it.

i go into the DNS-Bind server section (please see 01-bind attachment) - i check all the names,

then when i click “Add record to selected” i get the “Add record to zone” page (please see 02-add-record-to-zone attachment).

i don’t see a place there for the priority number.

am i missing something? am i even in the right place?

You are right, there indeed is no dedicated field to enter the priority value.

But it should work just fine when you simply enter the priority number before the hostname in the “New record value” field, like so:

10 aspmx2.googlemail.com.

Don’t forget to end the hostname with a dot, otherwise BIND will automatically append the current zone name to the address!

hmmm well it did the first record, but the subsequent ones i got an “already exists” warning.

here is an example of the only one it created:

@	IN	MX	1 ASPMX.L.GOOGLE.COM.

and here are the results: (picture also attached)

Adding record to zone vvchristianchurch.info ..
.. a record with the same name and value 1 ASPMX.L.GOOGLE.COM. already exists.

i manually did one in its entirety and this was the result:

edwardsmarkf.com.	IN	MX	1 ASPMX.L.GOOGLE.COM
edwardsmarkf.com.	IN	MX	5 ALT1.ASPMX.L.GOOGLE.COM
edwardsmarkf.com.	IN	MX	5 ALT2.ASPMX.L.GOOGLE.COM
edwardsmarkf.com.	IN	MX	10 ASPMX2.GOOGLEMAIL.COM
edwardsmarkf.com.	IN	MX	10 ASPMX3.GOOGLEMAIL.COM

Are you sure you entered “5 alt1.aspmx.l.google.com” when you tried the second record?

Your post (especially the error message) looks to me like you tried the first record twice.

good morning -

here is how the zone records look now (as an example):

$ttl 38400
@	IN	SOA	ns1.edwardsmarkf.com. root.ns1.edwardsmarkf.com. (
			1338932983
			10800
			3600
			604800
			38400 )
@	IN	NS	ns1.edwardsmarkf.com.
vvchristianchurch.info.	IN	A	69.10.48.25
www.vvchristianchurch.info.	IN	A	69.10.48.25
ftp.vvchristianchurch.info.	IN	A	69.10.48.25
m.vvchristianchurch.info.	IN	A	69.10.48.25
localhost.vvchristianchurch.info.	IN	A	127.0.0.1
webmail.vvchristianchurch.info.	IN	A	69.10.48.25
admin.vvchristianchurch.info.	IN	A	69.10.48.25
vvchristianchurch.info.	IN	TXT	"v=spf1 a mx a:vvchristianchurch.info ip4:69.10.48.25 ?all"
@	IN	MX	1 ASPMX.L.GOOGLE.COM.

then i attempted to add in “5 ALT1.ASPMX.L.GOOGLE.COM.” as a mail record - please see attached zone-record-creation.png

but i got an error complaining about duplicate records. please see attached result.png or look below.

Adding record to zone vvchristianchurch.info ..
.. a record with the same name and value 1 ASPMX.L.GOOGLE.COM. already exists.

i could select “Create even if record already exists?” but that makes me a little nervous.

we are getting VERY CLOSE…!

Okay, I’ll try to reproduce that in a bit. What you’re observing looks a lot like a Webmin bug to me.

I was able to reproduce this behavior; it is clearly a bug in Webmin. I’ll write a bug report shortly.

A quick workaround would be, as you already mentioned, to use the “Create record even if it already exists” function. The second record gets created correctly, even though the error message talks about a different one.

You can try it with just one or two zones checked first to make sure it works.

if it helps:

Webmin version 1.590

Virtualmin version 3.94.gpl GPL

and please see attached

THANK YOU FOR HELPING ME!

Don’t worry, the bug was already confirmed and will be fixed in the next Webmin version. :slight_smile:

hmmm well then…

getting back to the original question: can you think of any current way to mass-update all the mx records?

i am starting to think about some sort of custom php solutions to read the zone files manually.

note - usually the guy who finds the bug is awarded a gold star.

Well, what do you need to mass update them with? There is a “modify records in selected zones” function.

hi locutus -

suppose i have hundreds of virtual-servers and all are going to have identical MX records.

so, i want every virtual-server to have something like the following in the zone record:

@	IN	MX	1 ASPMX.L.GOOGLE.COM
@	IN	MX	5 ALT1.ASPMX.L.GOOGLE.COM
@	IN	MX	5 ALT2.ASPMX.L.GOOGLE.COM
@	IN	MX	10 ASPMX2.GOOGLEMAIL.COM
@	IN	MX	10 ASPMX3.GOOGLEMAIL.COM

so every virtual-server on my account will have these results (for example):

;; QUESTION SECTION:
;edwardsmark.com.	 IN	MX

;; ANSWER SECTION:
edwardsmark.com.	86400	IN	MX	5 alt1.aspmx.l.google.com.
edwardsmark.com.	86400	IN	MX	5 alt2.aspmx.l.google.com.
edwardsmark.com.	86400	IN	MX	10 aspmx2.googlemail.com.
edwardsmark.com.	86400	IN	MX	1 aspmx.l.google.com.

also, may i ask about your forum name? it sounds suspiciously like the same name Jean-Luke Picard was issued by the Borg. is there something you are not telling us?

Mh, is there anything wrong with using the “Add record to selected zones” to add all those? :slight_smile:

The bug you discovered applies - like I mentioned - only the check if the record already exists:

A quick workaround would be, as you already mentioned, to use the “Create record even if it already exists” function. The second record gets created correctly, even though the error message talks about a different one. You can try it with just one or two zones checked first to make sure it works.

As for my nickname – you’ll know where it actually comes from as soon as you’ve been properly assimilated! ;D

(Kudos for actually knowing about Jean-Luc Picard as a Borg… Most people who ask me about the name rather have associations of large ugly bugs. :wink: )

Mh, is there anything wrong with using the  
"Add record to selected zones" to add all those? :)

no, if it worked. i can add the first one:

1 ASPMX.L.GOOGLE.COM

but cant seem to add the subsequent ones, because of the bug you mentioned.

i will give the create-record option without checking for duplicates a try and see what happens. i am playing with it now, but strangely, “dig” is not seeing my changes. maybe i have to wait a couple of days…

and for the record, those Borg critters used to give me nightmares. that is, until i learned the queen borg was sorta cute.

i am thinking now to use some hybrid unix find-sed command to make global changes until virtualmin gets that bug fixed.

however, since all my virtual-servers are new, it appears i can use the very cool feature Server Template feature (attached)

i moved five domains over and all five appear to have the correct A and MX records.