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

Avoid dependency on pyOpenSSL when using Python 2.7.9 [JIRA: CLIENTS-408] #397

Merged
merged 3 commits into from
May 18, 2015

Conversation

acaprari
Copy link
Contributor

Many enhancements of the Python 3 ssl module have been backported to Python 2.7.9.
In particular, the class SSLContext() is available and could be used instead of relying on the pyOpenSSL module. This would avoid the inclusion of a lot of new dependencies: pyopenssl, cryptography, pyasn1, enum34, pycparser, cffi.

I suggest to change riak/transports/security.py not to use six.PY2 to decide whether to use the pyOpenSSL, and instead check for the actual availability of ssl.SSLContext.

@hazen
Copy link

hazen commented Jan 19, 2015

@alefend One issue we have also is determining the version of OpenSSL against which Python was built. Since many users will have Python 2.7.x, where x < 9, I'm afraid we'll still need to use PyOpenSSL. We are using the native ssl library for Python 3.x, however.

@acaprari
Copy link
Contributor Author

I think a similar check could be performed in the other part of the package. If you are referring to the riak.security module, the check for six.PY2 can be changed to a check for hasattr(ssl, 'OPENSSL_VERSION_NUMBER').

I don't suggest to drop the pyOpenSSL requirement at all, just to drop it for Python releases >= 2.7.9.

@hazen
Copy link

hazen commented Jan 21, 2015

@alefend OK, I see what you are suggesting. It's a good idea, but I'd have to do some testing it to determine the cost/benefit.

@acaprari
Copy link
Contributor Author

Another option would be to make those dependencies optional using the extras_require feature of setuptools.

I saw it used for a similar purpose in the requests package.

@hazen
Copy link

hazen commented Mar 19, 2015

@alefend How is the 2.7.9 port? I found that in 3.3 there were missing features found in 3.4, for example.

@acaprari
Copy link
Contributor Author

Hi @javajolt, we are currently using the proposed changes in production without issues (but against a Riak server with no security)

@hazen
Copy link

hazen commented May 13, 2015

@alefend Awesome! I'll just have to verify everything still works on the various other versions, too. It looks like the Certificate Revocation Lists are still not working in native Python; something pyOpenSSL did support. Let me review all the changes you made.

@Basho-JIRA Basho-JIRA changed the title Avoid dependency on pyOpenSSL when using Python 2.7.9 Avoid dependency on pyOpenSSL when using Python 2.7.9 [JIRA: CLIENTS-408] May 18, 2015
hazen pushed a commit that referenced this pull request May 18, 2015
Only use pyOpenSSL when using Python < 2.7.9
@hazen hazen merged commit 2008ae1 into basho:master May 18, 2015
@Basho-JIRA
Copy link

[~brett] it looks like this can be moved along the Jira board. Will this be the only thing added in the next Python client release?

_[posted via JIRA by Derek Somogyi]_

@Basho-JIRA
Copy link

No I hope to get in [CLIENTS-342|https://bashoeng.atlassian.net/browse/CLIENTS-342], [CLIENTS-417 (#402) (#402)|https://bashoeng.atlassian.net/browse/CLIENTS-417 (#402) (#402)], [CLIENTS-361|https://bashoeng.atlassian.net/browse/CLIENTS-361], [CLIENTS-332|https://bashoeng.atlassian.net/browse/CLIENTS-332] and see if I can fix [CLIENTS-514 (#406) (#406)|https://bashoeng.atlassian.net/browse/CLIENTS-514 (#406) (#406)]

_[posted via JIRA by Brett Hazen]_

@Basho-JIRA
Copy link

This went out with the 2.3.0 release: #397

_[posted via JIRA by Brett Hazen]_

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

Successfully merging this pull request may close these issues.

3 participants