[S3] Add option to specify an SSE-C customer provided key#32798
[S3] Add option to specify an SSE-C customer provided key#32798juliusknorr merged 1 commit intomasterfrom
Conversation
|
@CarlSchwan @artonge @icewind1991 please review/test |
artonge
left a comment
There was a problem hiding this comment.
Code looks good, but waiting for the documentation to properly test it :)
|
We only have s3 primary storage documented in the portal so I'd extend the docs over there once merged. However this can be setup by just adding the additional |
|
Possible performance regression detected Show Output |
|
would it not be better to follow the more common standard of base64 encoding the key? |
|
The AWS SDK is taking care of base64 encoding the key when sending it over: It is already possible do so something like: But I agree that we can probable push people to using a wider key-space than ASCII by enforcing to use a base64 encoded one and suggesting to use |
Out of scope of this PR but might be feasible as a follow up. |
27bef6e to
fabfa26
Compare
|
@juliushaertl thank you working on this feature. With the following changes, i got copy operations with your SSE-C implementation working: S3ConnectionTrait.php: S3ObjectTrait.php: |
fabfa26 to
3b5f731
Compare
|
Thanks for testing and good catch with the copy command @ir0nhide I managed to get my test setup for this up and running again, so I added the mentioned changes and rebased to latest master. Ready for review. |
|
@artonge I needed to do a bit of manual setup for testing this locally as minio requires to take care of ssl termination on its own. Steps for testing with [nextcloud-docker-dev environments]
Patch for nextcloud-docker-devdiff --git a/data/additional.config.php b/data/additional.config.php
index 20ca0e7..59e9aa0 100644
--- a/data/additional.config.php
+++ b/data/additional.config.php
@@ -22,10 +22,11 @@ if ($primary === 'minio') {
'secret' => 'nextcloud',
'hostname' => 'minio',
'port' => '9000',
- 'use_ssl' => false,
+ 'use_ssl' => true,
'use_path_style' => true,
'autocreate' => true,
'verify_bucket_exists' => true,
+ 'sse_c_key' => 'o9d3Q9tHcPMv6TIpH53MSXaUmY91YheZRwuIhwCFRSs=',
),
)
];
diff --git a/docker-compose.yml b/docker-compose.yml
index 4ddd9c2..9cadde1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -536,14 +536,20 @@ services:
minio:
image: minio/minio
+ ports:
+ - 9120:9000
+ - 9121:9001
environment:
VIRTUAL_HOST: minio${DOMAIN_SUFFIX}
VIRTUAL_PORT: 9001
+ VIRTUAL_PROTO: https
MINIO_ROOT_USER: nextcloud
MINIO_ROOT_PASSWORD: nextcloud
- MINIO_BROWSER_REDIRECT_URL: http://minio${DOMAIN_SUFFIX}
+ MINIO_BROWSER_REDIRECT_URL: https://minio:9121
+ MINIO_HTTP_TRACE: /dev/stdout
volumes:
- objectstorage_minio:/data
+ - ./data/minio/ssl:/root/.minio/certs
command: server /data --console-address :9001
elasticsearch:Patch for server to disable ssl verification on s3 primary storagediff --git a/lib/private/Files/ObjectStore/S3ConnectionTrait.php b/lib/private/Files/ObjectStore/S3ConnectionTrait.php
index 35c7bdd28d4..998f2c09f3c 100644
--- a/lib/private/Files/ObjectStore/S3ConnectionTrait.php
+++ b/lib/private/Files/ObjectStore/S3ConnectionTrait.php
@@ -132,7 +132,7 @@ trait S3ConnectionTrait {
'signature_provider' => \Aws\or_chain([self::class, 'legacySignatureProvider'], ClientResolver::_default_signature_provider()),
'csm' => false,
'use_arn_region' => false,
- 'http' => ['verify' => $this->getCertificateBundlePath()],
+ 'http' => ['verify' => false],
'use_aws_shared_config_files' => false,
];
if ($this->getProxy()) {
diff --git a/lib/private/Files/ObjectStore/S3ObjectTrait.php b/lib/private/Files/ObjectStore/S3ObjectTrait.php
index bd9905c5fc9..8d2a98912a2 100644
--- a/lib/private/Files/ObjectStore/S3ObjectTrait.php
+++ b/lib/private/Files/ObjectStore/S3ObjectTrait.php
@@ -79,6 +79,9 @@ trait S3ObjectTrait {
'cafile' => $bundle
];
}
+ $opts['ssl'] = [
+ 'verify_peer' => false
+ ];
if ($this->getProxy()) {
$opts['http']['proxy'] = $this->getProxy(); |
3b5f731 to
b0d3e3c
Compare
|
@artonge @icewind1991 Kind ping for another review here :) |
Signed-off-by: Julius Härtl <[email protected]>
b0d3e3c to
159a0c8
Compare
|
Didn't re-review the code, but tested and work fine. Tried big file upload, rename, and download. |
openssl rand 32 | base64'sse_c_key' => 'o9d3Q9tHcPMv6TIpH53MSXaUmY91YheZRwuIhwCFRSs=',https://docs.aws.amazon.com/AmazonS3/latest/userguide/ServerSideEncryptionCustomerKeys.html#specifying-s3-c-encryption