|
|
@@ -38,6 +38,7 @@ use Aws\S3\Exception\S3Exception; |
|
|
|
use Aws\S3\S3Client; |
|
|
|
use GuzzleHttp\Promise; |
|
|
|
use GuzzleHttp\Promise\RejectedPromise; |
|
|
|
use OCP\ICertificateManager; |
|
|
|
use OCP\ILogger; |
|
|
|
|
|
|
|
trait S3ConnectionTrait { |
|
|
@@ -120,6 +121,15 @@ trait S3ConnectionTrait { |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
// since we store the certificate bundles on the primary storage, we can't get the bundle while setting up the primary storage |
|
|
|
if (!isset($this->params['primary_storage'])) { |
|
|
|
/** @var ICertificateManager $certManager */ |
|
|
|
$certManager = \OC::$server->get(ICertificateManager::class); |
|
|
|
$certPath = $certManager->getAbsoluteBundlePath(); |
|
|
|
} else { |
|
|
|
$certPath = \OC::$SERVERROOT . '/resources/config/ca-bundle.crt'; |
|
|
|
} |
|
|
|
|
|
|
|
$options = [ |
|
|
|
'version' => isset($this->params['version']) ? $this->params['version'] : 'latest', |
|
|
|
'credentials' => $provider, |
|
|
@@ -129,9 +139,10 @@ trait S3ConnectionTrait { |
|
|
|
'signature_provider' => \Aws\or_chain([self::class, 'legacySignatureProvider'], ClientResolver::_default_signature_provider()), |
|
|
|
'csm' => false, |
|
|
|
'use_arn_region' => false, |
|
|
|
'http' => ['verify' => $certPath], |
|
|
|
]; |
|
|
|
if ($this->getProxy()) { |
|
|
|
$options['http'] = [ 'proxy' => $this->getProxy() ]; |
|
|
|
$options['http']['proxy'] = $this->getProxy(); |
|
|
|
} |
|
|
|
if (isset($this->params['legacy_auth']) && $this->params['legacy_auth']) { |
|
|
|
$options['signature_version'] = 'v2'; |