From 2e9139bac8d18a70c525398f445677110126d029 Mon Sep 17 00:00:00 2001 From: Patrick Hobusch Date: Fri, 26 Jan 2024 08:24:41 +0800 Subject: [PATCH] Allow setting AWS S3 SSE-C key (#2151) The AWS S3 SSE-C key for server side encryption can now be set using the environment variable `OBJECTSTORE_S3_SSE_C_KEY`. Signed-off-by: Patrick Hobusch --- .config/s3.config.php | 6 ++++++ README.md | 1 + 2 files changed, 7 insertions(+) diff --git a/.config/s3.config.php b/.config/s3.config.php index 38040ded..374cba2d 100644 --- a/.config/s3.config.php +++ b/.config/s3.config.php @@ -39,4 +39,10 @@ if (getenv('OBJECTSTORE_S3_BUCKET')) { } else { $CONFIG['objectstore']['arguments']['secret'] = ''; } + + if (getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE') && file_exists(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))) { + $CONFIG['objectstore']['arguments']['sse_c_key'] = trim(file_get_contents(getenv('OBJECTSTORE_S3_SSE_C_KEY_FILE'))); + } elseif (getenv('OBJECTSTORE_S3_SSE_C_KEY')) { + $CONFIG['objectstore']['arguments']['sse_c_key'] = getenv('OBJECTSTORE_S3_SSE_C_KEY'); + } } diff --git a/README.md b/README.md index e51a8b3b..6f313954 100644 --- a/README.md +++ b/README.md @@ -191,6 +191,7 @@ To use an external S3 compatible object store as primary storage, set the follow - `OBJECTSTORE_S3_LEGACYAUTH` (default: `false`): Not required for AWS S3 - `OBJECTSTORE_S3_OBJECT_PREFIX` (default: `urn:oid:`): Prefix to prepend to the fileid - `OBJECTSTORE_S3_AUTOCREATE` (default: `true`): Create the container if it does not exist +- `OBJECTSTORE_S3_SSE_C_KEY` (not set by default): Base64 encoded key with a maximum length of 32 bytes for server side encryption (SSE-C) Check the [Nextcloud documentation](https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/primary_storage.html#simple-storage-service-s3) for more information.