Do backups contain apache userdata?

gramzon

Active Member
Dec 4, 2017
34
5
58
Croatia
cPanel Access Level
Root Administrator
Does a full WHM backup include the files in the /etc/apache2/conf.d/userdata/ directory?
I am looking inside system_files.tar but can't find these files anywhere.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston

gramzon

Active Member
Dec 4, 2017
34
5
58
Croatia
cPanel Access Level
Root Administrator
So the answer is no. Which is kind of disappointing considering that location can contain a lot of important configuration like security headers, access control, modsec exclusions, ssl redirects, proxypasses etc.
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,304
363
Houston
Hi @gramzon

I've been looking for a solution for you and I just realized that the cpconftool will backup what you're looking for, I believe. When you use the cpconf tool to backup configurations it backups up the following files for Apache configuration:

Code:
/etc/cpanel/ea4
/var/cpanel/easy
/etc/apache2/conf.d
/etc/apache2/conf
/usr/local/apache/conf
/var/cpanel/secdatadir
/var/cpanel/modsec_cpanel_conf_datastore
/var/cpanel/conf/apache/main
/var/cpanel/conf/apache/local
/usr/local/apache/conf/includes
/var/cpanel/templates/apache*/*local
The documentation on the cpconftool can be found here: The cpconftool Script - Version 82 Documentation - cPanel Documentation
 

gramzon

Active Member
Dec 4, 2017
34
5
58
Croatia
cPanel Access Level
Root Administrator
I made a script to automate this process:

/usr/sbin/backupcpconf
Bash:
#!/bin/bash
NAME="cpconf-"$(date '+%Y-%m-%d')".tar.gz"
ID="[private key location]"
RUSER="[backup server user]"
RHOST="[your backup server]"
RPORT="[backup server port]"
RDIR="~/cpconf/"
LDIR="/cpconf/"

CONFS=$(/usr/local/cpanel/bin/cpconftool --list-modules)
for CONF in $CONFS; do
  /usr/local/cpanel/bin/cpconftool --backup --modules=$CONF
done;
mkdir -p $LDIR
chmod 700 $LDIR
tar cfz $LDIR$NAME /home/whm-config-backup*
rm -rf /home/whm-config-backup*
rsync -rvz -e 'ssh -p '${RPORT}' -i '${ID} $LDIR $RUSER@$RHOST:$RDIR
To run manually:
Bash:
sudo backupcpconf
To automate using crontab (every day at 03:00):
Bash:
sudo sh -c 'echo "0 3 * * * root backupcpconf" >> /etc/crontab'
 
Last edited:
  • Like
Reactions: cPanelLauren