2017-03-22 128 views
0

我有一臺服務器應用程序運行在我的計算機上偵聽某個端口。當我嘗試使用OpenSSL時(在Mac上,我已經從OpenSSL的默認Mac版本升級了brew)。使用openssl終端命令調試SSL連接

openssl s_client -connect 0.0.0.0:80051 -showcerts -prexit -servername localhost -debug 

響應

CONNECTED(00000003) 
write to 0x7fe62b41b370 [0x7fe62b80d000] (118 bytes => 118 (0x76)) 
0000 - 16 03 01 00 71 01 00 00-6d 03 01 58 d2 84 72 d5 ....q...m..X..r. 
0010 - 1b d3 47 9c 8e 6b b3 fb-10 a5 21 af 0e 5d 79 7b ..G..k....!..]y{ 
0020 - 54 77 4b 70 11 b0 77 5e-1e 9c e7 00 00 2e 00 39 TwKp..w^.......9 
0030 - 00 38 00 35 00 16 00 13-00 0a 00 33 00 32 00 2f .8.5.......3.2./ 
0040 - 00 9a 00 99 00 96 00 05-00 04 00 15 00 12 00 09 ................ 
0050 - 00 14 00 11 00 08 00 06-00 03 00 ff 01 00 00 16 ................ 
0060 - 00 00 00 0e 00 0c 00 00-09 6c 6f 63 61 6c 68 6f .........localho 
0070 - 73 74 00 23          st.# 
0076 - <SPACES/NULS> 
read from 0x7fe62b41b370 [0x7fe62b812600] (7 bytes => 0 (0x0)) 
85473:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:/BuildRoot/Library/Caches/com.apple.xbs/Sources/OpenSSL098/OpenSSL098-59.60.1/src/ssl/s23_lib.c:185: 
--- 
no peer certificate available 
--- 
No client certificate CA names sent 
--- 
SSL handshake has read 0 bytes and written 118 bytes 
--- 
New, (NONE), Cipher is (NONE) 
Secure Renegotiation IS NOT supported 
Compression: NONE 
Expansion: NONE 
--- 

在服務器

E0322 10:04:34.017891000 123145312870400 ssl_transport_security.c:947] Handshake failed with fatal error SSL_ERROR_SSL: error:1408A10B:SSL routines:ssl3_get_client_hello:wrong version number. 
E0322 10:04:34.017964000 123145312870400 chttp2_server.c:123] Handshaking failed: {"created":"@1490191474.017913000","description":"Handshake failed","file":"../src/core/lib/security/transport/security_handshaker.c","file_line":274,"tsi_code":10,"tsi_error":"TSI_PROTOCOL_FAILURE"} 

我試圖通過-ssl3和-tls1在OpenSSL命令沒有成功。關於如何處理信息或使用openssl進一步調試可能導致ssl客戶端連接問題到服務器的任何想法。由於

+2

我懷疑這是您使用的升級版OpenSSL,至少不是OpenSSL至少版本1.0.1。您發送的請求是版本TLS 1.0(十六進制'03 01'),而當前的OpenSSL使用TLS 1.2。 –

+0

是的,你是對的@SteffenUllrich - 我應該檢查:openssl版本顯示「OpenSSL 0.9.8zh 2016年1月14日」。請回答相同的評論,並接受 –

+0

Stack Overflow是一個編程和開發問題的網站。這個問題似乎與題目無關,因爲它不涉及編程或開發。請參閱幫助中心的[我可以詢問哪些主題](http://stackoverflow.com/help/on-topic)。也許[超級用戶](http://superuser.com/)或[Unix&Linux堆棧交換](http://unix.stackexchange.com/)會是一個更好的地方。另請參閱[我在哪裏發佈有關Dev Ops的問題?](http://meta.stackexchange.com/q/134306) – jww

回答

1

我通過BREW升級已經從默認的Mac版本的OpenSSL ...

0000 - 16 03 01 .... 03 01 

調試日誌顯示客戶問候與TLS版本1.0(0x0301)。這表明使用了舊版本的OpenSSL,而不是升級版本,因爲此版本1.0.1(2012年發佈)支持TLS 1.2,並將默認使用它。

+0

謝謝 - 我已經安裝,但沒有鏈接的新版本。 –