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

Support for Python 3.7.0? #11

Open
Danaozhong opened this issue Jan 11, 2019 · 6 comments · May be fixed by #14
Open

Support for Python 3.7.0? #11

Danaozhong opened this issue Jan 11, 2019 · 6 comments · May be fixed by #14

Comments

@Danaozhong
Copy link

@Danaozhong Danaozhong commented Jan 11, 2019

I face an issue when using sslpsk with Python 3.7.0. The TLS connection gets refused.

I run a server application, which upon receiving a Client Hello, closes the TCP connection with a ACK&RES.

Did you run into a similar problem?

@drbild

This comment has been minimized.

Copy link
Owner

@drbild drbild commented Jan 11, 2019

I haven't tried this library with Python 3.7.

Can you share the code that is failing for you?

@AndreySV

This comment has been minimized.

Copy link
Contributor

@AndreySV AndreySV commented Mar 12, 2019

Test failed on python 3.7.2 on Debian Buster.

$ python3 -m sslpsk.test
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.7/threading.py", line 865, in run
    self._target(*self._args, **self._kwargs)
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/test/test_sslpsk.py", line 67, in accept
    ssl_version=ssl.PROTOCOL_TLSv1, server_side=True)
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 103, in wrap_socket
    _ssl_set_psk_server_callback(sock, cb, hint)
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 77, in _ssl_set_psk_server_callback
    ssl_id = _sslpsk.sslpsk_set_accept_state(_sslobj(sock))
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 55, in _sslobj
    return sock._sslobj._sslobj
AttributeError: '_ssl._SSLSocket' object has no attribute '_sslobj'

E
======================================================================
ERROR: testClient (test_sslpsk.SSLPSKTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/test/test_sslpsk.py", line 81, in testClient
    ssl_version=ssl.PROTOCOL_TLSv1, server_side=False)
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 106, in wrap_socket
    _ssl_set_psk_client_callback(sock, cb)
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 73, in _ssl_set_psk_client_callback
    ssl_id = _sslpsk.sslpsk_set_psk_client_callback(_sslobj(sock))
  File "/home/developer/.local/lib/python3.7/site-packages/sslpsk/sslpsk.py", line 55, in _sslobj
    return sock._sslobj._sslobj
AttributeError: '_ssl._SSLSocket' object has no attribute '_sslobj'

----------------------------------------------------------------------
Ran 1 test in 0.013s

FAILED (errors=1)
 $ python3 --version
Python 3.7.2+

@Danaozhong

This comment has been minimized.

Copy link
Author

@Danaozhong Danaozhong commented Mar 22, 2019

I think that's a different problem, if I remember correctly the attribute _sslobj was renamed to sslobj, so at least that is easy to fix. But after fixing that I stumbled across the problem I described above.

Unfortunately, I didn't manage to write a short example so far, but if I have a free minute I will give it a try.

@drbild

This comment has been minimized.

Copy link
Owner

@drbild drbild commented Mar 22, 2019

These tests are passing on travis for Python 3.7, thanks to @AndreySV's fixes.

@Danaozhong Can you try the current master?

I'll try to cut a release this weekend.

EDIT: 3.7 fails on Windows. Is that your OS?

@AndreySV

This comment has been minimized.

Copy link
Contributor

@AndreySV AndreySV commented Mar 22, 2019

BTW friend of mine told me about some problems on Windows (but with python 2.7.16) with sslpsk. Probably because of different openssl versions used for python and sslpsk. He has got it working only with old python 2.7.13.
And I had problems (tests were ok, but actual PSK authentication wasn't working at all) on Linux until I removed old libopenssl1.0.2 headers and compiled against libopenssl1.1.1 cpython (2.7.16) was compiled most likely against.
Maybe it's related.

@skboro

This comment has been minimized.

Copy link

@skboro skboro commented Aug 7, 2019

@AndreySV
Can you share the steps that you took for building with new ssl version?

BTW friend of mine told me about some problems on Windows (but with python 2.7.16) with sslpsk. Probably because of different openssl versions used for python and sslpsk. He has got it working only with old python 2.7.13.
And I had problems (tests were ok, but actual PSK authentication wasn't working at all) on Linux until I removed old libopenssl1.0.2 headers and compiled against libopenssl1.1.1 cpython (2.7.16) was compiled most likely against.
Maybe it's related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.