Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OBJECTSTORE_S3_SSL does not work as documented #2308

Closed
vbrandl opened this issue Oct 8, 2024 · 2 comments · Fixed by #2309
Closed

OBJECTSTORE_S3_SSL does not work as documented #2308

vbrandl opened this issue Oct 8, 2024 · 2 comments · Fixed by #2309
Labels

Comments

@vbrandl
Copy link
Contributor

vbrandl commented Oct 8, 2024

The documentation for OBJECTSTORE_S3_SSL states that it defaults to true:

(default: true): Whether or not SSL/TLS should be used to communicate with object storage server

I would assume, not setting OBJECTSTORE_S3_SSL at all would cause Nextcloud to connect to my S3 bucket via HTTPS.

I use the following compose.yml for testing.

services:
  nextcloud:
    image: nextcloud
    volumes:
      - ./data/nextcloud:/var/www/html
    environment:
      - SQLITE_DATABASE=/tmp/nc.db
      - NEXTCLOUD_ADMIN_USER=admin
      - NEXTCLOUD_ADMIN_PASSWORD=this-is-not-a-password
      - NEXTCLOUD_TRUSTED_DOMAINS=example.com

      - OBJECTSTORE_S3_BUCKET=${OBJECTSTORE_S3_BUCKET}
      - OBJECTSTORE_S3_HOST=${OBJECTSTORE_S3_HOST}
      - OBJECTSTORE_S3_PORT=${OBJECTSTORE_S3_PORT}
      - OBJECTSTORE_S3_KEY=${OBJECTSTORE_S3_KEY}
      - OBJECTSTORE_S3_SECRET=${OBJECTSTORE_S3_SECRET}
        #- OBJECTSTORE_S3_SSL=true

If i start a new instance like this, I get the following config.php:

objectstore' =>
  array (
    'class' => '\\OC\\Files\\ObjectStore\\S3',
    'arguments' =>
    array (
      'bucket' => '<snip>',
      'region' => '',
      'hostname' => '<snip>',
      'port' => '443',
      'storageClass' => '',
      'objectPrefix' => 'urn:oid:',
      'autocreate' => false,
      'use_ssl' => false,
      'use_path_style' => false,
      'legacy_auth' => false,
      'key' => '<snip>',
      'secret' => '<snip>',
    ),
  ),

use_ssl is set to false but I would expect it to be true.

Now I delete ./data/nextcloud, uncomment - OBJECTSTORE_S3_SSL=true in compose.yml and start the compose project again and use_ssl in config.php will be set to true.

So the documentation does not match how the image actually behaves.

vbrandl added a commit to vbrandl/nextcloud-docker that referenced this issue Oct 8, 2024
According to the documentation, both `OBJECTSTORE_S3_SSL` and
`OBJECTSTORE_S3_AUTOCREATE` should default to `true`.
Currently, when these environment variables are not set, they default to
`false`. (See nextcloud#2308).

With this fix, both values will be `true` if they are

* not set
* the empty string
* any string that is not equal to `false` when converted to lowercase

This should now match the documented behavior.
vbrandl added a commit to vbrandl/nextcloud-docker that referenced this issue Oct 8, 2024
According to the documentation, both `OBJECTSTORE_S3_SSL` and
`OBJECTSTORE_S3_AUTOCREATE` should default to `true`.
Currently, when these environment variables are not set, they default to
`false`. (See nextcloud#2308).

This fix works, because `strtolower(false)` returns the empty string. So
when `OBJECTSTORE_S3_SSL` is not set and `getenv('OBJECTSTORE_S3_SSL')`
returns `false`, the check `strtolower($use_ssl) !== 'false'` will
evaluate to `true`.

With this fix, both values will be `true` if they are

* not set
* the empty string
* any string that is not equal to `false` when converted to lowercase

This should now match the documented behavior.
@Juoelenis

This comment has been minimized.

@joshtrichards
Copy link
Member

Hi @vbrandl - You're absolutely right. This intersects with #1948, an older report I was just recently reviewing (and that got overlooked).

Thanks for the PR as well!

vbrandl added a commit to vbrandl/nextcloud-docker that referenced this issue Oct 9, 2024
According to the documentation, both `OBJECTSTORE_S3_SSL` and
`OBJECTSTORE_S3_AUTOCREATE` should default to `true`.
Currently, when these environment variables are not set, they default to
`false`. (See nextcloud#2308).

This fix works, because `strtolower(false)` returns the empty string. So
when `OBJECTSTORE_S3_SSL` is not set and `getenv('OBJECTSTORE_S3_SSL')`
returns `false`, the check `strtolower($use_ssl) !== 'false'` will
evaluate to `true`.

With this fix, both values will be `true` if they are

* not set
* the empty string
* any string that is not equal to `false` when converted to lowercase

This should now match the documented behavior.

Signed-off-by: Valentin Brandl <[email protected]>
@joshtrichards joshtrichards linked a pull request Oct 10, 2024 that will close this issue
J0WI pushed a commit that referenced this issue Oct 24, 2024
According to the documentation, both `OBJECTSTORE_S3_SSL` and
`OBJECTSTORE_S3_AUTOCREATE` should default to `true`.
Currently, when these environment variables are not set, they default to
`false`. (See #2308).

This fix works, because `strtolower(false)` returns the empty string. So
when `OBJECTSTORE_S3_SSL` is not set and `getenv('OBJECTSTORE_S3_SSL')`
returns `false`, the check `strtolower($use_ssl) !== 'false'` will
evaluate to `true`.

With this fix, both values will be `true` if they are

* not set
* the empty string
* any string that is not equal to `false` when converted to lowercase

This should now match the documented behavior.

Signed-off-by: Valentin Brandl <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants