Service

rudder-relayd.service:在步驟 NAMESPACE 失敗 - 權限被拒絕

  • May 19, 2021

我正在嘗試在工作中的 Debian buster 上使用 rudder-server,webapp 工作正常,但其中一個方向舵服務不起作用,我無法接收來自其他節點的報告:

● rudder-relayd.service - Rudder Relay Daemon
  Loaded: loaded (/usr/lib/systemd/system/rudder-relayd.service; enabled; vendor preset: enabled)
  Active: failed (Result: exit-code) since Wed 2021-05-19 09:21:32 CEST; 1min 28s ago
 Process: 32493 ExecStart=/opt/rudder/bin/rudder-relayd (code=exited, status=226/NAMESPACE)
Main PID: 32493 (code=exited, status=226/NAMESPACE)

May 19 09:21:32 rudder-v3 systemd[1]: Started Rudder Relay Daemon.
May 19 09:21:32 rudder-v3 systemd[32493]: rudder-relayd.service: Failed to set up mount namespacing: Permission denied
May 19 09:21:32 rudder-v3 systemd[32493]: rudder-relayd.service: Failed at step NAMESPACE spawning /opt/rudder/bin/rudder-relayd: Permission denied
May 19 09:21:32 rudder-v3 systemd[1]: rudder-relayd.service: Main process exited, code=exited, status=226/NAMESPACE
May 19 09:21:32 rudder-v3 systemd[1]: rudder-relayd.service: Failed with result 'exit-code'.

我的 Debian buster 是 Proxmox 伺服器上的一個容器(不是無特權的容器),一切都是最新的,我已經更改了服務的配置但沒有成功:

# vi /usr/lib/systemd/system/rudder-relayd.service
[Unit]
Description=Rudder Relay Daemon
After=network-online.target

[Service]
PrivateTmp=false
NoNewPrivileges=yes
PrivateDevices=false
ProtectControlGroups=false
ProtectKernelModules=false
ProtectSystem=false
ReadWritePaths=/var/rudder/reports /var/rudder/inventories /var/rudder/shared-files /var/rudder/cfengine-community/state
ExecStart=/opt/rudder/bin/rudder-relayd
ExecReload=/opt/rudder/bin/rudder relay reload
# Do not restart on known errors, which won't get fixed by themselves
RestartPreventExitStatus=2 3
User=rudder-relayd
Group=rudder

[Install]
RequiredBy=rudder-server.service
WantedBy=multi-user.target

當我執行“/opt/rudder/bin/rudder-relayd”時,我沒有任何錯誤:

INFO relayd: Starting rudder-relayd 6.2.7
INFO relayd: Read configuration from "/opt/rudder/etc/relayd/"
INFO relayd::data::node: Parsing nodes list from "/var/rudder/lib/relay/nodeslist.json"
INFO relayd::api: Starting API on 127.0.0.1:3030
INFO relayd::input::watch: Starting file watcher on "/var/rudder/reports/incoming"
INFO relayd: Skipping inventory as it is disabled
INFO relayd: Server started

目錄的權限是:

# ls -al /opt/rudder/bin/
[..]
-rwxr-xr-x  1 root root 8429816 Nov 22  2017 rudder-relayd
[..]

所有其他方向舵服務都可以正常工作,我什至可以使用我的管理員帳戶訪問方向舵界面。我已經能夠接受待處理的節點,但似乎如果 rudder-relayd 服務關閉,我將無法收到合規報告,並且出現以下消息:

Error occured when contacting internal remote-run API to apply classes on Node 'root': (HTTP code 503)

我的測試的簡要總結:

  • 更改 rudder-relayd.service 配置,僅添加“ PrivateTmp=false\NoNewPrivileges=yes ”行;
  • 不直接更改服務文件配置,而是使用systemctl edit rudder-relayd.service覆蓋它
  • 每次更改此文件後,我都會使用*“systemctl daemon-reload” 重新*載入守護程序;
  • 在具有相同選項的另一個容器上安裝 Rudder(仍然是相同的錯誤),在非特權容器上安裝 rudder(此錯誤停止但出現其他錯誤,我不希望這成為解決方案);

謝謝

我認為您應該在主機上使用 lxc 啟用嵌套模式,我認為使用以下命令:

lxc config set <id> security.nesting true

您可以嘗試禁用依賴於命名空間的強化選項,即ProtectSystem,ReadWritePathsPrivateTmp.

引用自:https://serverfault.com/questions/1064066