可以使用 System.Security.AccessControl 访问 DCOM 安全性吗?

发布于 2024-07-13 15:52:19 字数 462 浏览 3 评论 0原文

我知道 DCOM 主题已经讨论过几次了。 然而,我对现有的解决方案并不满意(目前)。 这就是为什么我在这里开始一个新问题。

现在大家都知道,访问控制列表 (ACL) 存储有关哪些用户可以对应用程序执行哪些操作的信息,存储在注册表中的 HKCL\AppID{GUID}[AccessPermission|LaunchPermission] 下。 这些键包含二进制形式 (byte[]) 的“序列化 ACL”数据。

我只是不相信不能将这些值与 System.Security.AccessControl 命名空间一起使用。 必须有一种方法来“反序列化”它们并向其中添加或删除条目。

另外,我当然谈论的是 .NET 解决方案。 可能有必要也可能没有必要调用一些神奇的 api 函数或实现一些奇怪的结构,但我确信可以实现一个漂亮且直观的 .NET 库,使我们能够从托管代码处理 DCOM 安全设置。

有人知道如何做吗?

I know that the DCOM topic has been discussed a couple of times already. However, I am not satisfied with the solutions that are available (yet). This is why I start a new question here.

Every knows by now that The Access Control Lists (ACL) that store information about which users may do what with applications are stored in the registry under HKCL\AppID{GUID}[AccessPermission|LaunchPermission]. These keys contain "serialized ACL" data in binary form (byte[]).

I simply do not believe that it is not possible to work with these values with the System.Security.AccessControl namespace. There must be a way of "deserializing" them and add or remove entries to and from them.

Also, I am of course talking about a .NET solution. It may or may not be necessary p/invoking some magic api functions or implementing some weird structs whatsoever, but I am sure that it's possible to implement a nice and intuitive .NET library that enables us to deal with DCOM Security Settings from managed code.

Does anyone have an idea of how to do it?

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

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

发布评论

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

评论(2

樱娆 2024-07-20 15:52:19

虽然我还没有找到完全托管的解决方案,但您可以在“Server 2008 Windows SDK”中找到示例程序 DCOMPerm。 这可以用作创建 DCOM 安全设置的完全托管版本的模型。

就我而言,我阅读了 SDK 的许可证,其中声明可以分发从示例创建的目标代码。 所以我最终执行了 DCOMPerm.exe 以从安装中设置访问权限。

While I have not been able to find a fully managed solution, you will find a sample program DCOMPerm in the "Server 2008 Windows SDK". This can be used as a model to create a fully managed version of DCOM security settings.

In my case, I read the license for the SDK, which states that object code created from the samples may be distributed. So I ended up EXEC'ing DCOMPerm.exe to set access permissions from the install.

独闯女儿国 2024-07-20 15:52:19

这是您问题的解决方案

 var reg = Registry.ClassesRoot.OpenSubKey(@"AppID\{BBAA0E44-3862-490C-8E63-AC2D2D6EF733}", true);
    
 var descriptor = reg.GetValue("LaunchPermission") as byte[];
    
 var DCOM_Descriptor  = new System.Security.AccessControl.RawSecurityDescriptor(descriptor, 0);

您可以使用 securityDescriptor 执行您想要的操作。

This is the solution for your question

 var reg = Registry.ClassesRoot.OpenSubKey(@"AppID\{BBAA0E44-3862-490C-8E63-AC2D2D6EF733}", true);
    
 var descriptor = reg.GetValue("LaunchPermission") as byte[];
    
 var DCOM_Descriptor  = new System.Security.AccessControl.RawSecurityDescriptor(descriptor, 0);

You can do what you want with the securityDescriptor.

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