sql server 2016 fallback 인증서 알고리즘 변경
# sql 2016 는 SP3 업그레이드 필요 (CSAP), 아래내용 적용
# sql 2017 19는 할 필요 없음
# New-SelfSignedCertificate 생성
New-SelfSignedCertificate -Type SSLServerAuthentication -Subject "CN=$env:COMPUTERNAME" `
-DnsName ("{0}" -f [Systehttp://m.Net.Dns]::GetHostByName($env:computerName).HostName),'localhost' `
-KeyAlgorithm "RSA" -KeyLength 2048 -HashAlgorithm "SHA256" -TextExtension "2.5.29.37={text}1.3.6.1.5.5.7.3.1" `
-NotAfter (Get-Date).AddMonths(36) -KeySpec KeyExchange -Provider "Microsoft RSA SChannel Cryptographic Provider" `
-CertStoreLocation "cert:\LocalMachine\My"
# 결과
PSParentPath: Microsoft.PowerShell.Security\Certificate::LocalMachine\My
Thumbprint Subject
---------- -------
aaa5E3ddd742dd7AE1D4A8C648FC556F5B9D90003 CN=HOSTNAME.....
# 서버의 인증서 조회
dir cert:\LocalMachine\My
mmc 에서 인증서 항목을 추가하고 local computer 의 인증서를 조회해 export 가능
인증서에 해당 사용자 권한을 추가해 줘야 함
# SQL Server 2016 의 경우 아래의 방법으로 등록 (SqlServerConfigurationManager 에서 로딩이 안되더라)
$regPath = 'HKLM:\Software\Microsoft\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQLServer\SuperSocketNetLib'
$thumbprint = 'aaa5E3ddd742dd7AE1D4A8C648FC556F5B9D90003'
Set-ItemProperty $regPath -Name 'Certificate' -Value $thumbprint
# 이건 강제하고 싶을때만 하면 된다.
#Set-ItemProperty $regPath -Name 'ForceEncryption' -Value 1 -Type Dword
# sql 2019 이상에서는 네트워크 설정에서 인증서 로딩 (로딩 전 이전 서버의 인증서 복구 해두어야 한다.)
# 아래 링크 2개 잘 읽어봐~
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/manage-certificates?view=sql-server-ver16
https://learn.microsoft.com/en-us/sql/database-engine/configure-windows/configure-sql-server-encryption?view=sql-server-ver15#step-2-configure-encryption-settings-in-sql-server
# SqlServerConfigurationManager 에서 restart