Skip to content
This repository has been archived by the owner on Dec 18, 2023. It is now read-only.

problem when using self signed ssl certs #42

Open
pescobar opened this issue May 20, 2021 · 0 comments
Open

problem when using self signed ssl certs #42

pescobar opened this issue May 20, 2021 · 0 comments

Comments

@pescobar
Copy link

Hi,

I am testing in a check_mk installation with a self-signed SSL certificate and I was getting this error:
raise URLError(err)urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:897)>

The crash happens here : https://github.com/brennerm/check-mk-web-api/blob/master/check_mk_web_api/__init__.py#L142-L145

In a quick google search I found a possible workaround here

I did a test and this seems to work to skip ssl validation and be able to query self-signed certs:

        import ssl
        ctx = ssl.create_default_context()
        ctx.check_hostname = False
        ctx.verify_mode = ssl.CERT_NONE

        response = urllib.request.urlopen(
            self.__build_request_path(query_params),
            WebApi.__build_request_data(data, request_format),context=ctx
        )

Would it be possible to add an option to skip ssl validation when working with self-signed ssl certs?

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

No branches or pull requests

1 participant