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

Configuring TLS connections in python3.7 #70

Closed
theisensanders-wf opened this issue Jul 19, 2018 · 2 comments
Closed

Configuring TLS connections in python3.7 #70

theisensanders-wf opened this issue Jul 19, 2018 · 2 comments
Milestone

Comments

@theisensanders-wf
Copy link

Hi @wallyqs , a change to python in version 3.7 breaks the recommended method of setting up TLS connections.

>>> import ssl
>>> ssl_ctx = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH)
>>> ssl_ctx.protocol = ssl.PROTOCOL_TLSv1_2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: can't set attribute

Is there another way to set up an SSL context without setting the protocol property?

@wallyqs wallyqs added this to the v0.8.0 milestone Jul 19, 2018
@wallyqs wallyqs mentioned this issue Jul 19, 2018
4 tasks
@wallyqs
Copy link
Member

wallyqs commented Jul 19, 2018

Thanks for sharing, had not tried on Python 3.7 yet but getting many errors in the tests so not sure if there might be regressions yet.

In this case, not sure what was the change yet but looks like removing the setting/that line would enable TLS to work again:

DEBUG_NATS_TEST=true python3.7 tests/client_test.py ClientTLSTest

=== RUN ClientTLSTest.test_connect
[DEBUG] Server listening on port 4224 started.
[80965] 2018/07/19 16:04:58.689571 [INF] Starting nats-server version 1.2.0
[80965] 2018/07/19 16:04:58.689772 [DBG] Go build version go1.10.2
[80965] 2018/07/19 16:04:58.689790 [INF] Git commit [not set]
[80965] 2018/07/19 16:04:58.691325 [INF] Starting http monitor on 127.0.0.1:8222
[80965] 2018/07/19 16:04:58.691386 [INF] Listening for client connections on 127.0.0.1:4224
[80965] 2018/07/19 16:04:58.691393 [INF] TLS required for client connections
[80965] 2018/07/19 16:04:58.691399 [DBG] Server id is twgywjfm2Qb6MbJf7f0U9D
[80965] 2018/07/19 16:04:58.691402 [INF] Server is ready
[80965] 2018/07/19 16:04:58.777157 [DBG] 127.0.0.1:62736 - cid:1 - Client connection created
[80965] 2018/07/19 16:04:58.777741 [DBG] 127.0.0.1:62736 - cid:1 - Starting TLS client connection handshake
[80965] 2018/07/19 16:04:58.813276 [DBG] 127.0.0.1:62736 - cid:1 - TLS handshake complete
[80965] 2018/07/19 16:04:58.813311 [DBG] 127.0.0.1:62736 - cid:1 - TLS version 1.2, cipher suite TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
[80965] 2018/07/19 16:04:58.815483 [TRC] 127.0.0.1:62736 - cid:1 - ->> [CONNECT {"lang": "python3", "pedantic": false, "protocol": 1, "verbose": false, "version": "0.7.2"}]
[80965] 2018/07/19 16:04:58.815655 [TRC] 127.0.0.1:62736 - cid:1 - ->> [PING]
[80965] 2018/07/19 16:04:58.815666 [TRC] 127.0.0.1:62736 - cid:1 - <<- [PONG]
[80965] 2018/07/19 16:04:58.817000 [DBG] 127.0.0.1:62736 - cid:1 - Client connection closed
[80965] 2018/07/19 16:04:58.817209 [TRC] 127.0.0.1:62736 - cid:1 - <<- [PING]
[DEBUG] Server listening on 4224 will stop.
[DEBUG] Server listening on 4224 was stopped.

For now made this issue to check the status of the client against Python 3.7 #71

@wallyqs
Copy link
Member

wallyqs commented Aug 15, 2018

Confirmed support for the client on Python 3.7 is ok (#73) and updated examples, thanks again for the report

@wallyqs wallyqs closed this as completed Aug 15, 2018
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

2 participants