This commit is contained in:
trinity-1686a 2025-02-09 23:45:36 +01:00
commit 4a60501de5
4 changed files with 32 additions and 0 deletions

0
additional_keys Normal file
View file

1
operators Normal file
View file

@ -0,0 +1 @@
curl https://git.deuxfleurs.fr/trinity-1686a.gpg | gpg --import # 0xA2EDA98C6B86D9D0

16
update_key.sh Normal file
View file

@ -0,0 +1,16 @@
#!/bin/sh
set -xeuo pipefail
TMP_FILE=".ssh/authorized_keys.tmp"
CMD="$HOME/wol.sh"
truncate --size 0 $TMP_FILE
for target in $(cat operators | sed 's/curl \([^ ]*\).gpg .*/\1.keys/'); do
curl "$target" | sed 's#.*#command="'"$CMD"'" \0 '"$target"'#' >> $TMP_FILE
done
cat additional_keys | sed 's#.*#command="'"$CMD"'" \0#' >> $TMP_FILE
chmod 600 $TMP_FILE
mv $TMP_FILE .ssh/authorized_keys

15
wol.sh Normal file
View file

@ -0,0 +1,15 @@
#!/bin/sh
set -euo pipefail
TARGETS=(
"origan (staging): 00:23:24:af:fd:ec"
"onion (prod): 00:23:24:b0:e8:66"
"oseille (prod): 00:23:24:af:f9:0b"
"ortie (prod): 00:23:24:b0:01:b9"
)
MACS=$(gum choose --no-limit "${TARGETS[@]}" | sed 's/^[^:]*: *//')
[ -z "$MACS" ] && echo You must select at least one server to wake up && exit 1
wakeonlan -- $MACS