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

problem when using self signed ssl certs #42

@pescobar

Description

@pescobar

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions