Skip to content

Python 2.7 and PROTOCOL_TLSv1_2 #63

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

Open
cwurld opened this issue Sep 18, 2017 · 7 comments
Open

Python 2.7 and PROTOCOL_TLSv1_2 #63

cwurld opened this issue Sep 18, 2017 · 7 comments

Comments

@cwurld
Copy link

cwurld commented Sep 18, 2017

The Python 2.7 ssl module does not have a ssl.PROTOCOL_TLSv1_2. This causes django-sslserver version 0.20 to fail. This error goes away when I revert to version 0.19

@johnthagen
Copy link
Contributor

What version of 2.7? 2.7.9 (released three years ago) should have this.

https://docs.python.org/2/library/ssl.html#ssl.PROTOCOL_TLSv1_2

@cwurld
Copy link
Author

cwurld commented Sep 24, 2017

2.7.6 - I guess I should update it.

@badcrc
Copy link

badcrc commented Nov 10, 2017

I'm having the same problem on macos sierra with python 2.7.10

AttributeError: 'module' object has no attribute 'PROTOCOL_TLSv1_2'
✗ python                              
Python 2.7.10 (default, Feb  7 2017, 00:08:15) 
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.34)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

0.19 works fine.

@mcescalante
Copy link

mcescalante commented Oct 11, 2018

I'm running into this problem with 2.7.14 and it looks to me like it's because PROTOCOL_TLSv1_2 is deprecated as of 2.7.13: https://docs.python.org/2/library/ssl.html#ssl.PROTOCOL_TLSv1_2

You can see in a IDLE session that my SSL configuration is working normally and the suggested replacement works fine, but PROTOCOL_TLSv1_2 can't be imported as it's deprecated:

Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> ssl.PROTOCOL_TLSv1_2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'PROTOCOL_TLSv1_2'
>>> ssl.OP_NO_SSLv3
33554432

@johnthagen
Copy link
Contributor

but PROTOCOL_TLSv1_2 can't be imported as it's deprecated:

That's strange as "deprecated" just means "you shouldn't use this any more, it could be removed in the future" not, "this is gone."

That sounds like a Python bug report that either the implementation or docs need to be updated.

@mcescalante
Copy link

Yup you are right! This python installation had issues with TLS 1.2 and everything is working after recompiling python with the proper flags. Thank you for the helpful tool!

@johnthagen
Copy link
Contributor

Great, just watch out for #64, my server will freeze when using django-sslserver if too many concurrent requests happen at once.

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

No branches or pull requests

4 participants