Skip to main content

Overview

xorlab supports manual as well as scheduled automatic backups that can be used to restore the system after a failure. Backups are either full or incremental:
  • Full backups are self-contained and do not depend on previous backups, which makes them more robust than incremental backups.
  • An incremental backup only saves changes made since the last backup (full or incremental) hence it is faster, but it depends on earlier full/incremental backups. XCC will always trigger a full backup if no full backup can be found.
  • A sequence that begins with a full backup and may include any number of incremental backups is called a backup chain.
Backups are disabled by default on on-premises VMs, as the host VM itself is typically backed up via the hypervisor. Should you choose to use xorlab’s backup functionality, it is recommended to schedule weekly full backups over the weekend and daily incremental backups. Backup (and recovery) are done only on the XCC VM, as MTAs do not store data. Host configuration files, e.g. files in /etc/xorlab/ are also not covered by the backups. Hence, it is recommended to regularly take snapshots of all VMs, at least after every update of xorlab.

Quick setup

  1. Open the Expert Editor and navigate to the /xcc/backend/xcc.yml.
  2. Enable the backup service, and if needed, adjust the schedule for full and incremental backups, and the retention policy.
    In this example, incremental backups occur daily from Sunday to Friday at 12:00 and 21:00. A full backup is taken on Saturday at 01:00. Incomplete chains, e.g. incremental backups without a full backup, will be removed. Long running backups get aborted after 72 hours, which should be sufficient for typical email load and data retention settings. See Backup Settings for more details.
  3. SSH to the XCC, open /etc/xorlab/xcc/.env and adjust the location of BKP_BASE_DIR, the directory where backups will be saved:
  4. Click Publish, then restart the xcc_backend container to apply the changes. The general backup settings in xcc/backend/xcc.yml require an XCC restart; see How to Activate the Configuration:
  5. Optionally, we recommend integrating/sending the backup events sys.backup.* to your SIEM or centralized monitoring system, if available. This will allow you to be notified if a backup fails.

Backup

Software versions compatibilityThe compatibility of backups between major/minor versions (e.g. 9.1.0 and 9.0.0) is not guaranteed. Hence, when the XCC runs on a new version, the next scheduled backup will always be a full backup automatically.It is recommended to perform an incremental backup before a software upgrade and a full backup immediately afterward.
Backup Service does not back up any host related configuration, e.g. firewall, /etc/xorlab directory, etc.
Each backup (full or incremental) consists of the info.json metadata file and four module files:
  • Assets - contains the assets required by the XCC web interface and the quarantined messages.
  • ConfigRepos - contains the xorlab configuration for each platform component.
  • Redis - contains the metadata used for similarity matching.
  • Database - contains the database contents with the metadata of each message analyzed by xorlab.
An example of all files for a full and two incremental backups:
Each file follows the naming schema:
It starts with the backup- prefix followed by the UTC timestamp, which corresponds to the time when the backup was scheduled/triggered. The name further contains the type of the backup and the name of the module that created it. The file ending in info.json contains meta-data about the backup. If the backup service is enabled, XCC saves backups to the chosen backup directory according to the backup schedules.

Backup directory

Backups will take up a significant amount of disk space. In order to not interfere with normal operations, e.g. by using up all available disk space, it is strongly recommended to keep the backup directory on a different mount point than the other production data. By default, the backup directory is set to /backups. You can change it in /etc/xorlab/xcc/.env:
This backup directory (BKP_BASE_DIR) is mapped to /var/lib/xorlab/xcc/backup/backups in the backend container, as configured in /etc/xorlab/xcc/docker-compose.yml:

Backup schedule

The backup schedule syntax uses the Quartz cron format, and can be edited in /xcc/backend/xcc.yml via the Expert Editor. The pattern represents: second, minute, hour, day, month, weekday. Month and weekday names can be given as the first three letters of the English names. Here are a few examples:
  • 0 0 6,19 * * *: at 6:00 and 19:00, every day.
  • 0 0 9-17 * * MON-FRI: every hour from 09:00 to 17:00, on weekdays.
  • 0 0 0 * * SUN: every Sunday at midnight.
  • "-": Never/disabled.
The default configuration schedules incremental backups daily from Sunday to Friday at 12:00 and 21:00, and a full backup on Saturday at 01:00. Note that the cron schedules are mutually exclusive (no incremental backup scheduled for Saturday):
After editing the backup schedule in the Expert Editor, click Publish and restart the XCC. These general xcc/backend/xcc.yml settings require an XCC restart; see How to Activate the Configuration. You can use online tools, such as Cron Expression Generator & Explainer or crontab guru, to verify that your cron schedule. Be mindful, that crontab guru follows the standard cron syntax (no seconds field).
Incremental backup scheduleEven if an incremental backup is scheduled, XCC will do a full backup if one of the following conditions apply:
  • XCC runs on a more recent minor version (after an update full backup is scheduled automatically).
  • There is an incomplete full backup that can be resumed.
  • No previous backup is found in the backup directory.

Backup settings

