SQL 服务器的 Microsoft OLE DB 提供程序是否支持 TLS 1.2

Does Microsoft OLE DB Provider for SQL Server support TLS 1.2

我们的客户端最近从 TLS 1.0 升级到 TLS 1.2,之后我们的软件无法连接到 SQL 服务器。它使用 OLE DB 提供程序连接到 SQL 服务器。 以下是从 SQL server-

返回的错误

[DBNETLIB][ConnectionOpen SECDoClientHandshake()]SSL 安全错误 SQL 州:08001 SQL 错误号:18

找不到任何有关 SQL 服务器的 Microsoft OLE DB 提供程序是否支持 TLS 1.2 的有用信息。

我找到的其中一个链接似乎表明它不受支持。 https://forums.iis.net/t/1233674.aspx?connecing+SQL+server+DB+issue+after+installingTLS1+2+in+SQL+srver+with+classic+asp+application+

因此,想检查一下 Whosebug,以防有人有这方面的任何信息。

SQLOLEDB 提供程序和 SQL 服务器 ODBC 驱动程序随 Windows 一起提供是仅用于向后兼容的遗留组件。自 SQL 2005 年以来,这些已被弃用。

根据this blog post by the MSSQL Tiger Team

SQLOLEDB will not receive support for TLS 1.2. You will need to switch your driver to one of the supported drivers listed in https://support.microsoft.com/en-us/kb/3135244

您应该能够安装 SQL Server Native Client 2012 并使用该 OLE DB 提供程序,只需更改连接字符串(将 Provider=SQLOLEDB 更改为 Provider=SQLNCLI11)。当然,应该测试一次,以免出现意外。例如,我记得有人在使用服务器 API 游标时遇到 SQL Server Native Client 提供程序和 ADO classic 的行为差异,尽管常用的 firehose 游标很好。

编辑

新的 OLE DB 驱动程序,MSOLEDBSQL, has been released. This new driver includes the support for the latest TLS 1.2 standards and is backwards compatible with SQL Server Native Client 11 (SQLNCLI11). See the Microsoft SQLNCLi team blog announcement。安装后将连接字符串更改为Provider=MSOLEDBSQL

编辑 #2

时间继续前进。 SQL Server Native Client OLE DB 驱动程序现已弃用,取而代之的是 MSOLEDBSQL。 2012 SNAC 最终版本的支持将于 2012 年 7 月 12 日结束。

此外,正如 David 在他的回答中所说,Microsoft 最近在 Windows10 Build 17763.1554 中添加了对 TLS 1.2 MDAC 组件的支持:

Adds support for the Transport Layer Security (TLS) 1.1 and 1.2 protocols when connecting to SQL Server using the data providers in Microsoft Data Access Components (MDAC)

虽然没有添加任何增强功能(例如支持 post-SQL 2000 种数据类型)。

总而言之,较新的 SQL 服务器客户端驱动程序提供了对特定驱动程序和版本的更多控制,而没有直接的 OS 补丁级别依赖性。 SQL 服务器的 MSOLEDBSQL 和 ODBC 驱动程序 n 等现代驱动程序不断改进以支持最新的 SQL 服务器功能和安全标准。

编辑#3

SQLOLEDB 和 SQL 服务器 ODBC 驱动程序(MDAC 的一部分,与 Windows 一起提供和服务)支持带有 October 20, 2020 build, version 17763.1554 的 TLS 1.2。这适用于 Windows 10 和 Windows Server 2019 或更高版本。

这可能不是您的解决方案,因为它是您的客户可能无法等待的未来修复程序,但显然 Microsoft 不反对 OLEDB 驱动程序,具有2018 年第一季度支持 TLS 1.2 的新版本:https://blogs.msdn.microsoft.com/sqlnativeclient/2017/10/06/announcing-the-new-release-of-ole-db-driver-for-sql-server/

The new Microsoft OLE DB Driver for SQL Server, or msoledbsql, will also introduce multi-subnet failover capabilities in this first upcoming release, and keeps up with latest TLS 1.2 standards.

Also, this first upcoming release will be a stand-alone install package that is out-of-band with SQL Server lifecycle. This also means the driver will not be packaged in the SNAC library, nor coupled with any other driver.

我这边的以下更改解决了在 Azure 云上升级 TLS1.2 后的问题 -

  • Provider=SQLOLEDB 更改为 Provider=SQLNCLI11
  • 将 ADODB 版本更新为 Microsoft ActiveX 数据对象 6.0 库

这可能不会直接回答问题,但它仍然与 sql 服务器连接与 TLS 1.2 错误有关。

我正在维护一个旧的 ASP 经典网站,该网站出现以下错误。

Microsoft OLE DB Provider for SQL Server error '80004005'
[DBNETLIB][ConnectionOpen (SECDoClientHandshake()).]SSL Security error. 

ProviderSQLOLEDB 更改为 SQL Server Native Client 11.0 或任何可用的更高版本修复了错误。

因此,从

更改连接字符串
constr = "Provider=SQLOLEDB;Data Source=..."

constr = "Provider=SQL Server Native Client 11.0;Data Source=...."

可能也行

使用“Microsoft OLEDB Driver for SQL Server”对我们有用,但我也可以确认 Native Driver 11 也测试正常。

这是我们的场景:在我们禁用 TLS 1.0 和 1.1 并启用 TLS 1.2 后,Crystal 报告使用“Microsoft OLEDB Provider for SQL服务器”将不再连接。相反,您会收到一个 user/pw 提示,即使凭据有效,该提示也会失败。在我们的例子中,我们 运行ning Crystal 来自 ASP.NET v4.5.2 应用程序的报告,该应用程序嵌入了 Crystal 13 查看器。用户从报告列表中选择并运行 他们和他们 运行 没有启用 TLS 1.0 的提示。

要解决此问题,我们必须在设计器中打开报表并将其从使用“Microsoft OLEDB Provider for SQL Server”转换为使用“用于 SQL 服务器的 Microsoft OLEDB 驱动程序”。

如果您在列表中没有看到驱动程序,这里是 SQL 服务器的 OLEDB 驱动程序:https://docs.microsoft.com/en-us/sql/connect/oledb/download-oledb-driver-for-sql-server?view=sql-server-ver15

感谢丹·古兹曼 (Dan Guzman),他在有点隐蔽的评论和上面的更新中提到了“驱动程序”的存在。

TLS 1.2 支持已添加到 Windows 中的 sqloledb。参见 KB4580390

这包括支持 MDAC 中的 ODBC 和 OleDB 提供程序:

Adds support for the Transport Layer Security (TLS) 1.1 and 1.2 protocols when connecting to SQL Server using the data providers in Microsoft Data Access Components (MDAC)

您可以通过检查 Windows 内部版本号来验证 MDAC 是否已更新,任何 17763.1554 或更高版本都有此修复。 MDAC 多年来一直未在 OS 补丁之外分发。

构建在 winver 或 Powershell 中可见 [environment]::OSVersion.Version.Build