From 472d8b16d4de857bef137c6f95e20e25f6ffe550 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=93=B8=E6=BE=9C=20+=20=E5=86=B0=E6=9C=94?= <565183519@qq.com> Date: Tue, 14 Jul 2026 19:10:16 -0700 Subject: [PATCH] fix: inherit sync agent runtime user at install --- server-tools/fifth-domain-sync-agent/README.md | 2 +- .../guanghu-fifth-domain-sync-agent.service | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server-tools/fifth-domain-sync-agent/README.md b/server-tools/fifth-domain-sync-agent/README.md index 2658113..8971c4c 100644 --- a/server-tools/fifth-domain-sync-agent/README.md +++ b/server-tools/fifth-domain-sync-agent/README.md @@ -21,5 +21,5 @@ Forgejo 已签名 push 1. 在 `/etc/guanghu/fifth-domain-sync-agent.json` 按 `config.example.json` 配置,不提交真实配置。 2. 在 `/etc/guanghu/fifth-domain-sync-agent.env` 设置仅服务器持有的 `FORGEJO_WEBHOOK_SECRET`。 3. Forgejo webhook 指向 `/forgejo/sync`,使用相同 HMAC secret,并仅选择 push 事件。 -4. 安装 systemd unit 后执行 `daemon-reload`、`enable --now`;健康检查为 `/health`。 +4. 安装 systemd unit 前,安装器必须把 `User=__RUN_AS_USER__` 替换为现有受控接收器的实际系统运行用户;不得假定旧架构目录名就是 Linux 用户。随后执行 `daemon-reload`、`enable --now`;健康检查为 `/health`。 5. 发布动作仍通过广播塔三阶段与受限 deployment receiver;此 Agent 不替代 GLSV 人格体发起的服务器操作流程。 diff --git a/server-tools/fifth-domain-sync-agent/guanghu-fifth-domain-sync-agent.service b/server-tools/fifth-domain-sync-agent/guanghu-fifth-domain-sync-agent.service index 32749ea..116cf86 100644 --- a/server-tools/fifth-domain-sync-agent/guanghu-fifth-domain-sync-agent.service +++ b/server-tools/fifth-domain-sync-agent/guanghu-fifth-domain-sync-agent.service @@ -5,7 +5,8 @@ Wants=network-online.target [Service] Type=simple -User=zhuyuan +# 安装器必须替换为现有受控接收器实际运行的系统用户;不得把旧目录名当作 Linux 用户名。 +User=__RUN_AS_USER__ WorkingDirectory=/opt/zhuyuan/fifth-domain/server-tools/fifth-domain-sync-agent Environment=FIFTH_DOMAIN_SYNC_CONFIG=/etc/guanghu/fifth-domain-sync-agent.json EnvironmentFile=/etc/guanghu/fifth-domain-sync-agent.env