mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 22:29:06 +01:00
scripts: Move nebula scripts into subdirectory
This commit is contained in:
parent
b94ff46b24
commit
0f69eb0355
3 changed files with 11 additions and 4 deletions
31
scripts/nebula/regen-all-host-certs.nix
Normal file
31
scripts/nebula/regen-all-host-certs.nix
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
{ self', pkgs, ... }:
|
||||
pkgs.writeShellApplication {
|
||||
name = "nebula-regen-all-host-certs";
|
||||
|
||||
runtimeInputs = [
|
||||
pkgs.bitwarden-cli
|
||||
pkgs.jq
|
||||
self'.packages.nebula-regen-host-cert
|
||||
];
|
||||
|
||||
text = ''
|
||||
hosts="$(nix eval .#nixosConfigurations --apply 'builtins.attrNames' --json | jq -r '.[]')"
|
||||
|
||||
if ! declare -px BW_SESSION >/dev/null 2>&1; then
|
||||
BW_SESSION="$(bw unlock --raw || bw login --raw)"
|
||||
export BW_SESSION
|
||||
fi
|
||||
|
||||
ca_key="$(mktemp)"
|
||||
chmod 600 "$ca_key"
|
||||
trap 'rm -f "$ca_key"' EXIT
|
||||
bw get notes 'nebula ca-key' > "$ca_key"
|
||||
|
||||
for host in $hosts; do
|
||||
echo "Regenerating certificate for $host..."
|
||||
nebula-regen-host-cert "$host" "$ca_key"
|
||||
done
|
||||
|
||||
echo "Done!"
|
||||
'';
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue