我已经提供了一个新的Server 2012框来进行设置。
我试图使用powershell来安装chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
并收到错误
Exception calling "DownloadString" with "1" argument(s): "The underlying connection was closed: An unexpected error
occurred on a receive."
At line:1 char:1
+ iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/in ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WebException
我可以在浏览器中访问that URL。
起初我认为这与Chocolatey有关但后来我意识到了
(New-Object System.Net.WebClient).DownloadString('http://google.com'))
可以下载html内容
但
((New-Object System.Net.WebClient).DownloadString('https://google.com'))
失败并出现相同的错误
The underlying connection was closed: An unexpected error occurred on a receive.
方框:
我确信我做的事情很傻但却看不到......
---更新---
我按照以下步骤操作:
``` 1.在“控制面板”中,单击“管理工具”,然后双击“本地安全策略”。
2.在“本地安全设置”中,展开“本地策略”,然后单击“安全选项”。
3.在右窗格中的“策略”下,双击“系统加密:使用符合FIPS的算法进行加密,散列和签名”,然后单击“已启用”。
之后可以下载巧克力安装脚本,但随后失败:
STDOUT: FIPS Mode detected - run 'choco feature enable -n useFipsCompliantChecksums'
to use Chocolatey.
When FIPS Mode is enabled, Chocolatey requires useFipsCompliantChecksums feature also be enabled.
STDERR:
---- End output of C:\ProgramData\chocolatey/bin/choco.exe list -l -r ----
Ran C:\ProgramData\chocolatey/bin/choco.exe list -l -r returned 1
仍然感觉GPO的改变不应该是必要的
答案 0 :(得分:9)
事实证明,这是因为我们的服务器映像中禁用了TLS 1.0以符合PCI DSS 3.1。
回滚对图像的更改解决了PowerShell问题。
在短期内我们可以运行
在使用[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
之前 System.Net.WebClient
,但我想找到一种方法在机器级别强制执行...
我logged this with Chocolatey他们解决了问题\ o /
答案 1 :(得分:0)
试试这个:
$WBC = New-Object System.Net.WebClient
$WBC.DownloadString("https://google.com")