Update to 2024-04-17 12:01

This commit is contained in:
Daniel Berteaud
2024-04-17 12:01:07 +02:00
parent 024be47049
commit d5a00e4130
5 changed files with 32 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
#!/bin/sh
export VAULT_ADDR={{ vault_conf.api_addr }}
UNSEAL='{% if vault_unseal_keys | length > 0 %}{{ vault_unseal_keys | join(',') }}{% endif %}'
STATUS=$(vault status -format json)
if [ "$(echo ${STATUS} | jq -r .initialized)" != "true" ]; then
echo "Vault not initialized yet"
exit 0
fi
if [ "$(echo ${STATUS} | jq -r .sealed)" != "true" ]; then
echo "Vault not sealed, nothing to do"
exit 0
fi
for KEY in $(echo ${UNSEAL} | sed -E 's/,/\n/g'); do
vault operator unseal "${KEY}"
done

View File

@@ -22,6 +22,9 @@ CapabilityBoundingSet=CAP_SYSLOG CAP_IPC_LOCK CAP_NET_BIND_SERVICE
NoNewPrivileges=yes
ExecStart=/usr/local/bin/vault server -config={{ vault_root_dir }}/etc/
ExecReload=/bin/kill --signal HUP $MAINPID
{%- if vault_unseal_keys | length > 0 +%}
ExecStartPost=!{{ vault_root_dir }}/bin/unseal }}
{%- endif +%}
KillMode=process
KillSignal=SIGINT
Restart=on-failure