我在Microsoft SQL Server 2012 Express Edition上成功配置了SSL,目的是加密通过Internet与数据库建立的外部网络连接。出于网络上内部客户端的性能原因,我不想强制使用SSL,而是让客户端选择是否使用SSL。我通过以下步骤将Force Encryption设置为No:
当我尝试与Microsoft Sql Server Management Studio建立加密连接时,在选项>连接属性上检查Encrypt connection选项时,我收到以下错误。
成功建立了与服务器的连接,但随后在登录过程中发生错误。(提供程序: SSL提供程序,错误:0-目标主体名称不正确。)(Microsoft SQL Server,错误:-2146893022)
令人吃惊的是,如果我在Sql Server配置管理器上选择Force Encryption as Yes,而在Microsoft Sql Server Management Studio上没有选择Encrypt connection,我就可以连接到数据库。如果我执行查询:
select * from sys.dm_exec_connections
事实上,列encrypt_option是真的。
证书是使用Openssl生成的,信息如下:
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 2 (0x2)
Signature Algorithm: sha256WithRSAEncryption
Validity
Not Before: Jun 9 15:53:18 2016 GMT
Not After : Jun 9 15:53:18 2018 GMT
Subject: C=US, ST=State, L=Location, O=Testing, OU=Development, CN=JOSEPH-ASUS
Subject Public Key Info:
Public Key Algorithm: rsaEncryption
Public-Key: (2048 bit)
...
Exponent: 65537 (0x10001)
X509v3 extensions:
X509v3 Subject Key Identifier:
DB:7F:58:DC:F7:D9:90:2A:DF:0E:31:84:5C:49:68:E7:61:97:D8:41
X509v3 Authority Key Identifier:
keyid:C9:5C:79:34:E0:83:B2:C7:26:21:90:17:6A:86:88:84:95:19:88:EA
X509v3 Basic Constraints:
CA:FALSE
X509v3 Key Usage:
Key Encipherment, Data Encipherment
X509v3 Extended Key Usage:
TLS Web Server Authentication
Netscape Comment:
OpenSSL Generated Certificate
X509v3 Subject Alternative Name:
DNS:alternatename1, DNS:alternatename2, IP Address:192.168.1.100, IP Address:192.191.1.101, IP Address:192.168.1.103
Signature Algorithm: sha256WithRSAEncryption
...
当前的操作系统是Windows 10 Home。
我错过了什么?
发布于 2016-07-30 07:00:56
使用OpenSSL生成的证书工作正常。在我的案例中,问题是在证书上运行MSSQL的帐户的权限,我通过以下步骤解决了这个问题:
将用于运行MSSQL实例的帐户( MSSQL实例Properties).
发布于 2016-07-21 05:26:04
当我做类似的事情时,我收到了这个错误。我还从OpenSSL创建了一个证书,并将其导入到SQL Server中。我还使用SQL Server Management Studio尝试验证是否需要证书的客户端副本。当我这样做的时候,我得到了上面描述的错误。
解决方案很简单,在连接窗口中,我没有使用证书上的CN:
将CN放在证书上,而不是127.0.0.1 (或其他任何东西),这个连接应该可以工作。
发布于 2016-10-05 05:19:58
我也遇到了同样的问题,并通过将TrustServerCertificate=True;
添加到连接字符串得到了解决。
https://stackoverflow.com/questions/37734311
复制相似问题