OpenVPN 连接错误 TLS error: Unsupported protocol.

OpenVPN 连接错误 TLS error: Unsupported protocol.

场景:连接VPN出现如下报错

sudo journalctl -u NetworkManager -f -n 30

nm-openvpn[4327]: TLS error: Unsupported protocol. This typically
indicates that client and server have no common TLS version enabled.
This can be caused by mismatched tls-version-min and tls-version-max
options on client and server. If your OpenVPN client is between v2.3.6
and v2.3.2 try adding tls-version-min 1.0 to the client configuration
to use TLS 1.0+ instead of TLS 1.0 only
nm-openvpn[4327]: OpenSSL: error:1425F102:SSL routines:ssl_choose_client_version:unsupported protocol
nm-openvpn[4327]: TLS_ERROR: BIO read tls_read_plaintext error
nm-openvpn[4327]: TLS Error: TLS object -> incoming plaintext read error
nm-openvpn[4327]: TLS Error: TLS handshake failed
nm-openvpn[4327]: Fatal TLS error (check_tls_errors_co), restarting
nm-openvpn[4327]: SIGUSR1[soft,tls-error] received, process restarting

环境:

系统:Deepin v20

架构: amd64 (x86_64)

内核: Linux 5.10.50-adm64-desktop

包: network-manager-openvpn/1.8.10-1

解决方案:参考stackoverflow 的回答, 分成三种方案:

https://stackoverflow.com/questions/53058362/openssl-v1-1-1-ssl-choose-client-version-unsupported-protocol

方案1:配置 VPN 客户端以允许 TLS 1.0 版 (tls-version-min 1.0);

但是由于使用 GUI 客户端导致 tls-version-min 无法生效,(network-manager-openvpn 不支持), 所以需要 升级 network-manager-openvpn 到 network-manager-openvpn/1.8.12-1;或者使用 openvpn 指定配置文件运行, 并在配置文件中 添加 tls-version-min 1.0

方案2:调整系统范围的 OpenSSL MinProtocol 设置;

Deepin20 现在至少需要 TLS 1.2 版本而不是 TLS 1.0。如果服务器不支持 TLS 1.2 或更高版本,您将收到一些连接错误。所以可以更改 /etc/ssl/openssl.cnf 配置文件。修改文件末尾:

1
2
3
[system_default_sect]
MinProtocol = TLSv1.0 # 修改此行, 原值 TLSv1.2
CipherString = DEFAULT@SECLEVEL=2
方案3:调整OpenVPN服务器的 TLS 版本。