Skip to main content

Do backups contain apache userdata?

Comments

5 comments

  • cPanelLauren
    The following is a list of contents of the backups:
    0
  • gramzon
    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.
    0
  • cPanelLauren
    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: /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
    0
  • gramzon
    Thank you for that. It would be nice if an option was added to automatic backups to include cpconf as well.
    0
  • gramzon
    I made a script to automate this process: /usr/sbin/backupcpconf [CODE=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: [CODE=bash]sudo backupcpconf
    To automate using crontab (every day at 03:00): [CODE=bash]sudo sh -c 'echo "0 3 * * * root backupcpconf" >> /etc/crontab'
    0

Please sign in to leave a comment.