Skip to content

Commit ae09203

Browse files
authoredApr 28, 2020
Merge pull request #7 from pauby/bug/add-tls12-support
Add TLS 1.2 support for Windows PowerShell
2 parents 5591f02 + 40abc09 commit ae09203

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
 

‎lib/puppet/provider/package/windowspowershell.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
def self.invoke_ps_command(command)
99
result = powershell(['-NoProfile', '-ExecutionPolicy', 'Bypass', '-NonInteractive', '-NoLogo', '-Command',
10-
"$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'Stop'; #{command}"])
10+
# The following section of the -Command forces powershell to use tls1.2 (which it does not by default currently unless set system wide): [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
11+
# Without tls1.2 you cannot install modules from PSGallery
12+
"$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'Stop'; [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; #{command}"])
1113
result.lines
1214
end
1315
end

‎lib/puppet/provider/pspackageprovider/windowspowershell.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44

55
def self.invoke_ps_command(command)
66
result = powershell(['-NoProfile', '-ExecutionPolicy', 'Bypass', '-NonInteractive', '-NoLogo', '-Command',
7-
"$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'Stop'; #{command}"])
7+
# The following section of the -Command forces powershell to use tls1.2 (which it does not by default currently unless set system wide): [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
8+
# Without tls1.2 you cannot install modules from PSGallery
9+
"$ProgressPreference = 'SilentlyContinue'; $ErrorActionPreference = 'Stop'; [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12; #{command}"])
810
result.lines
911
end
1012
end

0 commit comments

Comments
 (0)
Please sign in to comment.