Every disk behind Gewape Cloud Object Storage is already encrypted. This adds a second layer that only you control: each file is encrypted with a key that lives in your own project. Remove our storage service's access to that key and the files cannot be read through the service at all until you give it back.
This is called server-side encryption with a customer-managed key (SSE-KMS). It is available for containers in Kigali (https://s3.kgl.gewapecloud.com).
What you need
- A container in Kigali and S3 keys for its project: Get S3 access keys for your Object Storage containers.
- The command line signed in to the same project (step 3 of that article).
- The key manager tool, once:
pip install python-barbicanclient
Step 1: Create your key
openstack secret order create --name my-storage-key --algorithm aes --bit-length 256 --mode ctr key
Copy the Order href from the result, then check the order:
openstack secret order get ORDER_HREF
When Status is ACTIVE, copy the Secret href. The last part of it, after /secrets/, is your key ID.
Step 2: Let the storage service use the key
openstack acl user add --user 4210a22c96d14384b45a8c25d02fef2d --operation-type read SECRET_HREF
This gives our storage service read access to that one key, and nothing else in your project. It is also your off switch: remove it and every file encrypted with the key becomes unreadable at once.
Step 3: Encrypt everything in the container by default
aws --endpoint-url https://s3.kgl.gewapecloud.com s3api put-bucket-encryption --bucket my-container --server-side-encryption-configuration '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"aws:kms","KMSMasterKeyID":"KEY_ID"}}]}'
From now on every upload is encrypted with your key, including uploads that send no encryption settings and uploads through pre-signed links. Your apps need no change. Files already in the container stay as they were: upload them again to encrypt them.
Check it worked
Upload a file, then:
aws --endpoint-url https://s3.kgl.gewapecloud.com s3api head-object --bucket my-container --key my-file.txt
The result shows "ServerSideEncryption": "aws:kms" and your key ID.
Good to know
- Checksums are unchanged. For a normal upload the ETag is still the MD5 of the file, and
Content-MD5checks work as usual. For multipart uploads, each part's ETag is the MD5 of that part, and the final ETag uses the usual MD5-of-parts format with a-Nsuffix. - Separate services work as normal. If you use separate projects for your services (Keep production and test apart, with least-privilege keys), create the key in the data project. Services read and write through the container policy and never need access to the key.
- Switch off access:
openstack acl user remove --user 4210a22c96d14384b45a8c25d02fef2d SECRET_HREF. Switch it back on with theacl user addcommand from step 2. - Never delete the key while files encrypted with it still exist. Without the key those files are gone for good, and we cannot recover them.
If something does not work
- InvalidRequest when uploading or setting default encryption: the container is not in Kigali, or you used another region's endpoint. Use https://s3.kgl.gewapecloud.com.
- AccessDenied or a 500 error on upload or download: the storage service cannot read the key. Run step 2 again with the exact Secret href.
- The secret order stays PENDING: wait a minute and run
openstack secret order getagain.
Need a hand? Use the chat on this page. We can walk through it with you, and we never need your secret keys or your encryption key to do it.