Encryption and the master key
Hearth has two levels of file encryption, both turned on by the people who own the files, and one key that you as the administrator must look after: the master key.
Hearth's encryption has not been independently reviewed yet. Treat end to end encryption as a preview until it has.
The two levels
Encrypted at rest. Every file in the folder is stored encrypted (AES-256-GCM in 1 MiB chunks), each file with its own key. The file keys are wrapped by the owner's key, which the master key protects. This protects against a stolen disk, a leaked backup or a storage provider reading the files. Previews, search, sharing, WebDAV and the sync apps keep working, because the server can still decrypt.
End to end. Files and their names are encrypted in the browser before upload. The server keeps random names and sealed bytes and cannot read them, so it cannot make previews, search them, open them in Office or pass them to the Copilot. Each person sets up their own keys in Settings, Encryption, with a passphrase and a recovery key shown once. You cannot open these files, and you cannot recover them for someone who has lost both their passphrase and their recovery key.
People turn either level on for a folder in the folder's details, or for their whole account in Settings, Encryption. For the user's view, see Encrypted folders.
What you see in Administration
Administration, Encryption shows how many folders or accounts are encrypted at rest, how many folders are end to end, and how many are being converted now. Turning encryption at rest on or off for a folder converts the files already there in the background.
Measure end-to-end speed on this device times encryption in your browser, which tells you whether people's computers will notice it.
Hearth never forces encryption at rest on everyone. You can, however, make new top-level folders end to end by default, or require it, for everyone or for some groups, in Administration, Security. See Security policies.
The master key
The master key is the file MASTER_KEY_FILE points to: 32 random bytes,
written as 64 hex characters or in base64. Make it once, at install:
openssl rand -hex 32 > secrets/master.key
It seals every secret Hearth keeps in the database:
- the keys that protect files encrypted at rest;
- two-factor secrets;
- passwords and tokens for external storage, mailboxes and backup targets;
- other sealed values, such as sync and link secrets.
Without the master key none of these can be read. Files encrypted at rest are lost, and people must set up two-factor sign-in and reconnect their storage again.
Keep the master key:
- readable only by the container (mode 600, owner 65532), mounted read only;
- out of the backups of the data, so that a stolen backup does not carry its own key;
- copied somewhere safe and offline, or kept by Hearth's backup as a copy encrypted to an age key you hold (Backups).
Changing the master key
Change it if you think it has leaked.
Make a new key file next to the old one, in the folder that is mounted at
/run/hearth(mount the folder rather than the single file for this change):openssl rand -hex 32 > secrets/master.key.newStop Hearth:
docker compose stop hearth hearth-jobs.Move the at-rest keys over to the new key, in a one-off container that is given the new key as its master key:
docker compose run --rm -T -e MASTER_KEY_FILE=/run/hearth/master.key.new \ hearth crypt reseal --old-master-key-file /run/hearth/master.keyIt prints how many keys were moved.
Replace the old file with the new one (keep the old one apart until you have checked), and start Hearth again.
hearth crypt reseal moves only the keys of files encrypted at rest.
Other secrets sealed with the old key (two-factor secrets, external
storage and mailbox passwords, backup target secrets) are not moved and
become unreadable: people then set up two-factor again and enter those
passwords again. Plan the change, and tell people before you make it.
After the change, update the master key copy in your backups.
A new key for one account or team folder
To give one person's files, or one library that was a team folder, a new at-rest key and re-encrypt everything under it (files, versions and trash):
docker compose exec -T hearth /hearth crypt rotate --owner home:42
docker compose exec -T hearth /hearth crypt rotate --owner tf:7
home: takes the user's id, tf: the team folder's id. Use it when you
suspect one owner's key, rather than the master key, has leaked.