Spring启动时默认的TLS版本是什么?



在文档中,server.ssl.protocol的默认值是TLS,但它没有指定将使用哪个版本。

我读到TLS 1.3自java 11以来可用,但它是在Sprint启动时默认使用的吗?

是否有任何配置可以告诉我在我的项目中使用哪个版本?
或者任何依赖于Spring启动版本的文档,可以告诉框架使用的TLS版本?

我正在使用Spring Boot 2.7.3andJDK 17默认支持TLSv1.3

您可以通过运行下面的命令来检查。我的应用程序在本地端口8080上运行,所以我在-connect之后通过了127.0.01:8080

openssl s_client -connect 127.0.01:8080

CONNECTED(00000003)
140704377439424:error:1404B42E:SSL routines:ST_CONNECT:tlsv1 alert protocol version:/AppleInternal/Library/BuildRoots/810eba08-405a-11ed-86e9-6af958a02716/Library/Caches/com.apple.xbs/Sources/libressl/libressl-3.3/ssl/tls13_lib.c:151:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 5 bytes and written 294 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
Protocol  : TLSv1.3
Cipher    : 0000
Session-ID:
Session-ID-ctx:
Master-Key:
Start Time: 1668006818
Timeout   : 7200 (sec)
Verify return code: 0 (ok)
---

您可以通过此属性更改TLS版本。

server.ssl.enabled-protocols=TLSv1.2

想了解更多吗?参考以下链接

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/howto.webserver.configure-ssl

https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/application-properties.server.server.ssl.enabled-protocols

最新更新