gnutls_handshake() failed - why?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I am running the following command:



curl --tlsv1.2 -v --cacert ./mycert.crt --key ./key.pem --cert ./mycert.crt https://thirdparty.url


I received the certificate from the third party I am working with after generating CSR and key files with openssl.



My server IP is whitelisted on the third party's firewall and they can see my requests coming in but the handshake always fails.



This is the response I receive:



* Trying X.X.X.X...
* Connected to thirdparty.url (X.X.X.X) port 443 (#0)
* found 1 certificates in ./nonprod.crt
* found 596 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* gnutls_handshake() failed: Handshake failed
* Closing connection 0
curl: (35) gnutls_handshake() failed: Handshake failed


How can I debug this issue?



Some info:
I am running curl 7.47.0 on Ubuntu 16.04.4



I try running this command:



openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem 


BUT I have to exclude the link URI to make it work. The response does include this however:



140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
140593823835800:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:656:


But it also says:



SSL handshake has read 3378 bytes and written 1702 bytes

New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID:
Session-ID-ctx:
Master-Key: CE2294E9B415FB8B9850DB28F64FEF17390A46D5A38F12E62E31F614DA4199CF50C0AFA5F62401C4964105AFC4F1B095
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1528299660
Timeout : 7200 (sec)
Verify return code: 0 (ok)






share|improve this question





















  • You can try with openssl s_client it should give you more debug information. Do not forger the -servername parameter to enable TLS SNI proper negotiation
    – Patrick Mevzek
    Jun 6 at 15:26











  • I am able to connect using this command: openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem - but I have to exclude the URI to make it work
    – cristobal
    Jun 6 at 15:33











  • Yes, openssl is purely a TLS client, not an HTTP one. To mimick curl, try adding -alpn http/1.1 . If it then fails it means an error server-side (not supporting ALPN). If it still works you can try a very simple HTTP request: echo -n "GET / HTTP/1.1nHost: thirdparty.urlnnn" | openssl s_client .... or just type the request when s_client started and until the connection remains open.
    – Patrick Mevzek
    Jun 6 at 15:41











  • The openssl response includes 140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
    – cristobal
    Jun 6 at 15:48










  • Besides giving the hostname you connect to to let others test too, you can either try to capture the TLS handshake to see what is happening and/or using online tools like ssllabs.com/ssltest
    – Patrick Mevzek
    Jul 5 at 17:44














up vote
0
down vote

favorite












I am running the following command:



curl --tlsv1.2 -v --cacert ./mycert.crt --key ./key.pem --cert ./mycert.crt https://thirdparty.url


I received the certificate from the third party I am working with after generating CSR and key files with openssl.



My server IP is whitelisted on the third party's firewall and they can see my requests coming in but the handshake always fails.



This is the response I receive:



* Trying X.X.X.X...
* Connected to thirdparty.url (X.X.X.X) port 443 (#0)
* found 1 certificates in ./nonprod.crt
* found 596 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* gnutls_handshake() failed: Handshake failed
* Closing connection 0
curl: (35) gnutls_handshake() failed: Handshake failed


How can I debug this issue?



Some info:
I am running curl 7.47.0 on Ubuntu 16.04.4



I try running this command:



openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem 


BUT I have to exclude the link URI to make it work. The response does include this however:



140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
140593823835800:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:656:


But it also says:



SSL handshake has read 3378 bytes and written 1702 bytes

New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID:
Session-ID-ctx:
Master-Key: CE2294E9B415FB8B9850DB28F64FEF17390A46D5A38F12E62E31F614DA4199CF50C0AFA5F62401C4964105AFC4F1B095
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1528299660
Timeout : 7200 (sec)
Verify return code: 0 (ok)






share|improve this question





















  • You can try with openssl s_client it should give you more debug information. Do not forger the -servername parameter to enable TLS SNI proper negotiation
    – Patrick Mevzek
    Jun 6 at 15:26











  • I am able to connect using this command: openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem - but I have to exclude the URI to make it work
    – cristobal
    Jun 6 at 15:33











  • Yes, openssl is purely a TLS client, not an HTTP one. To mimick curl, try adding -alpn http/1.1 . If it then fails it means an error server-side (not supporting ALPN). If it still works you can try a very simple HTTP request: echo -n "GET / HTTP/1.1nHost: thirdparty.urlnnn" | openssl s_client .... or just type the request when s_client started and until the connection remains open.
    – Patrick Mevzek
    Jun 6 at 15:41











  • The openssl response includes 140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
    – cristobal
    Jun 6 at 15:48










  • Besides giving the hostname you connect to to let others test too, you can either try to capture the TLS handshake to see what is happening and/or using online tools like ssllabs.com/ssltest
    – Patrick Mevzek
    Jul 5 at 17:44












up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am running the following command:



curl --tlsv1.2 -v --cacert ./mycert.crt --key ./key.pem --cert ./mycert.crt https://thirdparty.url


I received the certificate from the third party I am working with after generating CSR and key files with openssl.



My server IP is whitelisted on the third party's firewall and they can see my requests coming in but the handshake always fails.



This is the response I receive:



* Trying X.X.X.X...
* Connected to thirdparty.url (X.X.X.X) port 443 (#0)
* found 1 certificates in ./nonprod.crt
* found 596 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* gnutls_handshake() failed: Handshake failed
* Closing connection 0
curl: (35) gnutls_handshake() failed: Handshake failed


How can I debug this issue?



Some info:
I am running curl 7.47.0 on Ubuntu 16.04.4



I try running this command:



openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem 


BUT I have to exclude the link URI to make it work. The response does include this however:



140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
140593823835800:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:656:


But it also says:



SSL handshake has read 3378 bytes and written 1702 bytes

New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID:
Session-ID-ctx:
Master-Key: CE2294E9B415FB8B9850DB28F64FEF17390A46D5A38F12E62E31F614DA4199CF50C0AFA5F62401C4964105AFC4F1B095
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1528299660
Timeout : 7200 (sec)
Verify return code: 0 (ok)






share|improve this question













I am running the following command:



curl --tlsv1.2 -v --cacert ./mycert.crt --key ./key.pem --cert ./mycert.crt https://thirdparty.url


I received the certificate from the third party I am working with after generating CSR and key files with openssl.



My server IP is whitelisted on the third party's firewall and they can see my requests coming in but the handshake always fails.



This is the response I receive:



* Trying X.X.X.X...
* Connected to thirdparty.url (X.X.X.X) port 443 (#0)
* found 1 certificates in ./nonprod.crt
* found 596 certificates in /etc/ssl/certs
* ALPN, offering http/1.1
* gnutls_handshake() failed: Handshake failed
* Closing connection 0
curl: (35) gnutls_handshake() failed: Handshake failed


How can I debug this issue?



Some info:
I am running curl 7.47.0 on Ubuntu 16.04.4



I try running this command:



openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem 


BUT I have to exclude the link URI to make it work. The response does include this however:



140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
140593823835800:error:1409E0E5:SSL routines:ssl3_write_bytes:ssl handshake failure:s3_pkt.c:656:


But it also says:



SSL handshake has read 3378 bytes and written 1702 bytes

New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-GCM-SHA384
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol : TLSv1.2
Cipher : ECDHE-RSA-AES256-GCM-SHA384
Session-ID:
Session-ID-ctx:
Master-Key: CE2294E9B415FB8B9850DB28F64FEF17390A46D5A38F12E62E31F614DA4199CF50C0AFA5F62401C4964105AFC4F1B095
Key-Arg : None
PSK identity: None
PSK identity hint: None
SRP username: None
Start Time: 1528299660
Timeout : 7200 (sec)
Verify return code: 0 (ok)








share|improve this question












share|improve this question




share|improve this question








edited Jun 6 at 17:03









Patrick Mevzek

2,0131721




2,0131721









asked Jun 6 at 14:55









cristobal

12




12











  • You can try with openssl s_client it should give you more debug information. Do not forger the -servername parameter to enable TLS SNI proper negotiation
    – Patrick Mevzek
    Jun 6 at 15:26











  • I am able to connect using this command: openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem - but I have to exclude the URI to make it work
    – cristobal
    Jun 6 at 15:33











  • Yes, openssl is purely a TLS client, not an HTTP one. To mimick curl, try adding -alpn http/1.1 . If it then fails it means an error server-side (not supporting ALPN). If it still works you can try a very simple HTTP request: echo -n "GET / HTTP/1.1nHost: thirdparty.urlnnn" | openssl s_client .... or just type the request when s_client started and until the connection remains open.
    – Patrick Mevzek
    Jun 6 at 15:41











  • The openssl response includes 140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
    – cristobal
    Jun 6 at 15:48










  • Besides giving the hostname you connect to to let others test too, you can either try to capture the TLS handshake to see what is happening and/or using online tools like ssllabs.com/ssltest
    – Patrick Mevzek
    Jul 5 at 17:44
















  • You can try with openssl s_client it should give you more debug information. Do not forger the -servername parameter to enable TLS SNI proper negotiation
    – Patrick Mevzek
    Jun 6 at 15:26











  • I am able to connect using this command: openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem - but I have to exclude the URI to make it work
    – cristobal
    Jun 6 at 15:33











  • Yes, openssl is purely a TLS client, not an HTTP one. To mimick curl, try adding -alpn http/1.1 . If it then fails it means an error server-side (not supporting ALPN). If it still works you can try a very simple HTTP request: echo -n "GET / HTTP/1.1nHost: thirdparty.urlnnn" | openssl s_client .... or just type the request when s_client started and until the connection remains open.
    – Patrick Mevzek
    Jun 6 at 15:41











  • The openssl response includes 140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
    – cristobal
    Jun 6 at 15:48










  • Besides giving the hostname you connect to to let others test too, you can either try to capture the TLS handshake to see what is happening and/or using online tools like ssllabs.com/ssltest
    – Patrick Mevzek
    Jul 5 at 17:44















You can try with openssl s_client it should give you more debug information. Do not forger the -servername parameter to enable TLS SNI proper negotiation
– Patrick Mevzek
Jun 6 at 15:26





You can try with openssl s_client it should give you more debug information. Do not forger the -servername parameter to enable TLS SNI proper negotiation
– Patrick Mevzek
Jun 6 at 15:26













I am able to connect using this command: openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem - but I have to exclude the URI to make it work
– cristobal
Jun 6 at 15:33





I am able to connect using this command: openssl s_client -connect server.url:443 -tls1_2 -cert ./mycert.crt -key key.pem - but I have to exclude the URI to make it work
– cristobal
Jun 6 at 15:33













Yes, openssl is purely a TLS client, not an HTTP one. To mimick curl, try adding -alpn http/1.1 . If it then fails it means an error server-side (not supporting ALPN). If it still works you can try a very simple HTTP request: echo -n "GET / HTTP/1.1nHost: thirdparty.urlnnn" | openssl s_client .... or just type the request when s_client started and until the connection remains open.
– Patrick Mevzek
Jun 6 at 15:41





Yes, openssl is purely a TLS client, not an HTTP one. To mimick curl, try adding -alpn http/1.1 . If it then fails it means an error server-side (not supporting ALPN). If it still works you can try a very simple HTTP request: echo -n "GET / HTTP/1.1nHost: thirdparty.urlnnn" | openssl s_client .... or just type the request when s_client started and until the connection remains open.
– Patrick Mevzek
Jun 6 at 15:41













The openssl response includes 140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
– cristobal
Jun 6 at 15:48




The openssl response includes 140593823835800:error:14094410:SSL routines:ssl3_read_bytes:sslv3 alert handshake failure:s3_pkt.c:1487:SSL alert number 40
– cristobal
Jun 6 at 15:48












Besides giving the hostname you connect to to let others test too, you can either try to capture the TLS handshake to see what is happening and/or using online tools like ssllabs.com/ssltest
– Patrick Mevzek
Jul 5 at 17:44




Besides giving the hostname you connect to to let others test too, you can either try to capture the TLS handshake to see what is happening and/or using online tools like ssllabs.com/ssltest
– Patrick Mevzek
Jul 5 at 17:44















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);








 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448228%2fgnutls-handshake-failed-why%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes










 

draft saved


draft discarded


























 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f448228%2fgnutls-handshake-failed-why%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Displaying single band from multi-band raster using QGIS

How many registers does an x86_64 CPU actually have?