Closed benbjohnson closed 1 year ago
Does this need to be implemented inside litestream, or could it be supported by an external "encryption proxy"? (like https://github.com/abustany/s3proxy - does not seem to be maintained anymore, but the idea seems nice)
For basic replication, you could use a proxy and that'd probably work pretty well.
However, I'm planning on adding hot backups soon so you can have an external server that always has a live copy of your database ready to go instead of having to perform a full snapshot/replay to restore. For that use case, encryption would need to be in Litestream as it needs to encrypt the WAL page data but not the WAL headers. The nice thing about that setup is you could stream your data to an untrusted third-party service and still have everything encrypted.
We added age encryption support downstream for data storage at rest that fully supports normal replication and restore. A replicating Litestream only needs the public keys (recipients) for encryption. The age
CLI tool can also be used to manually decrypt snapshots (and WALs) on a pinch.
I'm more than happy to upstream it as it is fairly trivial but it's based on v0.3.9. We've had it running for a while now without any issues replicating or restoring databases.
https://github.com/beeper/litestream/commit/ac9ad40d7154a6d282efc5ca8f26788daa871434
I suppose the hot backup feature was scrapped with LiteFS?
Hey @hifi could you please push this code somewhere, would be super useful!
@cal97g I linked it in the previous comment.
Currently, Litestream sends cleartext bytes to a replica such as S3. This works well enough for many use cases as S3 buckets are generally secured through IAM. However, other use cases require additional security measures to prevent attackers from obtaining raw data if a bucket is compromised.
Litestream could implement either encryption to prevent data theft and/or signatures to prevent data alteration.