Commit Graph

70 Commits (e3edf43e28e9b640cece9ccd2baf4e232ffe18c7)

Author SHA1 Message Date
Fiehe Christoph b87add2711
fix(s3): expose request_checksum_calculation and response_checksum_validation
Fix https://github.com/nextcloud/server/issues/56077

This commit makes the configuration settings 'request_checksum_calculation' and 'response_checksum_validation' of the S3Client from the AWS SDK for PHP configurable.

Signed-off-by: Fiehe Christoph  <c.fiehe@eurodata.de>
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2025-10-30 11:57:32 +07:00
Ferdinand Thiessen 5981b7eb51
chore: apply new CSFixer rules
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>

# Conflicts:
#	apps/settings/lib/SetupChecks/PhpOpcacheSetup.php
2025-07-01 16:26:50 +07:00
Daniel Calviño Sánchez d7ae952dc8 fix(ObjectStore): Make S3 "connect_timeout" option configurable
The hardcoded connection timeout of 5 seconds may not be enough in some
cases, so now it is got from the ObjectStore arguments in Nextcloud
configuration, falling back to 5 if not set.

The connection timeout is set in seconds, but decimal precision can be
used for subsecond accuracy (for example, 4.2 for 4200 milliseconds).

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
2025-06-16 20:17:50 +07:00
Anna Larch 49baa914cf fix(objectstorage): add retry attempts to S3 connection
Signed-off-by: Anna Larch <anna@nextcloud.com>
2025-04-23 12:15:06 +07:00
Hector Valcarcel 6b4c859a41 feat(object_store): Add support for session token in AWS credentials
- Pass session token, either null or with value, to the AWS Credentials constructor

Signed-off-by: Hector Valcarcel <hmvalcarcel@gmail.com>
2025-02-06 16:24:19 +07:00
Richard Steinmetz f1c025dfd3
fix(s3): treat empty sse_c_key as not set
Co-authored-by: Christian Becker <christian@dabecka.de>
Signed-off-by: Richard Steinmetz <richard@steinmetz.cloud>
2025-01-28 22:59:59 +07:00
Robin Appelman df3a9e221d
fix: throw correct exception type when we can't verify if an s3 bucket exists
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-11-26 16:49:55 +07:00
Daniel Kesselberg af6de04e9e
style: update codestyle for coding-standard 1.2.3
Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
2024-08-25 19:34:58 +07:00
Git'Fellow c84e76a749 fix(s3): Don't wait indefinitely for S3 to return
Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

fix: lint

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

fix: use AwsException

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

fix: Throw on connection failure

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

fix: Wrap all in try catch block

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

fix: use RequestTimeout error message

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

log: use OCP Server class

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

fix: Handle connect timeout only

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>

fix: Handle errors more generically

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
2024-07-05 16:24:32 +07:00
Ferdinand Thiessen ae1f5cc56d
fix(S3): Adjust usage of guzzle promise
`Promise\promise_for` was deprecated and is now removed and replaced with the static API (`Create::promiseFor`).

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-06-16 15:54:44 +07:00
Josh 63886147ba fix(ObjectStore): handle empty S3 hostname
Fixes #45637

The support for s3-accelerate added in #44496 introduced a regression in AWS S3 environments when `hostname` is blank (which is a valid configuration w/ AWS since the hostname gets auto-generated).

