我已经为我的 SQL Server 2014 SP3 服务器创建了一个用于 TLS 1.2 的自签名证书。
尝试连接另一台计算机时出现错误
<块引用>证书链由不受信任的机构颁发
但是,我已将自签名证书导入到该计算机上的受信任根证书颁发机构中……但无济于事。我仍然收到错误。
我是否遗漏了一些明显的东西来完成这项工作?
答案 0 :(得分:0)
证书中需要包含一些属性才能使其正常工作。这是我在运行内部 SQL Server 时使用的一个过程...
在服务器上:
在客户端:
连接后,右键单击服务器节点 > 属性,然后单击“查看连接属性”。在“连接”>“加密”中,它应该说“是”。
$3years = [DateTime]::UtcNow.AddYears(3)
$enhancedKeyUsageServerAuthentication = @("2.5.29.37={text}1.3.6.1.5.5.7.3.1")
$name = $env:COMPUTERNAME.ToLower()
$fqdn = "$($name).example.com"
$ip = '192.168.0.79' # for example
$cert = New-SelfSignedCertificate `
-CertStoreLocation 'cert:\LocalMachine\My' `
-DnsName $fqdn,$name,$ip,"localhost","127.0.0.1" `
-FriendlyName "$($name)-sql-server" `
-Hash 'SHA256' `
-KeyAlgorithm 'RSA' `
-KeyExportPolicy ExportableEncrypted `
-KeySpec KeyExchange `
-KeyFriendlyName "$($name)-sql-server" `
-KeyLength 2048 `
-KeyUsage DigitalSignature,KeyEncipherment,DataEncipherment `
-NotAfter $3years `
-Provider 'Microsoft RSA SChannel Cryptographic Provider' `
-Subject $name `
-TextExtension $enhancedKeyUsageServerAuthentication `
-Type SSLServerAuthentication
$cert | Export-Certificate -Type CERT -FilePath $name-sql-server.crt