环境
- CentOS 7
- .Net 6
- Sqlsugar
错误
SqlServer:
Connection open error . A connection was successfully established with the server, but then an error occurred during the pre-login handshake. (provider: SSL Provider, error: 31 - Encryption(ssl/tls) handshake failed)
MySql:
Connection open error . Authentication failed, see inner exception.
解决方案
vim /etc/pki/tls/openssl.cnf
#在oid_section=new_oids下增加
openssl_conf = default_conf
#在文件末尾增加
[default_conf]
ssl_conf = ssl_sect
[ssl_sect]
system_default = system_default_sect
[system_default_sect]
MinProtocol = TLSv1
CipherString = DEFAULT@SECLEVEL=1
#重启sshd
sudo systemctl restart sshd
原因分析
不成熟的原因分析:
服务器使用的ssl为TLS1_2版本,而数据库连接需要的版本为TLSv1
参考
https://cloud.tencent.com/developer/article/1816990