By default, automatic backup deletion is enabled. Only the current backup chain is kept (and one additional one related to the last minor release), and the dangling incremental backups (without associated full backup as their base) will be deleted. Here’s the list of all backup configuration options that can be set in /xcc/backend/xcc.yml.

Manual backup

When you need to create backups manually—for example, when the automatic backup was performed a couple of days ago and you want to make some substantial changes such as upgrading to a new xorlab version—you can can trigger a backup manually from the XCC web interface.
  1. Log in to the XCC web interface.
  2. On the main screen, click the tiles icon next to your account name and click the Admin icon in the displayed menu:
  3. Open the Backup page: Backup tile
  4. Press the New Incremental Backup button, or choose New Full Backup: Backup page

Recovery

xorlab will automatically start a recovery procedure during startup, if the recovery folder contains a valid backup. This recovery will overwrite the current data. Make sure to only populate the recovery folder if you want to recover from a backup.
If you require assistance, or are in doubt, do not hesitate to contact us via support@xorlab.com.
The recovery process starts automatically if the backend service finds backup files in the recovery directory during startup. It will commence with the most recent full backup and proceed to apply all subsequent incremental backups. Here are the steps needed to perform a recovery:
  1. Restore Host Configuration
  2. Populate Recovery Directory
  3. Start Recovery Process
  4. Clear Recovery Directory
  5. Re-start xcc Stack
  6. Re-synchronize Elastic indices

Restore host configuration

Host configuration, that was changed during an update, is backed up to /etc/xorlab/backup/.

Populate recovery directory

If there is only one backup chain in the backup folder, you can simply set the recovery folder to the backup folder and skip step 1. & 2. In case of several backup chains, move the backup chain you would like to recover to a separate recovery folder. It is recommended to use a path on the same mountpoint as the backup directory, so that moving the backups to the recovery directory does not involve actual disk IO. Assuming /backups is used as the backup directory:
  1. Create a subfolder recovery owned by xcc_backend
  2. Move the backup you want to restore to the recovery folder, e.g.:
  3. Configure your recovery folder in docker-compose.yml. In the following example, we use ${BKP_BASE_DIR}/recovery:
    /etc/xorlab/xcc/docker-compose.yml

Start recovery process

  1. Make sure all containers from the xcc stack are stopped:
  2. This step is only required when recovering from a backup that has been taken with an older major or minor version than the one currently running on XCC.
    1. Delete the existing DB:
    1. Delete existing Elastic data:
  3. Start PostgreSQL—the database has to be running to recover its data:
  4. Start the backend service:
    and observe the logs. After a few seconds status reports similar to the following will be shown:
  5. Once the recovery is complete, the JVM in the xcc_backend container will shut down with exit code 3, and you will see this line:
  6. Ctrl+C to close the logs and stop the container.
Errors from pg_restorexorlab uses pg_restore to restore backups. All log lines containing Found expected (non-)error from pg_restore can be safely ignored as they do not influence the recovery.

Clear recovery directory

Restore the original bind mount in docker-compose.yml. To avoid an accidental second recovery, the mapped folder ${WRK_BASE_DIR}/backup/recovery, which is /var/lib/xorlab/xcc/backup/recovery/ with default settings, must be empty.
/etc/xorlab/xcc/docker-compose.yml

Re-start XCC stack

Ensure that the Elastic stack is running, if it was previously stopped, run:
and restart xcc stack:

Re-synchronize elastic indices

During the recovery process, elastic indices are automatically marked for re-synchronization, but need to be deleted manually (they will be re-synchronized from the database automatically). Otherwise, the XCC web interface will still show the emails from before the recovery in the search overview. To trigger re-synchronization:
  1. Ensure that the Auth stack is running, if it was previously stopped, run:
  2. Open the XCC web interface and go to Insights from the sidebar menu.
  3. Open any of the dashboards, a new tab will open.
  4. Expand the Elastic side menu on the left and open Stack Management located under the Management section.
  5. Open Index Management located under the Data section (from the updated left side menu).
  6. Search for the xcc_result_publish_<version>.
  7. Check the box to the left of the result.
  8. Press the blue Manage index button, and choose Delete Index.
  9. Stop the xcc_backend container:
  10. Mark data for re-synchronization with:
  11. Start the xcc_backend container:
The analyst dashboard will appear empty or incomplete while data is being re-synchronized. Depending on the amount of emails, it may take minutes to hours until this process is completed.

Recovery directory cleanup

If you created a separate recovery folder in step Populate Recovery Directory, move the backup chain back to the backup folder, as xorlab will not clean up old backup chains from folders other than the backup folder.

Patch rollback

If the patch upgrade was not successful, it’s possible to revert the changes. All components can be restored to the previous patch version (unless stated otherwise in the release notes) by performing the following steps:
  1. Set the version variables (*_VERSION) to the previous patch version in the /etc/xorlab/<component>/.env file.
  2. Restart the component:
For example, to roll back the xcc component from 11.0.1 to the 11.0.0:
  1. Set the version variables to the 11.0.0:
    /etc/xorlab/xcc/.env
  2. Restart the xcc component:
In case the patch rollback fails, please refer to the Recovery section, to perform a restore from the backup chain created before the update.