Named pipes permissions

本文探讨了Windows系统中Named Pipes的安全性设置,包括不同版本的Windows如何通过DACL来控制对Named Pipes的访问权限,并介绍了使用pipeacl工具进行安全性配置的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Named pipes permissions

Named pipes are implemented by a filesystem driver in Windows NT, npfs.sys, which supports security descriptors on each named pipe. These security descriptors are used to control access to named pipes. It is possible to use the pipeacl tool ([42], [43]) to examine and modify security descriptors on named pipes.

In Windows 2000, named pipes DACL (Discretionnary Access Control Lists) grant permissions to EVERYONE and ADMINISTRATORS for most named pipes used as MSRPC endpoints. Because ANONYMOUS LOGON is included in EVERYONE in Windows 2000, named pipes permissions allow anonymous accesses.

E:/>pipeacl /??/pipe/lsarpc
Revision: 1
Reserved: 0
Control : 8004
Owner: BUILTIN/Administrators (S-1-5-32-544)
Group: SYSTEM (S-1-5-18)
Sacl: Not present
Dacl: 2 aces
(A) (00) 0012019b : Everyone (S-1-1-0)
(A) (00) 001f01ff : BUILTIN/Administrators (S-1-5-32-544)

In Windows XP and Windows Server 2003, DACL grant permissions to EVERYONE, ANONYMOUS LOGON and ADMINISTRATORS. EVERYONE and ANONYMOUS LOGON are given exactly the same permissions: permissions are thus exactly equivalent to Windows 2000 permissions (starting with Windows XP, EVERYONE does not include ANONYMOUS LOGON so ANONYMOUS LOGON must explicitely appear in ACL).

C:/>pipeacl /??/pipe/lsarpc
Revision: 1
Reserved: 0
Control : 8004
Owner: BUILTIN/Administrators (S-1-5-32-544)
Group: SYSTEM (S-1-5-18)
Sacl: Not present
Dacl: 3 aces
(A) (00) 001f01ff : BUILTIN/Administrators (S-1-5-32-544)
(A) (00) 0012019b : Anonymous (S-1-5-7)
(A) (00) 0012019b : Everyone (S-1-1-0)

It is possible to modify ACL on named pipes using pipeacl and typically either add a deny ACE for ANONYMOUS LOGON in Windows 2000 or remove the ACE for ANONYMOUS LOGON in Windows XP and Windows Server 2003.

When permissions are manually removed for ANONYMOUS LOGON for named pipes that are either hardcoded in the SMB server driver or found in the NullSessionPipes registry value such as lsarpc, it is no longer possible to open this pipe in the context of a NULL session.

To conclude, permissions on named permissions are typically not used for NULL sessions restrictions because, by default, DACL allow accesses for ANONYMOUS LOGON. It is not really practical to modify default DACL, given that modifications of DACL on named pipes are not persistent (because named pipes are created by RPC services at startup).

 
### Python 中 `no module named pipes` 错误解决方案 当遇到“No module namedpipes’”错误时,这通常意味着当前使用的 Python 环境未能找到名为 `pipes` 的模块。此问题可能由多种因素引起。 #### 可能的原因分析 1. **环境配置不正确** 如果工作环境中存在多个版本的 Python 安装,则可能会导致某些包仅存在于特定版本下而其他版本不可访问的情况[^1]。 2. **拼写错误** 需要注意的是,“pip” 和 “pipes” 是不同的库。“pip”是一个用于安装和管理 Python 包的工具;而“pipes”,则是在 Unix/Linux 下处理管道流的一个标准库,在 Windows 上并不适用。如果意图使用的是前者,请确认命令输入无误[^3]。 3. **缺少必要的依赖项** 对于一些跨平台开发场景来说,部分功能实现会依据操作系统差异有所不同。例如,在 POSIX 兼容系统(如 Linux 或 macOS)中确实有提供 `pipes` 模块支持文件间通信机制的功能,但在 Windows 平台上该特性并未被原生支持。 #### 解决方法建议 对于希望在不同平台上都能正常工作的程序而言: - 若目标是执行与管道有关的操作,考虑采用更通用的方式替代直接调用 `pipes` 模块。比如利用 subprocess 来创建子进程并与之交互。 ```python import subprocess process = subprocess.Popen(['command', 'arg'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = process.communicate() print(stdout.decode()) ``` - 当确需针对特定操作系统编写代码时,可以通过检测运行时所处的操作系统来有条件地导入相应模块: ```python import sys if not sys.platform.startswith('win'): import pipes else: # For windows alternative solution here. pass ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值