Powershell 限制主机上的远程访问

发布于 2024-10-20 14:02:16 字数 242 浏览 7 评论 0原文

我有三台windows 2008 R2服务器; DEV、UAT 和实时。我正在这些服务器之间部署 Web 应用程序,包括 IIS 设置和配置以及通过 PowerShell 脚本进行数据库备份和恢复。我使用 powershell 远程会话。 我想阻止除我的部署计算机之外的任何计算机在主机上创建 powershell 远程会话,即使用户已通过身份验证。这可能吗?

我广泛查看了 PSRemoting 文档,但找不到任何有用的内容。

提前致谢

I have three windows 2008 R2 servers; DEV, UAT and Live. I am deploying web apps between these servers, including IIS setup and config and database backup and restore via a PowerShell script. I use a powershell remote session.
I would like to prevent any machine, other than my deployment machine, from creating a powershell remote session on the host, even if the user is authenticated. Is this possible?

I have looked extensively through the PSRemoting documentation and can't find anything helpful.

Thanks in advance

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

要走就滚别墨迹 2024-10-27 14:02:16

阅读下面的链接以更好地了解需要做什么,但我认为您需要在远程服务器上设置受信任的主机。

http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/02/23/remotely-managing-your-server-core-using-winrm-a​​nd-winrs.aspx

这是博客的摘录。

在 Windows 服务器核心盒上

在Server Core盒子的控制台上运行以下命令来降低安全性:

WinRM set winrm/config/service/auth @{Basic="true"}
WinRM set winrm/config/client @{TrustedHosts="<local>"} 
WinRM set winrm/config/client @{TrustedHosts="RemoteHost"}

其中 RemoteHost 是您希望能够连接到服务器的主机。

Read the below link to better understand what needs to be done but I think you need to set the trusted host on the remote servers.

http://blogs.dirteam.com/blogs/sanderberkouwer/archive/2008/02/23/remotely-managing-your-server-core-using-winrm-and-winrs.aspx

This is an excerp from the blog.

On the Windows server Core box

Run the following commands on the console of the Server Core box to lower security:

WinRM set winrm/config/service/auth @{Basic="true"}
WinRM set winrm/config/client @{TrustedHosts="<local>"} 
WinRM set winrm/config/client @{TrustedHosts="RemoteHost"}

Where RemoteHost is the host you want to be able to connect to the server.

給妳壹絲溫柔 2024-10-27 14:02:16

您还可以使用基于证书的身份验证。

http://blogs.msdn.com/b/wmi/archive/2009/03/23/how-to-use-wsman-config-provider-for-certificate-authentication.aspx

如果您只希望您的计算机能够连接,在您的计算机上安装证书,不要将其提供给其他任何人。

You can also use certificate-based authentication.

http://blogs.msdn.com/b/wmi/archive/2009/03/23/how-to-use-wsman-config-provider-for-certificate-authentication.aspx

If you only want your computer to be able to connect, install the certificate on your computer and don't give it to anyone else.

南薇 2024-10-27 14:02:16

现在,这并不能回答您限制机器连接的问题。

但是,您可以通过更改 SessionConfiguration 的权限来配置允许哪些用户连接到会话。

使用的默认远程会话配置是 microsoft.powershell,如中所示。

Get-PsSessionConfiguration

可以根据自己的喜好更改访问权限。

Set-PsSeesionConfiguration -Name microsoft.powershell -ShowSecurityDescriptorUI

我真的很喜欢关于使用证书并仅允许 WinRM/SSL 的建议,因为这可以解决我在该领域遇到的问题。

Now, this doesn't anser you question of limiting connections by machine.

But, you can configure what users are allowed to connect to a session by changing the permissions of the SessionConfiguration.

The default remote session configuration used is microsoft.powershell as shown in

Get-PsSessionConfiguration

The access permissions can be changed to your own liking.

Set-PsSeesionConfiguration -Name microsoft.powershell -ShowSecurityDescriptorUI

I really like the suggestion about using certificates and only permitting WinRM/SSL, as that would solve an issue I'm having myself in that area.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文