1. 程式人生 > >Nginx由於TLS支持版本配置過低造成不能夠正常訪問Upstream服務器的問題

Nginx由於TLS支持版本配置過低造成不能夠正常訪問Upstream服務器的問題

Nginx Upstream服務器的問題

打開Nginx錯誤日誌,發現報了n多條錯誤:
1818/83/88 15:38:83 [crit] 16145#8: 3489687 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 118.188.118.113, server: 8.8.8.8:443
1818/83/88 15:38:83 [crit] 16143#8:
3489831 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 111.116.111.54, server: 8.8.8.8:443
1818/83/88 15:38:58 [crit] 16147#8: 3411814 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 181.187.111.141, server: 8.8.8.8:443
1818/83/88 15:39:15 [crit] 16148#8:
3418988 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 61.178.189.183, server: 8.8.8.8:443
1818/83/88 15:39:46 [crit] 16144#8: 3437445 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 61.178.176.51, server: 8.8.8.8:443
1818/83/88 15:39:46 [crit] 16143#8:
3437586 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 114.114.188.186, server: 8.8.8.8:443
1818/83/88 15:39:58 [crit] 16141#8: 3448651 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 58.11.118.98, server: 8.8.8.8:443
1818/83/88 15:48:33 [crit] 16148#8:
3449569 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 111.1.63.78, server: 8.8.8.8:443
1818/83/88 15:48:48 [crit] 16144#8: 3454868 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 117.31.181.138, server: 8.8.8.8:443
1818/83/88 15:48:58 [crit] 16147#8:
3456681 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 117.31.181.138, server: 8.8.8.8:443
1818/83/88 15:41:81 [crit] 16145#8: 3457117 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 61.134.61.5, server: 8.8.8.8:443
1818/83/88 15:41:13 [crit] 16148#8:
3468513 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 61.134.61.5, server: 8.8.8.8:443
1818/83/88 15:41:19 [crit] 16143#8: 3461181 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 116.116.94.5, server: 8.8.8.8:443
1818/83/88 15:41:18 [crit] 16148#8:
3461488 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 111.189.181.34, server: 8.8.8.8:443
1818/83/88 15:41:11 [crit] 16145#8: 3461496 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 116.116.94.5, server: 8.8.8.8:443
1818/83/88 15:41:14 [crit] 16145#8:
3463399 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 36.188.113.148, server: 8.8.8.8:443
1818/83/88 15:41:39 [crit] 16147#8: 3467137 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 111.118.13.178, server: 8.8.8.8:443
1818/83/88 15:41:41 [crit] 16148#8:
3467879 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 111.189.181.34, server: 8.8.8.8:443
1818/83/88 15:41:45 [crit] 16143#8: 3468518 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 111.189.181.34, server: 8.8.8.8:443
1818/83/88 15:41:87 [crit] 16148#8:
3474471 SSL_do_handshake() failed (SSL: error:14876181:SSL routines:SSL13_GET_CLIENT_HELLO:unsupported protocol) while SSL handshaking, client: 111.118.13.178, server: 8.8.8.8:443

SSL_do_handshake() failed (SSL: error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version:SSL alert number 70) while SSL handshaking

應該是協議的版本號的問題,經查,是由於Nginx要訪問的upstream服務器的TLS的版本已經進行了升級,而nginx的配置中並沒有對支持的TLS協議進行升級。
隨著SSLv3 SSLv2協議的眾多漏洞與詬病,已經很多瀏覽器默認不再支持此協議,以上的錯誤也說明了upstream服務器已經不再支持這兩種協議,兩端進行TLS協議的握手,只有版本號一致才能夠成功,那麽則在nginx端也必須配置與upstream服務器一致的版本號,則修改nginx的配置文件nginx.conf,修改如下:
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

重新啟動nginx服務器後,即可以順利地訪問upstream端的服務了。

Nginx由於TLS支持版本配置過低造成不能夠正常訪問Upstream服務器的問題