本卡屬 FR-193(母卡 FR-193 母案(同清單上一張)),卡 A4,階段 P1,批 3。只改 evidence-agent。依賴:A1。
容器裡的 uid 1000 在 rootless 下對應到主機是「子 uid 起點 + 1000」(例如 101000),每台不同。安裝程式裡三處 chown 1000 全部改走換算函式。另外解密後的設定目錄 /run/guidant-agent 現在 root 700,guidant 的 Docker 要讀得到才能把 .env 掛進容器,改 750 root:guidant、.env 640,放在 secrets 服務的 load 裡(tmpfs 每次開機重建)。
new:換算函式獨立一支讓 A3 之外的檔也能用;secrets 服務解完改 750 root:guidant
repo:/Users/chouraymond/Projects/Billows/Audit-Manager/evidence-agent
改既有:scripts/install/lib/secrets.sh
改既有:scripts/install/lib/secrets_cmds.sh
改既有:scripts/install/lib/systemd/guidant-agent-secrets.service
新開:scripts/install/lib/subuid_map.sh
scripts/install/lib/subuid_map.sh:subuid_base() { awk -F: -v u="$GUIDANT_RUN_USER" '$1==u{print $2; exit}' /etc/subuid; }、host_uid_for() { echo $(( $(subuid_base) + $1 )); }。install.sh 與 upgrade 兩邊都 source。deploy/install.sh:2333(seaweedfs 私鑰 chown 1000:1000→chown $(host_uid_for 1000):$(host_uid_for 1000))、lib/upgrade_order.sh:91(_UO_APP_ID 改成呼叫 host_uid_for 1000)、lib/local_admin.sh:28(那條是容器內 -u 0 跑 chown 1000,容器內看到的仍是 1000,不改;只改它外面若有主機側 chown)。全 repo grep -rn 'chown.*1000' deploy scripts/install 逐條判「主機側」還是「容器內」。/run/guidant-agent:lib/secrets.sh 的 sec_ready_run_dir 維持建 700,但 secrets.sh load 收尾加 chown root:$GUIDANT_RUN_USER "$SEC_RUN_DIR" && chmod 750 "$SEC_RUN_DIR" && chmod 640 "$SEC_RUN_DIR/.env"。lib/systemd/guidant-agent-secrets.service 的 Before=docker.service 改 Before=user@@[email protected](install 時 sed 代入 uid)。agent-order/ 750 owner 換算後 uid;upgrade/ 本身 755 root。A5 會接著用。stat -c %u /srv/guidant-ai-agent/certs/seaweedfs.key 等於 host_uid_for 1000;容器內 touch /upload/x 成功;重開機後不登入等一分鐘 docker ps(走 dk)三顆在跑;/run/guidant-agent 750 root:guidant。install.sh 2333、upgrade_order.sh 91、local_admin.sh 28 三處 chown 走換算;/run/guidant-agent 開機後 750 root:guidant、.env 640;容器能寫 upload/agent-order;重開機後 Agent 自起
docs/features/FR-193-2611-docker-rootless/design-v1.2.md(現行定稿)§1 決策 D1~D8、§2.2 接入點盤點、§3 詳細設計本卡那節、§4 主機六項、§6 拆卡表本卡那列;design.md/design-v1.1.md 已凍結只當沿革scripts/build/fetch_tpm2_debs.sh(離線套件抓法)、Agent scripts/install/lib/tpm.sh(離線裝法與 gate)、lib/upgrade_order.sh 檔頭(升級單不可信五條)、BE scripts/build/audit_nonroot_stack.sh --agent(總驗工具)