RandomMcBob

Registered
Jan 27, 2014
4
0
1
cPanel Access Level
DataCenter Provider
Hello

I work for a hosting company which provides both dedicated and virtualised servers and we have been trying to find a decent way to 'clean' old config from our cPanel VM image. To give a little more info, we maintain a cPanel image with all the config changes we like and just image a customer's VM with it when they order one - anything like hostnames etc are set by part of the setup action. This image has been updated on several different VMs and as a result of this has a lot of cruft related to those older machines - obviously this doesn't hinder the image working, but it would be good to remove all this so we are only left with the details of the current testing VM, rather than 4 or 5 older ones.

I've done a lot of searching etc to find and remove references to these older VMs, but as the config files are spread all over the place, this proves very difficult. Is there any kind of script that anyone has ever come across which would 'clean' this information for us?

Thanks in advance
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,880
2,267
463
Hello :)

You may want to consider simply making a new image with the existing custom changes you would prefer to preserve. This would ensure that previously saved configuration values that are no longer utilized do not exist.

Thank you.
 

ThinIce

Well-Known Member
Apr 27, 2006
352
9
168
Disillusioned in England
cPanel Access Level
Root Administrator
I think this may be one of those kettles of fish I keep hearing about :) From what I've seen in practice and from discussions in the past there is no / no intent to produce a list of items that should / could be sanitised when deploying installs in this manner.

There are plenty of people out there doing it, and I think the docs should either feature a "don't do it because..." statement (the opinion I now sit with), or include a list of things that at the absolute minimum should be wiped / set fresh for each new deployment of the image (i.e. obvious ones like the mysql root password - obvious obviously being a relative concept...)
 

RandomMcBob

Registered
Jan 27, 2014
4
0
1
cPanel Access Level
DataCenter Provider
I think this may be one of those kettles of fish I keep hearing about :) From what I've seen in practice and from discussions in the past there is no / no intent to produce a list of items that should / could be sanitised when deploying installs in this manner.

There are plenty of people out there doing it, and I think the docs should either feature a "don't do it because..." statement (the opinion I now sit with), or include a list of things that at the absolute minimum should be wiped / set fresh for each new deployment of the image (i.e. obvious ones like the mysql root password - obvious obviously being a relative concept...)
Yes, I'm afraid that I had assumed that this is the case. The cPanel filesystem is so spread out that I think an effort to catalog it would be an absolute nightmare. I've made use of a load of greps and I think I've managed to track down the majority of the references to old hostnames, so I think that's going to have to do.
 

ThinIce

Well-Known Member
Apr 27, 2006
352
9
168
Disillusioned in England
cPanel Access Level
Root Administrator
I suppose the log location and config file location posters could be used as a base for the minimum to grep through - I'd also wonder about caches though...
 

RandomMcBob

Registered
Jan 27, 2014
4
0
1
cPanel Access Level
DataCenter Provider
I ran a recursive grep through the entire filesystem and established what directories I needed to look in - these are all cleaned, but as you rightly pointed out, caches still return positive results. Is it safe to remove them? i.e. will they be recreated upon boot?