Skip to content

Commit

Permalink
fix: Allow to disable ssl verification for object storage
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliushaertl committed Aug 14, 2024
1 parent 1044b7f commit 1c3dfd0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/private/Files/ObjectStore/S3ConnectionTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ protected function parseParams($params) {
$params['port'] = (isset($params['use_ssl']) && $params['use_ssl'] === false) ? 80 : 443;
}
$params['verify_bucket_exists'] = $params['verify_bucket_exists'] ?? true;
$params['ssl_verify'] = $params['ssl_verify'] ?? true;

if ($params['s3-accelerate']) {
$params['verify_bucket_exists'] = false;
Expand Down Expand Up @@ -100,7 +101,7 @@ public function getConnection() {
'csm' => false,
'use_arn_region' => false,
'http' => [
'verify' => $this->getCertificateBundlePath(),
'verify' => $this->params['ssl_verify'] ? $this->getCertificateBundlePath() : false,
// Timeout for the connection to S3 server, not for the request.
'connect_timeout' => 5
],
Expand Down
7 changes: 6 additions & 1 deletion lib/private/Files/ObjectStore/S3ObjectTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function readObject($urn) {
'http' => [
'protocol_version' => $request->getProtocolVersion(),
'header' => $headers,
]
],
'ssl' => [],
];
$bundle = $this->getCertificateBundlePath();
if ($bundle) {
Expand All @@ -63,6 +64,10 @@ public function readObject($urn) {
];
}

if ($this->params['ssl_verify'] === false) {
$opts['ssl']['verify_peer'] = false;
}

if ($this->getProxy()) {
$opts['http']['proxy'] = $this->getProxy();
$opts['http']['request_fulluri'] = true;
Expand Down

0 comments on commit 1c3dfd0

Please sign in to comment.