swarm-controller: chgrp the runtime dir in ExecStartPost, ExecStart's setup undid the ExecStartPre one
This commit is contained in:
parent
738dd1c95b
commit
a6147dc875
2 changed files with 8 additions and 7 deletions
|
|
@ -727,11 +727,12 @@ in
|
||||||
# 0750 with the group set to `clientsGroup` below: only nginx and
|
# 0750 with the group set to `clientsGroup` below: only nginx and
|
||||||
# root can reach the socket inside.
|
# root can reach the socket inside.
|
||||||
RuntimeDirectoryMode = "0750";
|
RuntimeDirectoryMode = "0750";
|
||||||
# systemd chowns the runtime directory to `User:Group` on every
|
# systemd re-chowns the runtime directory to `User:Group` while
|
||||||
# start, and the daemon is not a member of `clientsGroup`, so it
|
# setting up every command, `ExecStart` included, so a chgrp in
|
||||||
# cannot chgrp the directory itself. `+` runs this as root, after
|
# `ExecStartPre` is undone. The daemon is not a member of
|
||||||
# that chown.
|
# `clientsGroup` and cannot chgrp it itself; `+` runs this as root,
|
||||||
ExecStartPre = "+${pkgs.coreutils}/bin/chgrp ${clientsGroup} ${builtins.dirOf deployCfg.swarm-controller.socketPath}";
|
# after the last chown.
|
||||||
|
ExecStartPost = "+${pkgs.coreutils}/bin/chgrp ${clientsGroup} ${builtins.dirOf deployCfg.swarm-controller.socketPath}";
|
||||||
# Preserved across restarts so the path never vanishes from under a
|
# Preserved across restarts so the path never vanishes from under a
|
||||||
# running nginx. The daemon unlinks a stale socket on start, which
|
# running nginx. The daemon unlinks a stale socket on start, which
|
||||||
# is what makes preservation safe.
|
# is what makes preservation safe.
|
||||||
|
|
|
||||||
|
|
@ -449,8 +449,8 @@ let
|
||||||
group = "swarm-controller-clients";
|
group = "swarm-controller-clients";
|
||||||
in
|
in
|
||||||
sc.RuntimeDirectoryMode == "0750"
|
sc.RuntimeDirectoryMode == "0750"
|
||||||
&& lib.hasPrefix "+" sc.ExecStartPre
|
&& lib.hasPrefix "+" sc.ExecStartPost
|
||||||
&& lib.hasInfix "chgrp ${group} /run/swarm-controller" sc.ExecStartPre
|
&& lib.hasInfix "chgrp ${group} /run/swarm-controller" sc.ExecStartPost
|
||||||
&& lib.elem group allLocal.systemd.services.nginx.serviceConfig.SupplementaryGroups
|
&& lib.elem group allLocal.systemd.services.nginx.serviceConfig.SupplementaryGroups
|
||||||
&& allLocal.users.groups ? ${group}
|
&& allLocal.users.groups ? ${group}
|
||||||
&& sc.Group != group;
|
&& sc.Group != group;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue