cPanel behind NAT - DNS Zone Template

emilysnothere

Registered
Sep 20, 2011
1
0
51
cPanel Access Level
Root Administrator
Our cPanel / WHM is setup behind a NAT firewall, therefore, everytime a new hosting account is created all the A records are set to the IP behind the NAT firewall not the public IP. We have to manually go into 'edit DNS zone' and update all the A records. This also means that when a user adds on domains/ parked domains we have to manually go in and edit them, which is difficult if we don't know a client has added these to their hosting account.

I have made the appropriate changes to the Zone Template so that the %domain$ IN A and ftp IN A are our public domains. When a new hosting account is created and they add an addon domain these are fine. However, the cpanel, whm, webmail, webdisk and any subdomains still have the internal IP.

Is there anyway to change settings somewhere that these get updated with the public IP as well, rather than us having to manually change these each time a hosting account is created or a user adds a parked domain onto their hosting account?

In addition, does it really matter if these point to the internal IP rather than the public IP? Will people still be able to get to the sub domain since the domain A record is correct?


tl;dr - how can I code all the A records (not just those in Zone Template Editor) to have correct public IP not NAT IP? :eek:
 

fcbinfo

Well-Known Member
Dec 10, 2006
111
3
168
cPanel Access Level
Root Administrator
Same problem here. The best datacenter of my country uses cloud server behind a nat, every account added i need to edit manualy

cpanel 14400 IN A 10.1.146.2
whm 14400 IN A 10.1.146.2
webmail 14400 IN A 10.1.146.2
webdisk 14400 IN A 10.1.146.2

Are you have found a solution?
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator

fcbinfo

Well-Known Member
Dec 10, 2006
111
3
168
cPanel Access Level
Root Administrator
Let's see if I understand it. Only need to create a file inside the folder /scripts named postwwwacct ?

Inside this file, what i need to write?

Thank you again Tristan! But i think this will help a lot of people.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
Right, you'd need to create a file inside scripts called postwwwacct and have code to revise the zone template that is created.

As for what you would need to write, that's a coding question and normally we allow the user to read through the documentation and determine how to code the correct script.

You are welcome to try to review the documentation and, once you've gotten some script setup if it isn't working, to post over in the developer section to ask questions on it:

cPanel Developers
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator

fcbinfo

Well-Known Member
Dec 10, 2006
111
3
168
cPanel Access Level
Root Administrator
Tristan... there's no file to edit this cpanel whm webdisk webmail entries like dns zone templates?

Where cpanel get this configurations on create accounts?

Have not found on

/usr/local/cpanel/cpupdatepatches/var/cpanel/zonetemplates/__revision1/patches
/usr/local/cpanel/etc/zonetemplates
/var/cpanel/zonetemplates
 
Last edited:

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
That's why I suggested to use a /scripts/postwwwacct hook instead, which you did ask for in the developer area.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
40
248
somewhere over the rainbow
cPanel Access Level
Root Administrator
You should put the internal IP in /etc/hosts as far as I am aware, since /etc/hosts also works along with your networking files and those all use the internal IP.

Of note, you will keep getting a warning about /etc/hosts and the hostname by cPanel due to this, but so long as it is working for the translation, the warning can be ignored.
 

gruvin_nz

Registered
Aug 16, 2007
1
0
51
cPanel should not be installed behind a NAT. Many threads on this topic around the forum.
If it's quite OK for you., we and many hundreds more as time go on will keep hammering cPanel to include support for this nowadays basic requirement "in the cloud".

Cloud servers everywhere use NAT -- not all of them, but I believe soon most, if not all. Some believe IPv6 will replace the need for that. They are wrong. Many servers in an organisations private cloud be required to remain behind NAT for obvious security reasons.

It is obvious to me that people at the top of the cPanel organisation have outdated personal opinions about NAT, perhaps going back to people running cPanel on home DSL connections and thus defiling the quality reputation of the product. It is a shame in my humble opinion that the world's leading control panel cannot get themselves out of the mud and catch up with reality. Many of us are hoping, waiting patiently for this attitude to change.