Skip to content

Commit 64ecf8c

Browse files
authored
Update applications-dont-support-tls-1-2.md
1 parent 4aca2af commit 64ecf8c

File tree

1 file changed

+32
-26
lines changed

1 file changed

+32
-26
lines changed

articles/cloud-services/applications-dont-support-tls-1-2.md

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ Param(
6565
param ( $restart)
6666
$subkeys = Get-Item -Path "HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL"
6767
$ciphers = $subkeys.OpenSubKey("Ciphers", $true)
68+
6869
if($ciphers.SubKeyCount -eq 0) {
6970
$k1 = $ciphers.CreateSubKey("RC4 128/128")
7071
$k1.SetValue("Enabled", 0, [Microsoft.Win32.RegistryValueKind]::DWord)
@@ -103,7 +104,9 @@ Function Set-CryptoSetting {
103104
New-ItemProperty -Path $regkeys[$keyindex] -Name $value -Value $valuedata -PropertyType $valuetype | Out-Null
104105
$restart = $True
105106
Write-Host "Configuring $regkeys[$keyindex]...."
107+
106108
} Else {
109+
107110
# Value does exist - if not equal to desired value, change it
108111
If ($val -ne $valuedata) {
109112
Set-ItemProperty -Path $regkeys[$keyindex] -Name $value -Value $valuedata
@@ -149,7 +152,9 @@ Function Set-Windows10PlusCurveOrder {
149152
if( $null -eq $val) {
150153
New-ItemProperty -Path $regkeys[15] -Name EccCurves -Value $desiredOrder -PropertyType MultiString | Out-Null
151154
$reboot = $True
155+
152156
} else {
157+
153158
if ([System.String]::Join(';', $val) -ne [System.String]::Join(';', $desiredOrder)) {
154159
Write-Host "The original curve order ", `n, $val, `n, "needs to be updated to ", $desiredOrder
155160
Set-ItemProperty -Path $regkeys[15] -Name EccCurves -Value $desiredOrder
@@ -159,6 +164,7 @@ Function Set-Windows10PlusCurveOrder {
159164
}
160165
161166
$reboot
167+
162168
}
163169
164170
If ([Environment]::OSVersion.Version.Major -lt 10) {
@@ -188,19 +194,15 @@ If ([Environment]::OSVersion.Version.Major -lt 10) {
188194
}
189195
190196
# If any settings are changed, this will change to $True and the server will reboot
191-
192197
$reboot = $False
193198
194199
# Check for existence of registry keys (SSL 2.0, SSL 3.0, TLS 1.0, TLS 1.1, TLS 1.2), and create if they do not exist
195-
196200
For ($i = 0; $i -le 14; $i = $i + 1) {
197201
If (!(Test-Path -Path $regkeys[$i])) {
198202
New-Item $regkeys[$i] | Out-Null
199203
}
200204
}
201205
202-
####################################################
203-
204206
# Ensure SSL 2.0 disabled for client/server
205207
$reboot = Set-CryptoSetting 10 DisabledByDefault 1 DWord $reboot
206208
$reboot = Set-CryptoSetting 10 Enabled 0 DWord $reboot
@@ -231,8 +233,6 @@ $reboot = Set-CryptoSetting 7 Enabled 1 DWord $reboot
231233
$reboot = Set-CryptoSetting 8 DisabledByDefault 0 DWord $reboot
232234
$reboot = Set-CryptoSetting 8 Enabled 1 DWord $reboot
233235
234-
####################################################
235-
236236
$reboot = DisableRC4($reboot)
237237
238238
If ($SetCipherOrder) {
@@ -253,40 +253,46 @@ If ($SetCipherOrder) {
253253
254254
$reboot = Set-Windows10PlusCurveOrder $reboot
255255
256-
# If any settings were changed, reboot
257-
# If any settings were changed, reboot
258-
If ($reboot)
259-
{
260-
Write-Host "Rebooting now..."
261-
Write-Host "Using this command: shutdown.exe /r /t 5 /c ""Crypto settings changed"" /f /d p:2:4 "
262-
shutdown.exe /r /t 5 /c "Crypto settings changed" /f /d p:2:4
263-
}
264-
Else
265-
{
266-
Write-Host "Nothing get updated."
267-
}
268-
269-
270-
<# If ($reboot) {
256+
If ($reboot) {
271257
# Randomize the reboot timing since it could be run in a large cluster.
272258
$tick = [System.Int32]([System.DateTime]::Now.Ticks % [System.Int32]::MaxValue)
273259
$rand = [System.Random]::new($tick)
274260
$sec = $rand.Next(30, 600)
275261
Write-Host "Rebooting after", $sec, " second(s)..."
276-
Write-Host shutdown.exe /r /t $sec /c "Crypto settings changed" /f /d p:2:4
262+
Write-Host "shutdown.exe /r /t $sec /c ""Crypto settings changed"" /f /d p:2:4"
263+
shutdown.exe /r /t $sec /c "Crypto settings changed" /f /d p:2:4
264+
277265
} Else {
266+
278267
Write-Host "Nothing get updated."
279-
} #>
268+
}
280269
```
281270

282271
## Step 2: Create a command file
283272

284273
Create a CMD file named **RunTLSSettings.cmd** using the below. Store this script on your local desktop for easy access in later steps.
285274

286275
```cmd
287-
PowerShell -ExecutionPolicy Unrestricted %~dp0TLSsettings.ps1
288-
REM This line is required to ensure the startup tasks does not block the role from starting in case of error. DO NOT REMOVE!!!!
289-
EXIT /B 0
276+
SET LOG_FILE="%TEMP%\StartupLog.txt"
277+
SET EXECUTE_PS1=0
278+
279+
IF "%ComputeEmulatorRunning%" == "" (
280+
SET EXECUTE_PS1=1
281+
)
282+
283+
IF "%ComputeEmulatorRunning%" == "false" (
284+
SET EXECUTE_PS1=1
285+
)
286+
287+
IF %EXECUTE_PS1% EQU 1 (
288+
echo "Invoking SSLConfigure.ps1 on Azure service at %TIME% on %DATE%" >> %LOG_FILE% 2>&1
289+
PowerShell -ExecutionPolicy Unrestricted %~dp0SSLConfigure.ps1 -sco >> %LOG_FILE% 2>&1
290+
) ELSE (
291+
echo "Skipping SSLConfigure.ps1 invocation on emulated environment" >> %LOG_FILE% 2>&1
292+
)
293+
294+
EXIT /B %ERRORLEVEL%
295+
290296
```
291297

292298
## Step 3: Add the startup task to the role’s service definition (csdef)

0 commit comments

Comments
 (0)