1

When I tested some Python code for different scenarios, I received the following error for the correct port, URL, username, and password:

SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message

I got the exact same error and traceback when I used a bogus username, and also when I used the correct username but the wrong password. Could it be expecting SSL v3, and the version that is installed is older? Just a guess. I didn't see anything in the Python code that set the SSL version number.

user3429841
  • 33
  • 3
  • 12
  • Please post a [mcve] so that people can examine your code and see if there is something wrong there. – Ken Y-N Dec 21 '16 at 00:32
  • Can you show us the code? TLS doesn't know anything about usernames and passwords (unless you're using something like TLS-SRP, which I doubt), so the fact that you're getting that error suggests that you're not successfully setting up a TLS session. – user3553031 Dec 21 '16 at 00:32
  • It sounds like you are using Python2.7 and a 3rd party library like requests. If this is the case you should try this `pip install request[security]` most packages that I have run into that have to deal with this will have the `[security]` version. – SudoKid Dec 21 '16 at 01:46
  • Sorry, I am not allowed to post any code because it is proprietary. – user3429841 Dec 21 '16 at 19:43
  • For what it's worth, here are the last several lines of the traceback. The Python code referenced is in GitHub at https://github.com/kennethreitz/requests – user3429841 Dec 22 '16 at 19:02

2 Answers2

1

Please can you post the code so that It is easy to resolve the problem. This link may help you [SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected message

Community
  • 1
  • 1
nag
  • 19
  • 1
0

You can use SSLAdapter to set the SSL and TLS versions.

I was getting a similar error and it was caused by the server using TLS 1.3, but I only have TLS 1.2 installed. So I had to do the following:

from requests_toolbelt import SSLAdapter
import ssl
import requests

session = requests.Session()
session.mount('https://', SSLAdapter(ssl.PROTOCOL_TLSv1_2))
session.get(myurl)

If you can reach the server with a browser, you can check the SSL and TLS version by clicking on the lock or shield symbol next to the url.

carlin.scott
  • 6,214
  • 3
  • 30
  • 35