Hack Forums
[Python] sslv3 alert handshake failure - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] sslv3 alert handshake failure (/showthread.php?tid=6175833)



sslv3 alert handshake failure - ThinWhiteDuke - Oct 8, 2021

OK, So I've been working on a Discord Bot for the past couple of weeks interacting with some 3rd party API's, I was going
over my code yesterday when I started to get an error getting access to a particular website.

I've included a link to pastebin where I've posted the error message which is basically a sslv3 alert handshake failure, I working with the latest 3.9 version of python so I don't think this would be an update issue

Paste_Bin_Link


RE: sslv3 alert handshake failure - Donkey Death Jam - Oct 10, 2021

Following the stack trace, the Discord Python module calls into OpenSSL's "SSL_do_handshake" method via CPython which is what raises your exception. You can see the documentation for this method here: https://www.openssl.org/docs/man1.1.1/man3/SSL_do_handshake.html.

Looking at the error cases from that documentation: "The TLS/SSL handshake was not successful because a fatal error occurred either at the protocol level or a connection failure occurred. The shutdown was not clean. It can also occur if action is needed to continue the operation for nonblocking BIOs. Call SSL_get_error() with the return value ret to find out the reason."

Double check your parameters according to this information:
  • Are you connecting to a valid and alive host? Verify the status of this. (some-random-api.ml looks like the target host)

  • Check your system policies to ensure nothing is blocking the connection.

  • Have you properly directed the API to use the correct SSL/TLS certificates? In the event of a protocol failure, it usually means that the cryptographic item is corrupted (i.e. public certificate/certificate chain is invalid). Try to download the latest copies/reissue if applicable and look for other examples on how to use the Discord API to ensure you are applying the certificates correctly.

  • Still not working? Try to connect to your host via OpenSSL and debug the library as it performs the handshake to narrow down exactly where the error is happening within the protocol (this probably isn't needed - just double check the certs).





RE: sslv3 alert handshake failure - ThinWhiteDuke - Oct 10, 2021

(Oct 10, 2021 05:18 AM)Donkey Death Jam Wrote:  
  • Are you connecting to a valid and alive host? Verify the status of this. (some-random-api.ml looks like the target host)

  • Check your system policies to ensure nothing is blocking the connection.

  • Have you properly directed the API to use the correct SSL/TLS certificates? In the event of a protocol failure, it usually means that the cryptographic item is corrupted (i.e. public certificate/certificate chain is invalid). Try to download the latest copies/reissue if applicable and look for other examples on how to use the Discord API to ensure you are applying the certificates correctly.

  • Still not working? Try to connect to your host via OpenSSL and debug the library as it performs the handshake to narrow down exactly where the error is happening within the protocol (this probably isn't needed - just double check the certs).



Thanks for your reply, first point yes I’m connected to a valid and live host because I was interacting with other parts of the same API, I’m getting the handshake failure error when I try to scrape multiple images

I’ll go through the other stuff you’ve mentioned and read those docs you linked