Signed-off-by: Josh <josh.t.richards@gmail.com>
2024-06-12 15:43:20 +07:00
Andy Scherzinger dae7c159f7
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-24 13:11:22 +07:00
Robin Appelman 40d9a3fcab
feat: add option to enable s3 acceleration
Signed-off-by: Robin Appelman <robin@icewind.nl>
2024-04-26 14:40:24 +07:00
Ferdinand Thiessen 32dee2f84a
feat(ObjectStore): Make S3 MultipartUpload concurrency configurable
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-03-21 16:25:49 +07:00
Ferdinand Thiessen 69c5e8ebde
fix(ObjectStore): Use common S3 trait so config and connection trait members are in sync
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-03-21 16:25:42 +07:00
Julius Härtl e4054370b1
fix(s3): Add config option to disable multipart copy for certain s3 providers
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-12-28 15:31:38 +07:00
Robin Appelman 1043c21b35
only do a multipart s3 copy when above the regular copy limit
Signed-off-by: Robin Appelman <robin@icewind.nl>
2023-12-28 15:31:37 +07:00
Hamid Dehnavi ea06cf2f39 Convert isset ternary to null coalescing operator
Signed-off-by: Hamid Dehnavi <hamid.dev.pro@gmail.com>
2023-09-28 17:44:19 +07:00
Thomas Citharel 3f28fc58aa fix(s3): fix handling verify_bucket_exists parameter
If 'verify_bucket_exists' is set to false in the config.php s3 configuration, it's supposed to avoid
verifying that the bucket exists. However empty(falsy) will  always return true, so this condition
would not work.

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
2023-08-31 21:36:03 +07:00
Julius Härtl 159a0c8411
feat(s3): Add option to specify an SSE-C customer provided key
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2023-01-24 10:36:03 +07:00
François Ménabé cf9bdc0274 Manage s3 storage class in objectstore
Signed-off-by: François Ménabé <francois.menabe@gmail.com>
2023-01-12 14:58:27 +07:00
Jasper Weyne 44f6c931e7
Merge branch 'master' into patch-2 2022-08-11 08:54:08 +07:00
Robin Appelman f1486890d7
only use nextcloud bundle when explicitly enabled
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-07-05 16:06:55 +07:00
Robin Appelman bffa67c48b
also use nextcloud certificate bundle when downloading from s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-07-05 15:57:54 +07:00
Jasper Weyne 0633a1d9f5
Disable ~/.aws/config access by S3ConnectionTrait
This commit sets the 'use_aws_shared_config_files' option to false, in order to disable configuration loading from ~/.aws/config by the AWS SDK, specifically the S3Client. It is a continuation of #27040, as that PR only changed the behaviour of the CredentialsProvider; this change affects the ConfigurationProvider as well.

Signed-off-by: Jasper Weyne <jasperweyne@gmail.com>
2022-06-07 13:39:14 +07:00
Côme Chilliet 069477e608
Migrate more classes of lib/private to LoggerInterface
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
2022-04-26 16:52:52 +07:00
Robin Appelman 1156214a26
don't try to get custom certs for s3 primary storage
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-15 15:50:08 +07:00
Robin Appelman 194a21f374
use the nextcloud certificate bundle for s3
Signed-off-by: Robin Appelman <robin@icewind.nl>
2022-03-14 18:09:48 +07:00
Julius Härtl 2aac757805
Make max size for single put uploads configurable
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-12-29 13:30:22 +07:00
Julius Härtl e475dfe16c
Fix php-cs for S3ConnectionTrait.php
Signed-off-by: Julius Härtl <jus@bitgrid.net>
2021-12-21 21:35:46 +07:00
Stephen Cuppett 4a6a2c2b48 Simplify S3ConnectionTrait to defaultProvider plus option
When we initially added the EC2 and ECS IAM role support in #24700,
we had to use a workaround by explicitly ordering the various providers
due to an inconsistency in the AWS SDK for PHP. We submitted a PR there
to get that squared away. Now, we've consumed that version upstream
for the SDK and can update our code here to be the most concise version
as well as position ourselves to pick up new methods as those become
available and prevalent in AWS (for acquiring credentials).

See also: https://github.com/nextcloud/server/pull/24700#issuecomment-747650892
See also: https://github.com/aws/aws-sdk-php/pull/2172

Signed-off-by: Stephen Cuppett <steve@cuppett.com>
2021-11-22 07:04:48 +07:00
Bernd Rederlechner 3866f388b1
Refactor writeObject to only use MultipartUpload when required
Signed-off-by: Bernd Rederlechner <Bernd.Rederlechner@t-systems.com>

