mirror of
https://git.sr.ht/~magic_rb/dotfiles
synced 2024-11-25 09:36:14 +01:00
Harden blowhole agains sealed Vault
Signed-off-by: Magic_RB <magic_rb@redalder.org>
This commit is contained in:
parent
8b2321dde4
commit
004cfb039b
|
@ -26,8 +26,9 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
systemd.services.hashicorp-consul.unitConfig = {
|
||||
ConditionPathExists = "/run/secrets/consul.json";
|
||||
systemd.services."hashicorp-consul" = {
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
};
|
||||
|
||||
services.hashicorp.consul = {
|
||||
|
|
|
@ -63,6 +63,30 @@ in
|
|||
];
|
||||
};
|
||||
|
||||
systemd.services.vault-unsealed = {
|
||||
description = "Check whether the local Vault instance is unsealed and fail if not.";
|
||||
path = with pkgs; [ getent vault ];
|
||||
|
||||
unitConfig = {
|
||||
StartLimitInterval = 0;
|
||||
};
|
||||
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
RestartSec = 30;
|
||||
};
|
||||
|
||||
script = ''
|
||||
export VAULT_ADDR="https://vault.in.redalder.org:8200/"
|
||||
|
||||
while [ $( vault operator key-status |& grep -q "Vault is sealed" ; printf $? ) = 1 ]
|
||||
do
|
||||
sleep 30
|
||||
done
|
||||
exit 2
|
||||
'';
|
||||
};
|
||||
|
||||
system.stateVersion = "21.05";
|
||||
});
|
||||
};
|
||||
|
|
|
@ -31,8 +31,9 @@ in
|
|||
destination = "/run/secrets/hostapd_wpa_psk";
|
||||
};
|
||||
|
||||
systemd.services.hostapd.unitConfig = {
|
||||
ConditionPathExists = "/run/secrets/hostapd_wpa_psk";
|
||||
systemd.services."hostapd" = {
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
};
|
||||
|
||||
services.hostapd = {
|
||||
|
|
|
@ -45,6 +45,9 @@ in
|
|||
|
||||
systemd.services."container@klipper" = {
|
||||
restartIfChanged = lib.mkForce false;
|
||||
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
};
|
||||
|
||||
containers.klipper = {
|
||||
|
|
|
@ -205,6 +205,11 @@ in
|
|||
};
|
||||
|
||||
|
||||
systemd.services."hashicorp-envoy-telegraf" = {
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
};
|
||||
|
||||
## There is no way to say, hey, listen on localhost. The listeners option is missing the `address` field
|
||||
## and the `name` field so it's impossible to configure....
|
||||
services.hashicorp-envoy.telegraf = {
|
||||
|
@ -235,6 +240,11 @@ in
|
|||
extraConsulArgs = [ "-ignore-envoy-compatibility" ];
|
||||
};
|
||||
|
||||
systemd.services."telegraf-magic" = {
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
};
|
||||
|
||||
services.telegraf-magic = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
@ -324,7 +334,12 @@ in
|
|||
fsType = "zfs";
|
||||
};
|
||||
|
||||
systemd.services."container@monitor".serviceConfig.LimitNOFILE = "infinity";
|
||||
systemd.services."container@monitor" = {
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
|
||||
serviceConfig.LimitNOFILE = "infinity";
|
||||
};
|
||||
|
||||
# TODO: split interface name and container name, i.e. rewrite the container module....... again
|
||||
containers.monitor = {
|
||||
|
|
|
@ -28,6 +28,11 @@ in
|
|||
};
|
||||
};
|
||||
|
||||
systemd.services."hashicorp-nomad" = {
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
};
|
||||
|
||||
services.hashicorp.nomad = {
|
||||
enable = true;
|
||||
|
||||
|
|
|
@ -17,6 +17,9 @@ in
|
|||
{
|
||||
preStart = "systemd-tmpfiles --create " + config;
|
||||
postStop = "systemd-tmpfiles --clean " + config;
|
||||
|
||||
requires = [ "vault-unsealed.service" ];
|
||||
after = [ "vault-unsealed.service" ];
|
||||
};
|
||||
|
||||
services.hashicorp.vault-agent = {
|
||||
|
|
Loading…
Reference in a new issue