Change A record in WHM upon account creation

Todesengel

Member
Jul 15, 2014
12
1
3
cPanel Access Level
Reseller Owner
Hey guys,

Is it possible to set a custom A record on a zone file during account creation in WHM? I will be trying to use WHMCS to pass in a user field to WHM, to create a custom A record during sign-up so the user doesen't have to go into the DNS Zone editor afterwards.

Thanks,
JP
 

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
833
28
178
Virginia Beach, VA
cPanel Access Level
DataCenter Provider
This leads me to another question, can you assign different zones to different packages?
Unfortunately, cPanel doesn't support zone templates on a per-user or per-package basis right now. I found thread discussing a similar topic:

http://forums.cpanel.net/f145/adding-custom-user-dns-zone-templates-233992.html

However, I do not see that anyone has actually submitted a feature request for this at cPanel Feature Requests.

As a sloppy and slightly embarrassing workaround, you can probably insert the changes into the zone file after account creation by using the postwwwacct script hook:

https://documentation.cpanel.net/display/SDK/Script+Hooks

If you give a little more detail I might be able to assist. Ie, does the record added depend on the package itself, to where a user on a specific package should always have a certain record?
 

Todesengel

Member
Jul 15, 2014
12
1
3
cPanel Access Level
Reseller Owner
Well, I am trying to create a DNS only package. And I would like to give the client the ability to specify certain records during registration.

I want to limit what they can modify in the DNS editor, so I was going to use my own control panel and only display A and CNAME records while limiting CPANEL access for the end user. I got this part working, I just don't know how to let them specify what A and CNAME records they want during registration.
 

vanessa

Well-Known Member
PartnerNOC
Sep 26, 2006
833
28
178
Virginia Beach, VA
cPanel Access Level
DataCenter Provider
When the user signs up, I suppose you could have something where they specify the DNS records they want, then have the script hook pick that data up and create the records after the account is created. Alternatively, you could have your registration system create the records after the account is set up using the API:

https://documentation.cpanel.net/display/SDK/WHM+API+1+-+editzonerecord