From 8ecfe880ccdc01cf67b7293c685e95d4cba0c216 Mon Sep 17 00:00:00 2001 From: tongtongstudio Date: Thu, 12 Nov 2026 22:09:45 +0800 Subject: [PATCH] fix: preserve user access to managed agent pipe after migration --- deploy/windows/migrate-managed.ps1 | 5 +++++ docs/agent-management.md | 2 ++ 2 files changed, 7 insertions(+) diff --git a/deploy/windows/migrate-managed.ps1 b/deploy/windows/migrate-managed.ps1 index 5ef0ae6..efb12a8 100644 --- a/deploy/windows/migrate-managed.ps1 +++ b/deploy/windows/migrate-managed.ps1 @@ -37,6 +37,11 @@ try { $next | ConvertTo-Json -Depth 10 | Set-Content -LiteralPath $configPath -Encoding utf8NoBOM & $ctl --config $configPath config validate --file $configPath if ($LASTEXITCODE) { throw 'Managed config validation failed' } + # Elevated directory creation may set Administrators as owner. The pipe ACL + # follows this owner, so use the actual installing account rather than its group. + $directoryAcl = Get-Acl -LiteralPath $root + $directoryAcl.SetOwner([System.Security.Principal.WindowsIdentity]::GetCurrent().User) + Set-Acl -LiteralPath $root -AclObject $directoryAcl & $ctl --config $configPath service install if ($LASTEXITCODE) { throw 'Managed service installation failed' } $ready=$false diff --git a/docs/agent-management.md b/docs/agent-management.md index c3d2e0d..9aab6a6 100644 --- a/docs/agent-management.md +++ b/docs/agent-management.md @@ -116,3 +116,5 @@ sudo ./adsctl --config /home/agent/.config/ads/agent.json service install --syst ## 协议与限制 v3 增加 `/agents/register`(Agent WSS)、`/agents`(管理员 HTTP/WSS 列表)、`/rpc?agent=ID`(管理员 HTTP POST/WSS 请求)。均在 `/v3` 下,支持部署路径前缀。关联请求有超时与数量限制;服务端保留有限的离线主机快照,重启控制中心后重新注册。此版本不提供远程二进制升级、用户账号管理、任意命令执行或跨平台 USB 后端。 + +Windows 排障:本机管理返回拒绝访问时,检查配置目录所有者是否为实际使用管理客户端的用户。管理员权限创建目录可能将所有者设为 Administrators,普通 UAC 桌面进程不能使用这个组访问私有管道。保留原 ACL,将专属配置目录所有者调整为实际用户,再重启 Agent 重建管道。不要向 Everyone 授予管理权限。