Change multiple DNS zones using templates/wildcards

mlopez

Well-Known Member
Dec 17, 2020
76
13
8
Maldonado - Uruguay
cPanel Access Level
Root Administrator
Twitter
What I'm trying to do is to add specific records to all (or most part) of the domains hosted in the server using a DNS template-like syntax.

Example:

I want to add smtp, imap and pop CNAMES pointing to mail.%domain%. like this:

Code:
smtp    14400   IN  CNAME   mail.example.com.
imap    14400   IN  CNAME   mail.example.com.
pop 14400   IN  CNAME   mail.example.com.
I've already done it for the accounts created from now on (WHM -> Home »DNS Functions »Edit Zone Template) adding this snippet:

Code:
pop IN CNAME %domain%.
imap IN CNAME %domain%.
smtp IN CNAME %domain%.
But now I need it to be set on the domains previously hosted.

How can I achieve that?

Thank you for your help

Mauricio
 
Last edited by a moderator:

cPRex

Jurassic Moderator
Staff member
Oct 19, 2014
16,597
2,617
363
cPanel Access Level
Root Administrator
Hey there! There isn't a good way to go about doing this besides recreating the zone files, which would use the new template information. I don't have a good way to apply new template data to existing zone files.

That could be a good feature request idea though - if you get it submitted I'll be sure to approve it.
 
  • Like
Reactions: mlopez

mlopez

Well-Known Member
Dec 17, 2020
76
13
8
Maldonado - Uruguay
cPanel Access Level
Root Administrator
Twitter
Hey cPRex,

Thank you. It'd be great to have this feature.

Anyway, I think I'll be doing this using whmapi with something like this:

Code:
whmapi1 addzonerecord domain=example.com name=imap class=IN ttl=14400 type=CNAME cname=mail.example.com
Regards.
 
  • Like
Reactions: cPRex