服务器 A 是 Server 2008 R2,Powershell V3 所有 SSL 和 TLS 均已启用且所有密码均已启用。 服务器 B 是 Server 2016、Powershell V5 和仅 TlS 1.2 以及一组特定的密码。
我无法让 Credssp 身份验证从 A 到 B 工作,即使我使用
Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
我知道这是每个 session 设置,所以我将其包含在脚本本身中。
如果我将服务器 B(服务器 2016)设置为打开所有 SSL 和 TLS 加密,CREDSSP 就没有问题。
是的,我需要使用 CREDSSP,因为服务器 B 上的脚本引用了服务器 A 上的文件共享。
这是我正在使用的脚本,它在启用所有版本的 TLS 时再次起作用。
$pass = ConvertTo-SecureString "password" -asplaintext -force
$mycred = new-object -typename System.Management.Automation.PSCredential -argumentlist "domain\user.service",$pass
#
#
# The Remote Execution Command. Fully Qualified Domain name is critical since we are using Credssp.
# Credssp is being used to resolve an issue with a double hop authentication issue.
Invoke-Command -ComputerName ServerB.domain.edu -command { C:\HelloWorld.ps1 } -Authentication Credssp -Credential $mycred
有一件事我还没有尝试过,但我打算尝试,将服务器 A 和 B 都放在 TLS 1.2 上,看看它是否能正常工作。这不是一个长期的解决方案,因为此时无法将服务器 A 设置为仅 TLS 1.2。
最佳答案
所以看起来问题与 Server 2008 有关,只有 TLS 的服务器子项的注册表条目,而不是 SCHANNEL Reg 设置上的 TLS 的客户端子项。看图
一旦我添加了客户端子 key 并启用了 TLS 1.2 加密,它终于开始工作了。
关于Powershell CREDSSP 和 TLS 1.2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50513033/