swarm-controller: restrict its socket directory to nginx's access group
This commit is contained in:
parent
5bb9d7c7e5
commit
51cc093465
4 changed files with 63 additions and 16 deletions
|
|
@ -414,6 +414,24 @@ let
|
|||
&& lib.hasInfix socket l."/webhook/forge/".proxyPass
|
||||
&& !(lib.hasInfix "auth_request" l."/webhook/forge/".extraConfig);
|
||||
}
|
||||
{
|
||||
# Only nginx (through the clients group) and root reach the controller
|
||||
# socket: the runtime dir is 0750 with that group set. The last two
|
||||
# clauses are the presence controls — the group exists and is not the
|
||||
# daemon's own, so a misspelled name cannot satisfy the rest.
|
||||
name = "the controller socket's directory is 0750 and group-owned by the group nginx joins";
|
||||
ok =
|
||||
let
|
||||
sc = allLocal.systemd.services.swarm-controller.serviceConfig;
|
||||
group = "swarm-controller-clients";
|
||||
in
|
||||
sc.RuntimeDirectoryMode == "0750"
|
||||
&& lib.hasPrefix "+" sc.ExecStartPre
|
||||
&& lib.hasInfix "chgrp ${group} /run/swarm-controller" sc.ExecStartPre
|
||||
&& lib.elem group allLocal.systemd.services.nginx.serviceConfig.SupplementaryGroups
|
||||
&& allLocal.users.groups ? ${group}
|
||||
&& sc.Group != group;
|
||||
}
|
||||
{
|
||||
# nginx serves a path from its longest matching prefix location, so that
|
||||
# one must be the gated `/api/`, and no exact location may take a route
|
||||
|
|
|
|||
Loading…
Reference in a new issue