如何使用 Windows PowerShell 禁用传输层安全性 (TLS) 和安全套接字层 (SSL) 协议的弱版本。当然,在禁用弱版本的 SSL / TSL 协议之前,您需要确保可以在您的系统上使用 TLS 1.2 协议。
Windows 操作系统兼容的协议
系统与版本 TLS 1.2 兼容
- Windows Server 2008 SP2: KB3154517
- Windows Server 2008 R2: KB3154518
- Windows Server 2012: KB3154519
- Windows Server 2012 R2: KB3154520
启用 TLS 1.2
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' `
-name 'Enabled' `
-value '1' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server' `
-name 'DisabledByDefault' `
-value 0 `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' `
-name 'Enabled' `
-value '1' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client' `
-name 'DisabledByDefault' `
-value 0 `
-PropertyType 'DWord' `
-Force `
| Out-Null
Write-Host 'TLS 1.2 has been enabled.'
禁用 SSL 2.0 和 SSL 3.0
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Server' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 2.0\Client' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
Write-Host 'SSL 2.0 has been disabled.'
禁用 SSL v3.0
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Server' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\SSL 3.0\Client' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
Write-Host 'SSL 3.0 has been disabled.'
禁用 TLS 1.0 和 1.1
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Server' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.0\Client' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
Write-Host 'TLS 1.0 has been disabled.'
禁用 TLS 1.1
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Server' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-Item `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client' `
-name 'Enabled' `
-value '0' `
-PropertyType 'DWord' `
-Force `
| Out-Null
New-ItemProperty `
-path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.1\Client' `
-name 'DisabledByDefault' `
-value 1 `
-PropertyType 'DWord' `
-Force `
| Out-Null
Write-Host 'TLS 1.1 has been disabled.'
重启生效文章来源:https://www.toymoban.com/news/detail-626007.html
ref文章来源地址https://www.toymoban.com/news/detail-626007.html
- https://www.jorgebernhardt.com/disable-ssl-and-tls-on-winserv/
到了这里,关于如何在 Windows 服务器上禁用弱版本的 SSL/TLS 协议的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!