Skip to content

Please allow ssl context options for object storage to be set in config.php so self-signed certificates can work #32726

@bretton

Description

@bretton

Is your feature request related to a problem? Please describe.
I can't access S3 object store using self-signed certificates, such as a local-only minio cluster.

Describe the solution you'd like
I want to set ssl context options in config.php in the format

  'objectstore' => array (
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' => array(
      'bucket' => 'mynextcloud',
      'autocreate' => true,
      'key'    => 'REDACTED',
      'secret' => 'REDACTED',
      'hostname' => '<your host>',
      'port' => '<your port>',
      'region' => 'optional',
      'use_path_style' => true,
      'use_ssl' => true,
      'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' -> true,
    ),
  ),

https://www.php.net/manual/en/context.ssl.php

just like it's done in https://github.com/nextcloud/server/blob/master/lib/private/Mail/Mailer.php for email, to ignore self-signed tls certs.

Describe alternatives you've considered
I am currently patching https://github.com/nextcloud/server/blob/master/lib/private/Files/ObjectStore/S3ObjectTrait.php from

$opts = [
    'http' => [
        'protocol_version' => $request->getProtocolVersion(),
        'header' => $headers,
    ],
];

to

$opts = [
    'http' => [
       'protocol_version' => $request->getProtocolVersion(),
       'header' => $headers,
    ],
   'ssl' => [
       'verify_peer' => false,
       'verify_peer_name' => false,
   ],
];

Additional context
I also have to append the self-signed CA certificate to ca-root-nss.crt , or /usr/local/share/certs/ca-root-nss.crt in my case, on freebsd 13.0.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions