Non vi capita, ma se vi capita di dovervi connettere a un DB di MSSQL 2005 da un client Windows 11, sappiate che potreste avere qualche difficoltà.
Parliamo di sistemi che non dovrebbero più essere in produzione (MSSQL 2005 ha terminato il supporto standard nel 2011), ma non per questo bisogna escluderne la possibilità.
Il problema principale lo si riscontra a causa di alcuni protocolli di cifratura dismessi con la release 24H2 di Windows 11, nello specifico i seguenti:
- TLS_RSA_WITH_3DES_EDE_CBC_SHA
- TLS_RSA_WITH_RC4_128_SHA
- LS_RSA_WITH_RC4_128_MD5
SQL Management Studio, durante la connessione dovrebbe restituire un errore in cui indica che la connessione è stata forzatamente chiusa da remoto (errore 10054).
Per riabilitare i cifrari, possiamo preparare uno script interattivo per PowerShell (grazie AI):
------------------------------------------------------------
<#
.SYNOPSIS
Script interattivo per abilitare o disabilitare i cifrari legacy (RC4, 3DES)
necessari per la compatibilità con SQL Server 2005 su sistemi Windows recenti.
#>
function Backup-Registry {
param([string]$Mode)
$timestamp = Get-Date -Format 'yyyyMMdd_HHmmss'
$path = "$env:SystemDrive\cipher_backup_${Mode}_$timestamp.reg"
reg export "HKLM\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002" $path | Out-Null
Write-Host "📁 Backup del registro salvato in: $path" -ForegroundColor Cyan
}
function Enable-LegacyCiphers {
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002"
$legacySuites = @(
"TLS_RSA_WITH_3DES_EDE_CBC_SHA",
"TLS_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_RC4_128_MD5"
)
Backup-Registry -Mode "enable"
$currentCiphers = (Get-ItemProperty -Path $regPath).Functions
$missing = $legacySuites | Where-Object { $_ -notin $currentCiphers }
if ($missing.Count -gt 0) {
Write-Host "➕ Aggiunta cipher suite legacy: $($missing -join ', ')" -ForegroundColor Yellow
$newList = $currentCiphers + $missing
Set-ItemProperty -Path $regPath -Name "Functions" -Value $newList
Write-Host "✅ Cifrari legacy abilitati." -ForegroundColor Green
} else {
Write-Host "✅ Tutti i cifrari legacy sono già presenti." -ForegroundColor Green
}
}
function Disable-LegacyCiphers {
$regPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Cryptography\Configuration\Local\SSL\00010002"
$legacySuites = @(
"TLS_RSA_WITH_3DES_EDE_CBC_SHA",
"TLS_RSA_WITH_RC4_128_SHA",
"TLS_RSA_WITH_RC4_128_MD5"
)
Backup-Registry -Mode "disable"
$currentCiphers = (Get-ItemProperty -Path $regPath).Functions
$filtered = $currentCiphers | Where-Object { $_ -notin $legacySuites }
if ($filtered.Count -lt $currentCiphers.Count) {
Write-Host "❌ Rimozione cipher suite legacy: $($legacySuites -join ', ')" -ForegroundColor Red
Set-ItemProperty -Path $regPath -Name "Functions" -Value $filtered
Write-Host "✅ Cifrari legacy disabilitati." -ForegroundColor Green
} else {
Write-Host "✅ Nessun cifrario legacy da rimuovere." -ForegroundColor Green
}
}
function Show-Menu {
Clear-Host
Write-Host "╔═══════════════════════════════════════════╗"
Write-Host "║ SQL Server 2005 Legacy Cipher Tool ║"
Write-Host "╚═══════════════════════════════════════════╝"
Write-Host ""
Write-Host "1. ✅ Abilita cifrari legacy (RC4, 3DES)"
Write-Host "2. ❌ Disabilita cifrari legacy"
Write-Host "3. 🚪 Esci"
Write-Host ""
}
do {
Show-Menu
$choice = Read-Host "Seleziona un'opzione [1-3]"
switch ($choice) {
'1' { Enable-LegacyCiphers }
'2' { Disable-LegacyCiphers }
'3' { Write-Host "Uscita..." -ForegroundColor Cyan }
default {
Write-Host "❗ Scelta non valida. Riprova." -ForegroundColor Red
}
}
if ($choice -ne '3') {
Write-Host ""
Pause
}
} while ($choice -ne '3')
--------------------------------------------------------------
0 commenti:
Posta un commento