SOLVED cpanel.* and webmail.* subdomains assigned to every account

jndawson

Well-Known Member
Aug 27, 2014
343
38
78
Western US
cPanel Access Level
DataCenter Provider
This is a weird situation (yes, another one).

We have a server that we absorbed from another hosting company. At some point in their past history, they assigned the aliases cpanel.* and webmail.* to each account.

To be clear, the asterisk is NOT a wildcard - it's the actual entry. Every account (almost) has two aliases assigned (cpanel > domains > aliases). (see attached pic)cpanel_alias_issue.png

Trying to delete the alias within cpanel results in:
Code:
There was a problem removing the alias. Park::unpark failed: You do not have control of the domain “cpanel.”.
Using whm > account information > list parked domains sometimes shows one account with the alias cpanel.*, webmail.* and sometimes whm.*. Those always have the 'add to mail config' link showing, as well. Removing the parked domain sometimes results in success, but always lists an account different from the one we're removing. It also has no affect on what shows up in the cpanel tools.

One example (imagine a grid):

Code:
Primary Domain 
customerdomain.tld

User
username

Parked Domains
cpanel.*
customerdomain2.tld
webmail.*

Action
Unpark   Add to Mail Config
Unpark
Unpark   Add to Mail Config
Removing cpanel.*:
Code:
There was a problem unparking cpanel.* from : Show Details
The system cannot determine the base domain for “cpanel.*” (i.e., the domain on which “cpanel.*” is parked).
We've checked all the files that we can find that have anything to do with domains, subdomains, aliases, etc; if we find an entry, it's usually related to only one domain, and after getting that deleted in the related file, the alias remains and the other aliases are all still assigned to the other domains.

updateuserdomains, fixvaliases do not correct the issue, nor does any other domain-related script.

Where does whm/cpanel manage these relationships and how do we fix them?

Centos 6.9
WHM 66.0.15

cpanel_alias_issue.png
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

Check to see if the entries for those aliases exist in the userdata directory associated with each account:

/var/cpanel/userdata/$username/

You can search the files in those directories for aliases with a command such as this:

Code:
grep serveralias /var/cpanel/userdata/$username/*
Or, if you don't see the entries there, see if you notice any local Apache template files in the following directories:

/var/cpanel/templates/apache2_4/
/var/cpanel/templates/apache2/

Thank you.
 

jndawson

Well-Known Member
Aug 27, 2014
343
38
78
Western US
cPanel Access Level
DataCenter Provider
Check to see if the entries for those aliases exist in the userdata directory associated with each account:

Code:
/var/cpanel/userdata/$username/
Nope, not there.

You can search the files in those directories for aliases with a command such as this:

Code:
grep serveralias /var/cpanel/userdata/$username/*
Yep. Here's a sample of a simple entry:
Code:
grep serveralias /var/cpanel/userdata/*/*|grep cpanel

/var/cpanel/userdata/username/customerdomain.tld:serveralias: cpanel.* mail.customerdomain.tld webmail.* www.cpanel.* www.customerdomain.tld www.mail.customerdomain.tld www.webmail.* cpanel.* webmail.*
We have many to deal with:

Code:
[ Tue Aug 29 10:03:29 ]
[ [email protected] userdata># grep serveralias /var/cpanel/userdata/*/*|grep cpanel|wc -l
1542
[ Tue Aug 29 10:04:54 ]
[ [email protected] userdata># grep serveralias /var/cpanel/userdata/*/*|grep webmail|wc -l
1530
Or, if you don't see the entries there, see if you notice any local Apache template files in the following directories:

/var/cpanel/templates/apache2_4/
/var/cpanel/templates/apache2/
Nope.

So now the question is, is there an easy fix or do we need to write a script to remove those (not a big deal, actually)? What else do those files affect, and will we need to make other changes?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,258
463
Hello,

You'd need to manually remove those entries from the ServerAlias lines (e.g. cpanel.*, webmail.*). There's no script to do this automatically, so you'd need to develop a script to do so if necessary. The userdata files are used to populate the Apache configuration file, so remember to rebuild it after making the changes:

Code:
/scripts/rebuildhttpdconf
Thank you.
 

jndawson

Well-Known Member
Aug 27, 2014
343
38
78
Western US
cPanel Access Level
DataCenter Provider
More follow up:

We were still seeing the sporadic cpanel.* or webmail.* entries in various accounts' zone editors. In the middle of doing something else, we were looking at account files in /var/cpanel/users and noted many accounts had these entries:
Code:
DNS=domain.tld
DNS2=cpanel.*
DNS3=webmail.*
We removed them using a script and ran /scripts/updateuserdomains.

Hopefully, that finally fixes it. Still no clue how those entries showed up in the first place.