【发布时间】:2017-05-03 04:45:33
【问题描述】:
我得到了一个新的 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.
盒子:
- 是 windows server 2012 build 9600
- 不使用代理
- 防火墙是否关闭
我确信我在做一些愚蠢的事情,但看不到什么......
--- 更新---
我按照以下步骤操作:
``` 1.在控制面板中,点击管理工具,然后双击本地安全策略。
2.在本地安全设置中,展开本地策略,然后点击安全选项。
3.在右侧窗格中的策略下,双击系统加密:使用符合 FIPS 的算法进行加密、散列和签名,然后单击启用。
- 运行 gpupdate /force ```
之后可以下载巧克力安装脚本,但随后失败:
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
【问题讨论】:
-
在下载内容之前尝试执行以下操作:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true} -
可以在命令行一个接一个地运行吗?如果是这样,那没有效果。但这是否会永久关闭证书验证?感觉有点危险
-
是的,这会关闭证书验证。例如,如果您使用自签名证书并且不想将其安装在所有客户端上,这将很有用。 G。测试目的。不过那可能不是你的问题
标签: powershell ssl windows-server-2012-r2