Co-authored-by: Julius Härtl <jus@bitgrid.net>
2021-08-20 17:02:25 +07:00
Julius Härtl 3e67637a4a
Merge pull request #26463 from Worteks/fix-s3proxy 2021-07-14 23:32:05 +07:00
Maxime Besson 388a458cd5 fix(proxy): use accessor
Signed-off-by: Maxime Besson <maxime.besson@worteks.com>
2021-06-30 09:25:04 +07:00
John Molakvoæ (skjnldsv) 215aef3cbd
Update php licenses
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
2021-06-04 22:02:41 +07:00
Florent d4444f2472
Avoid reading ~/.aws/config when using S3 provider
When using S3 storage, we sometimes have open_basedir errors due to aws-sdk-php trying to read ~/.aws/config which is out of open_basedir restrictions.
Christoph Wurst already added csm=false config in #21406 but it wasn't enough, we also need to set use_arn_region=false, added in this commit.

Signed-off-by: Florent <florent@coppint.com>
2021-05-20 12:21:15 +07:00
Samuel 03fe74b95e fix(proxy): reaching s3 storage behind some http proxy
Signed-off-by: Maxime Besson <maxime.besson@worteks.com>
2021-04-09 10:15:57 +07:00
Roeland Jago Douma 137636b651
Merge pull request #24700 from Imajie/s3-creds
Resolves #24699, Support ES2 and ECS instance providers for S3 buckets
2021-02-02 21:48:22 +07:00
Christoph Wurst d89a75be0b
Update all license headers for Nextcloud 21
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-12-16 18:48:22 +07:00
James Letendre 45a02ee30c Fix failing tests
Signed-off-by: James Letendre <james.letendre@gmail.com>
2020-12-15 19:06:06 +07:00
James Letendre ad95e51cbe Add web identity provider to S3 connection chain
Signed-off-by: James Letendre <james.letendre@gmail.com>
2020-12-15 16:37:46 +07:00
James Letendre 5b756a9fb0 Replace defaultProvider with explicit calls to exclude user home directory lookup
Signed-off-by: James Letendre <james.letendre@gmail.com>
2020-12-14 16:22:41 +07:00
James Letendre 85aa77539b Resolves #24699, Support ES2 and ECS instance providers for S3 buckets
Signed-off-by: James Letendre <james.letendre@gmail.com>
2020-12-14 12:55:46 +07:00
Roeland Jago Douma 65141d4864
Allow config to specify the bucket exists
In the 99% case the bucket is just always there. And if it is not the
read/write will fail hard anyways. Esp on big instances the Objectstore
is not always fast and this can save a few hundered ms of each request
that acess the objectstore.

In short it is adding

'verify_bucket_exists' => false

To the S3 config part

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
2020-11-06 11:08:38 +07:00
Christoph Wurst 2a054e6c04
Update the license headers for Nextcloud 20
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-08-24 14:54:25 +07:00
Stephen Cuppett 5ef0f86ce7
Resolves #19790, Provides Support for IAM Credentials
Includes support for either leveraging environment variables
passed to the PHP runtime or IAM instance profile present
on the host being used. The default and first choice is
still the parameter file as documented.

See also: https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials_provider.html#chaining-providers

Signed-off-by: Stephen Cuppett <steve@cuppett.com>
2020-08-20 15:54:33 +07:00
Christoph Wurst d3a4bc91f7
Fix static method call for s3 bucket compat check
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-07-03 09:02:58 +07:00
Christoph Wurst 9d392891be
Disable Client-Side Monitoring on AWS storage
The S3 client enables this by default and then tries to read
`.aws/config`. This causes `open_basedir` restriction related error for
some setups. So this patch disables the CSM because it's most likely
unused anyway.

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-06-15 09:13:08 +07:00
Florent 3594ba6971 Upload part size as S3 parameter instead of constant value
Some S3 providers need a custom upload part size (500 MB static value in Nextcloud).
Here is a commit to change this value via S3 configuration, instead of using S3_UPLOAD_PART_SIZE constant.
A new parameter is added for an S3 connection : uploadPartSize

Signed-off-by: Florent <florent@coppint.com>
2020-06-09 09:18:42 +07:00
Christoph Wurst 1a9330cd69
Update the license headers for Nextcloud 19
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
2020-03-31 14:52:54 +07:00