Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Allow to specify the certificate to be used #56

Merged
merged 2 commits into from
Jul 12, 2018
Merged

Allow to specify the certificate to be used #56

merged 2 commits into from
Jul 12, 2018

Conversation

juangallostra
Copy link
Contributor

@juangallostra juangallostra commented Jul 11, 2018

This P.R. supersedes #55

Description of the issue/feature this PR addresses

Disclaimer: This is my understanding of the problem and I might be wrong on some points.

On one hand, the Python package requests, which is the one used by senaite.sync to perform requests, uses certifi's package CA bundle as the default one when trying to validate the identity of a server.

On the other hand, we use self-signed certificates to access over https instances in a local network that are not accessible through the public Internet. Why? Because CA entities such as Let's Encrypt only sign certificates for hosts with a valid DNS that can be accessed through the public Internet (https://community.letsencrypt.org/t/certificates-for-hosts-on-private-networks/174/7).

Hence, when trying to sync two instances over https with a self signed certificate requests fails with the error [SSL: CERTIFICATE_VERIFY_FAILED] because the self-signed certificate being used to access the instance over https hasn't been signed by any of the CA entities that the package trusts.

The solution is to explicitly tell requests which certificate is to be used for validation.

Current behavior before PR

There wasn't an option to specify a custom certificate for https validation.

Desired behavior after PR is merged

There is an option to specify a custom certificate for https validation. If specified, sync will use that certificate when connecting to the source instance. If it is left empty, then the default requests CA bundle will be used.

Screenshot (optional)

seleccio_001

--
I confirm I have tested this PR thoroughly and coded it according to PEP8
and Plone's Python styleguide standards.

@xispa xispa merged commit c57e290 into senaite:master Jul 12, 2018
@juangallostra juangallostra deleted the add-certificate-field branch July 16, 2018 09:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

Successfully merging this pull request may close these issues.

2 participants