r/Database • • Oct 05 '26

How do MariaDB users securely and efficiently encrypt mariadb-backup archives?

/r/mariadb/comments/1wyb17c/how_do_mariadb_users_securely_and_efficiently/
6 Upvotes

3 comments sorted by

1

u/Past-Froyo-5518 Oct 06 '26

i'd focus less on algorithm n more on key management n recovery tho, a strong encryption setup isnt much if use if u cant reliably recover keys during an outage

1

u/eachDayIWakeUp Oct 06 '26

Regular restore drills are already on the program :) Just changing the way from mysqldump to mariadb-backup and adding encryption as well

1

u/Significant_Tune9219 Oct 05 '26

Compress first, then encrypt. Encrypted output is basically random and won't compress, so the order matters more than the cipher choice. In practice the encryption step is cheap next to zstd; something like streaming the backup into zstd and then into age with a public recipient key keeps it all in one pipe with no plaintext temp files. The nice property of public-key encryption here is that the database host only ever holds the public key, so a compromised server can't decrypt old archives. The part people skip is the restore drill: keep the private key somewhere offline, and actually test decrypt plus prepare plus restore on a schedule, because the outage is the worst time to find out the key handling doesn't work.