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

Add configuration to use a different CA cert bundle or disable verification #101

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ media_storage_providers:
store_remote: True
store_synchronous: True
config:
verify: <boolean/string>
#Whether or not to verify SSL certificates. By default SSL certificates are verified. You can provide the following values:
#False - do not validate SSL certificates. SSL will still be used (unless use_ssl is False), but SSL certificates will not be verified.
#path/to/cert/bundle.pem - A filename of the CA cert bundle to uses. You can specify this argument if you want to use a different CA cert bundle than the one used by botocore.
Comment on lines +23 to +26
Copy link
Member

@clokep clokep Aug 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this below secret_access_key.

I do wonder if this should just point back to the AWS docs or something?


bucket: <S3_BUCKET_NAME>
# All of the below options are optional, for use with non-AWS S3-like
# services, or to specify access tokens here instead of some external method.
Expand Down
6 changes: 6 additions & 0 deletions s3_storage_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ def __init__(self, hs, config):

if "secret_access_key" in config:
self.api_kwargs["aws_secret_access_key"] = config["secret_access_key"]

if "verify" in config:
self.api_kwargs["verify"]=config["verify"]
Comment on lines +83 to +84
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For reference, this is the set of allowed properties passed to the client.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if "verify" in config:
self.api_kwargs["verify"]=config["verify"]
if "verify" in config:
self.api_kwargs["verify"] = config["verify"]


self._s3_client = None
self._s3_client_lock = threading.Lock()
Expand Down Expand Up @@ -179,6 +182,9 @@ def parse_config(config):
if "secret_access_key" in config:
result["secret_access_key"] = config["secret_access_key"]

if "verify" in config:
result["verify"]=config["verify"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result["verify"]=config["verify"]
result["verify"] = config["verify"]


if "sse_customer_key" in config:
result["extra_args"]["SSECustomerKey"] = config["sse_customer_key"]
result["extra_args"]["SSECustomerAlgorithm"] = config.get(
Expand Down