Every night, each Chudora tool produces a backup of its data. These archives are encrypted, but the key needed to read them back is not on the server. Here is why, and how it is organized.
The problem with an unencrypted backup#
A backup contains everything: pages, projects, files, accounts. If it is stored unencrypted, anyone who gets hold of it can read all of it. And a backup travels: it is copied off the server, kept for several weeks, sometimes forgotten in a folder.
Encrypting backups solves this problem, as long as the key is not stored next to them. If the key is on the same server as the archive, anyone who can reach the archive can also reach the key.
Two keys, two roles#
So I use two different keys, following the principle of public-key encryption:
- the public key is on the server. It can encrypt, but not decrypt;
- the private key is not on the server. Only it can decrypt, and it is kept offline.
Every night, the backup script draws a random key specific to that archive, and encrypts the archive with it (AES-256-GCM). Then it encrypts that random key with the public key and stores it in the archive. To read the archive back, you first have to decrypt the random key, which requires the private key.
The result: even with full access to the server, backups that have already been made cannot be read.
One archive per organization#
Each tool stores each organization's data in a separate database (see one database per organization). Backups follow the same split: one encrypted archive per organization and per tool, every night.
This split has two advantages:
- restoring one organization's data does not touch the others;
- handing an organization a copy of its data does not hand over anything belonging to another.
How long they are kept#
Archives follow two retention periods:
- 14 days on the server, for a quick restore;
- 60 days off the server: every morning, an administration computer retrieves the night's archives and stores them in a local folder.
Before each new backup, the script cleans up and removes archives that are too old. So a backup does not keep indefinitely the data an organization has deleted.
What the tools offer before a restore#
Restoring from a backup is a heavy operation: it puts an entire space back to its state on a given night. For everyday mistakes, the tools have their own safety nets:
- Agartha keeps the history of every page, with comparison and restore;
- Danimage keeps up to fifty versions per file, and a thirty-day trash.
The backup remains the last resort, for an outage or a serious mistake.
General rules#
If you set up backups, a few rules apply whatever the tool:
- the decryption key must not live next to the archives;
- the private key must itself be copied to a safe place, in several locations: without it, the archives are lost;
- backups must leave the server: a destroyed server takes the copies it hosts with it;
- a retention period must be set and enforced, both out of respect for the data and for disk space.
The tools' other protective measures are described on the Security page.