s3-backup icon indicating copy to clipboard operation
s3-backup copied to clipboard

Encryption

Open sandstrom opened this issue 5 years ago • 7 comments

Great action! 🏅

Have you thought about adding encryption support? That way S3/AWS wouldn't be able to read the source code.

sandstrom avatar Oct 22 '19 09:10 sandstrom

Thanks! Hope you find it useful.

I think it might already be possible. This action is just a wrapper around the mirror command of MinOI Client. Looking at the flags available for the mirror command it looks possible to send the necessary secret key/value pair for encryption.

--encrypt value encrypt/decrypt objects (using server-side encryption with server managed keys) --encrypt-key value encrypt/decrypt objects (using server-side encryption with customer provided keys)

ref: https://docs.min.io/docs/minio-client-complete-guide.html#mirror

When I have some time I'll try and test it out and update the README with an example. If you get it working, please let me know!

peter-evans avatar Oct 22 '19 10:10 peter-evans

@peter-evans Interesting!

Unfortunately it seems to be only server-side encryption. AWS can still access/decrypt the data, which is what I wanted to avoid if possible.

I don't know how closely this action is tied to minIO, but if we'd be using the any of the AWS SDKs (Go, Python, Ruby, etc) we could use their built-in client-side encryption.

sandstrom avatar Oct 22 '19 12:10 sandstrom

I'll look into this a bit further and see if there is a way I can add this functionality without rewriting the action completely. I'm thinking that I might be able to call a separate tool or script to do the client-side encryption first before calling the mirror function of MinIO client.

peter-evans avatar Oct 23 '19 01:10 peter-evans

I think that would be useful to a lot of people, since source code is often sensitive and not having to trust the backup location can be quite convenient.

sandstrom avatar Oct 23 '19 08:10 sandstrom

Looked into this a bit more and it seems non-trivial to implement. Even the AWS SDKs do not all support client-side encryption fully. I'm a bit nervous about attempting to write my own implementation and I was hoping to find some existing client or tool to use. I didn't find any stand-alone tool for the encryption part because it seems that the client-side encryption needs to be closely tied to the uploading logic.

The tool that I did find that looks interesting is duplicati. This seems to support client-side encryption and a wide range of options to store the backup, including S3. Would that be of interest to you if I created an action backed by the duplicati client?

peter-evans avatar Nov 01 '19 09:11 peter-evans

I decided to just create the action since someone is bound to find it useful. I'll test it soon and try and get a working example of client-side encryption to S3 working.

https://github.com/peter-evans/duplicati-action

peter-evans avatar Nov 01 '19 09:11 peter-evans

@peter-evans Looks interesting! Will take a look in a while

sandstrom avatar Nov 01 '19 10:11 sandstrom