前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >centos下 连接sqlserver (provide:SSL Provider,error:31 - Encryption(ssl/tls) handshake failed)

centos下 连接sqlserver (provide:SSL Provider,error:31 - Encryption(ssl/tls) handshake failed)

作者头像
FreeTimeWorker
发布2021-04-23 11:17:43
3K0
发布2021-04-23 11:17:43
举报
文章被收录于专栏:C#开发点点滴滴C#开发点点滴滴

Microsfot.Data.SqlClient.SqlException(0x80131904):A connection was successfully established with the server, but then an error occurred during the pre-login handshake.(provide:SSL Provider,error:31 - Encryption(ssl/tls) handshake failed)

出现错误的原因为服务器默认使用的ssl为TLS1_2版本,而sqlserver需要的版本为TLSv1

代码语言:javascript
复制
sudo openssl s_client -host 127.0.0.1 -port 1433
CONNECTED(00000003)
140572016162704:error:140790E5:SSL routines:ssl23_write:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 289 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
SSL-Session:
    Protocol  : TLSv1.2
    Cipher    : 0000
    Session-ID:
    Session-ID-ctx:
    Master-Key:
    Key-Arg   : None
    Krb5 Principal: None
    PSK identity: None
    PSK identity hint: None
    Start Time: 1618986419
    Timeout   : 300 (sec)
    Verify return code: 0 (ok)
---

修改方法如下

代码语言:javascript
复制
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

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2021-04-21 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
SSL 证书
腾讯云 SSL 证书(SSL Certificates)为您提供 SSL 证书的申请、管理、部署等服务,为您提供一站式 HTTPS 解决方案。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档