Last active
July 10, 2018 11:47
-
-
Save geo-stanciu/192bd1aed55dd1564a8b586de77127b8 to your computer and use it in GitHub Desktop.
Disable SSL 2 and SSL4 and fix RC4 issues on Windows Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Copyright (c) 2018, Gheorghita Stanciu gheorghita(dot)stanciu(at)gmail(dot)com | |
| All rights reserved. | |
| Redistribution and use in source and binary forms, with or without | |
| modification, are permitted provided that the following conditions are met: | |
| 1. Redistributions of source code must retain the above copyright notice, this | |
| list of conditions and the following disclaimer. | |
| 2. Redistributions in binary form must reproduce the above copyright notice, | |
| this list of conditions and the following disclaimer in the documentation | |
| and/or other materials provided with the distribution. | |
| THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | |
| ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | |
| ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| The views and conclusions contained in the software and documentation are those | |
| of the authors and should not be interpreted as representing official policies, | |
| either expressed or implied, of the FreeBSD Project. | |
| */ | |
| # open powershell as admin | |
| $regPath20 = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\SSL 2.0' | |
| $regPath20C = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\SSL 2.0\Client' | |
| $regPath20S = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\SSL 2.0\Server' | |
| $regPath30 = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\SSL 3.0' | |
| $regPath30C = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\SSL 3.0\Client' | |
| $regPath30S = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\SSL 3.0\Server' | |
| $regPathTS1 = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\TLS 1.0' | |
| $regPathTS1S = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Protocols\TLS 1.0\Server' | |
| $regPathC = 'HKLM:SYSTEM\CurrentControlSet\Control\SecurityProviders\Schannel\Ciphers' | |
| If(!(Test-Path -Path $regPath20)) | |
| { | |
| New-Item -Path $regPath20 -Force | |
| } | |
| If(!(Test-Path $regPath20C)) | |
| { | |
| New-Item -Path $regPath20C -Force | |
| } | |
| New-ItemProperty -Path $regPath20C -Name DisabledByDefault -PropertyType DWORD -Value "1" -Force | |
| If(!(Test-Path $regPath20S)) | |
| { | |
| New-Item -Path $regPath20S -Force | |
| } | |
| New-ItemProperty -Path $regPath20S -Name DisabledByDefault -PropertyType DWORD -Value "1" -Force | |
| New-ItemProperty -Path $regPath20S -Name Enabled -PropertyType DWORD -Value "0" -Force | |
| If(!(Test-Path $regPath30)) | |
| { | |
| New-Item -Path $regPath30 -Force | |
| } | |
| If(!(Test-Path $regPath30C)) | |
| { | |
| New-Item -Path $regPath30C -Force | |
| } | |
| If(!(Test-Path $regPath30S)) | |
| { | |
| New-Item -Path $regPath30S -Force | |
| } | |
| New-ItemProperty -Path $regPath30C -Name DisabledByDefault -PropertyType DWORD -Value "1" -Force | |
| New-ItemProperty -Path $regPath30S -Name DisabledByDefault -PropertyType DWORD -Value "1" -Force | |
| New-ItemProperty -Path $regPath30S -Name Enabled -PropertyType DWORD -Value "0" -Force | |
| If(!(Test-Path $regPathTS1)) | |
| { | |
| New-Item -Path $regPathTS1 -Force | |
| } | |
| If(!(Test-Path $regPathTS1S)) | |
| { | |
| New-Item -Path $regPathTS1S -Force | |
| } | |
| New-ItemProperty -Path $regPathTS1S -Name DisabledByDefault -PropertyType DWORD -Value "0" -Force | |
| New-ItemProperty -Path $regPathTS1S -Name Enabled -PropertyType DWORD -Value "1" -Force | |
| If(!(Test-Path $regPathC)) | |
| { | |
| New-Item -Path $regPathC -Force | |
| } | |
| $Writable = $True | |
| $Key = (Get-Item HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL).OpenSubKey("Ciphers", $Writable).CreateSubKey("RC4 128/128") | |
| $Key.SetValue("Enabled", "0", [Microsoft.Win32.RegistryValueKind]::DWORD) | |
| $Key = (Get-Item HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL).OpenSubKey("Ciphers", $Writable).CreateSubKey("RC4 40/128") | |
| $Key.SetValue("Enabled", "0", [Microsoft.Win32.RegistryValueKind]::DWORD) | |
| $Key = (Get-Item HKLM:\System\CurrentControlSet\Control\SecurityProviders\SCHANNEL).OpenSubKey("Ciphers", $Writable).CreateSubKey("RC4 56/128") | |
| $Key.SetValue("Enabled", "0", [Microsoft.Win32.RegistryValueKind]::DWORD) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment