前两天碰到了一个诡异的问题,Azure Data factory通过integration runtime连接on-premise sql server提示SqlErrorNumber=10054
服务器端Windows Server是2012R2,SQL server版本2012 - 11.0.5058.0
客户端是Server 2022最新Patch
具体报错错如下:
Cannot connect to SQL Database. Please contact SQL server team for further support. Server: ' ', Database: ' ', User: ' '. Check the linked service configuration is correct, and make sure the SQL Database firewall allows the integration runtime to access.
A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider, error: 0 - An existing connection was forcibly closed by the remote host.), SqlErrorNumber=10054,Class=20,State=0,
An existing connection was forcibly closed by the remote host
然后在客户端用SQL Server Management Studio测试连接也是相同的报错:
查报错代码微软相关文档解释说是TLS不匹配,TLS 1.0/1.1已经被禁用了,需要升级server端的sql的patch以支持TLS1.2,但是碍于是客户的生产环境不方便升级,而且后面安装了客户端测试机一模一样Patch却可以正常连接,说明不是这个问题,本来想等到停机窗口升级SQL了再说,好在最后找到方法了,只通过修改客户端组策略解决
在客户机运行gpedit.msc 打开有问题的客户端的组策略,
找到 计算机配置 -> 管理模板 -> 网络 -> SSL 配置设置-> SSL密码套件顺序,把
TLS_DHE_* 开头的密码套件删除,重启客户机问题解决
微软的解释是某些windows版本之后使用TLS_DHE密码套件会在密钥前加0,而之前的windows则不会,组策略中的这个密码套件顺序如果不设置的话貌似是随机使用密码套件(所以这就是为啥装了另一台一模一样的客户端却好好的原因),当某些情况下用到TLS_DHE密码套件时,两边不匹配导致无法正常连接,可以升级OS的Patch解决也可以在客户端上修改套件顺序解决。
还是建议多多更新Patch吧😂
微软的说明:https://learn.microsoft.com/zh-cn/troubleshoot/windows-server/identity/apps-forcibly-closed-tls-connection-errors