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

Support self-signed certificates in CURLStreamFile #58

Closed
spmkone opened this issue Oct 20, 2023 · 1 comment · Fixed by #60
Closed

Support self-signed certificates in CURLStreamFile #58

spmkone opened this issue Oct 20, 2023 · 1 comment · Fixed by #60

Comments

@spmkone
Copy link
Contributor

spmkone commented Oct 20, 2023

The current construction of the curl command in CURLStreamFile does not allow for self-signed https downloads from s3 buckets.

Why

Buckets created in local NAS (like QNAP/QuObjects) or local workflows built around minio containers take self-signed certificates for https endpoints. Using tensorizer natively in these environments is pretty useful for dev iterations and workflows before actually deploying.

Solution

A possible solution is that curl allows for bypassing the check all together with the -k flag (reference). Of course, it may also be possible to provide the cert to the curl call as an alternative. However, for these onprem workflows it may be ok to go with the insecure curl call.

Possible Implementation

Propagate a allow_insecure boolean flag through open_stream to CURLStreamFile which adds the -k flag to the curl command.

def open_stream(
    ...,
    allow_insecure: bool = False,
) 

class CURLStreamFile:
    def __init__(
        allow_insecure: bool = False
        *,
    ):

    # Individual flag or self._additional_curl_flags list
    # which could be used in _reproduce_and_capture_error()
    kflag = "-k" if allow_insecure else "" 

    cmd = [
            curl_path,
            ...
            kflag,
            uri,
        ]

I can put up a PR for this, if ok.

@wbrown
Copy link
Collaborator

wbrown commented Oct 20, 2023

@spmkone 👍 We'll happily accept a PR for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants