Score:0

Troubleshooting Handshake Failure Between Application and External API

kz flag

This might be a bit of a long shot, but I'm hoping someone here can help me. I have a java application running on a jboss backend in a debian linux server. Incoming communications are routed to the correct backend by haproxy on another server.

One of the application's jobs is to provide shipment information to the user. It does this by sending a POST request to a third party API provided by UPS (https://www.ups.com/us/en/services/technology-integration/online-tools-tracking.page?) and displaying the results. Recently, the tracking feature in our application started throwing errors. Digging into the logs for our application I found this:

2021-10-28 10:00:00,142 ERROR [STDERR] Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
2021-10-28 10:00:00,142 ERROR [STDERR]  at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
2021-10-28 10:00:00,142 ERROR [STDERR]  at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
2021-10-28 10:00:00,142 ERROR [STDERR]  at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:1959)
2021-10-28 10:00:00,142 ERROR [STDERR]  at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1077)
2021-10-28 10:00:00,142 ERROR [STDERR]  at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1312)
2021-10-28 10:00:00,142 ERROR [STDERR]  at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:702)
2021-10-28 10:00:00,142 ERROR [STDERR]  at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:122)
2021-10-28 10:00:00,142 ERROR [STDERR]  at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:82)
2021-10-28 10:00:00,142 ERROR [STDERR]  at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:140)
2021-10-28 10:00:00,142 ERROR [STDERR]  at org.apache.commons.httpclient.methods.StringRequestEntity.writeRequest(Unknown Source)
2021-10-28 10:00:00,142 ERROR [STDERR]  at org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(Unknown Source)
2021-10-28 10:00:00,142 ERROR [STDERR]  at org.apache.commons.httpclient.HttpMethodBase.writeRequest(Unknown Source)
2021-10-28 10:00:00,142 ERROR [STDERR]  at org.apache.commons.httpclient.HttpMethodBase.execute(Unknown Source)
2021-10-28 10:00:00,142 ERROR [STDERR]  at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(Unknown Source)
2021-10-28 10:00:00,142 ERROR [STDERR]  at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(Unknown Source)
2021-10-28 10:00:00,143 ERROR [STDERR]  at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)
2021-10-28 10:00:00,143 ERROR [STDERR]  at org.apache.commons.httpclient.HttpClient.executeMethod(Unknown Source)

From what I can tell, this is a problem with the ssl request. For some reason, our application is rejecting the response from the API as insecure. Unfortunately, I'm a bit lost on what to do to actually go about fixing this. How do I determine exactly where the failure is happening? How do I figure out what changes I need to make on my application and/or proxy server to get communication working between my application and the external API?

Score:0
kz flag

I figured out the source of the problem. The UPS API requires at least one cipher from a particular list and my application server does not have any of the compatible ciphers installed. Figuring out how to fix THAT issue is beyond the scope of this question, so I have created another question here: How To Add Additional Cipher Suites to A Java Application Server?

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.