k8s: the gateway's group reads the store credential files nginx includes
This commit is contained in:
parent
132d876668
commit
e0b3c0a644
1 changed files with 119 additions and 64 deletions
|
|
@ -2256,7 +2256,7 @@ let
|
|||
let
|
||||
h = allLocal.services.hyperhive;
|
||||
unit = allLocal.systemd.services.swarm-bao-store-auth;
|
||||
rule = store: "f /var/lib/swarm-store-auth/${store}.conf 0600 root root -";
|
||||
rule = store: "f /var/lib/swarm-store-auth/${store}.conf 0640 root nginx -";
|
||||
# One store's vhost: every location that dials it includes the file,
|
||||
# and no other location does.
|
||||
vhost =
|
||||
|
|
@ -2348,10 +2348,20 @@ let
|
|||
&& hasInfix "store-auth.pem" h.deploy.bao.storeAuthClientCertFile
|
||||
&& lib.elem (rule "victorialogs") allLocal.systemd.tmpfiles.rules
|
||||
&& lib.elem (rule "victoriametrics") allLocal.systemd.tmpfiles.rules
|
||||
# nginx runs as `User=nginx`: the directory and the nginx files are its
|
||||
# group's to read, written that way and fixed when they already hold the
|
||||
# value, and the passwords stay root's.
|
||||
&& lib.elem "d /var/lib/swarm-store-auth 0750 root nginx - -" allLocal.systemd.tmpfiles.rules
|
||||
&& hasInfix "install -d -m 0750 -o root -g nginx /var/lib/swarm-store-auth" unit.script
|
||||
&& hasInfix ''atomic_write_secret 0640 root:nginx "$nginx_file" "$directive"'' unit.script
|
||||
&& hasInfix ''chown root:nginx "$nginx_file"'' unit.script
|
||||
&& hasInfix ''chmod 0640 "$nginx_file"'' unit.script
|
||||
&& hasInfix ''atomic_write_secret 0600 root:root "$password_file" "$password"'' unit.script
|
||||
# Without either store there is no unit, no file and no location.
|
||||
&& !(noNode.systemd.services ? swarm-bao-store-auth)
|
||||
&& !(lib.elem (rule "victorialogs") noNode.systemd.tmpfiles.rules)
|
||||
&& !(lib.elem (rule "victoriametrics") noNode.systemd.tmpfiles.rules)
|
||||
&& !(lib.elem "d /var/lib/swarm-store-auth 0750 root nginx - -" noNode.systemd.tmpfiles.rules)
|
||||
&& !(noNode.services.nginx.virtualHosts ? ${h.swarm.victorialogs.domain})
|
||||
&& !(noNode.services.nginx.virtualHosts ? ${h.swarm.victoriametrics.domain});
|
||||
}
|
||||
|
|
@ -2369,7 +2379,7 @@ let
|
|||
flag: lib.elemAt exporter.args ((lib.lists.findFirstIndex (a: a == flag) (-1) exporter.args) + 1);
|
||||
locations = allLocal.services.nginx.virtualHosts.${h.swarm.nats.domain}.locations;
|
||||
include = "include /var/lib/swarm-store-auth/nats.conf;";
|
||||
rule = "f /var/lib/swarm-store-auth/nats.conf 0600 root root -";
|
||||
rule = "f /var/lib/swarm-store-auth/nats.conf 0640 root nginx -";
|
||||
in
|
||||
after "-http_user" == "swarm-exporter"
|
||||
# The argument is the variable Kubernetes substitutes, and the Secret it
|
||||
|
|
|
|||
Loading…
Reference in a new issue