blob: a9dfd7678b7dfca28e8003dfef3e2830d9a249ff (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#!/bin/bash
set -e
function main() {
cd /tmp
rm -rf /tmp/keys || true
git clone --quiet https://code.liz.coffee/keys.git/
cd keys
echo "+ Cloned keys"
echo "DC4323D1738F27358793D6E87BB52F7036FA7C18:6:" | gpg --quiet --import-ownertrust && gpg --update-trustdb --quiet
echo "+ Trusting key"
gpg --status-fd 1 --verify authorized_keys.sig 2>/dev/null | grep -q VALIDSIG | grep -q "DC4323D1738F27358793D6E87BB52F7036FA7C18"
echo "+ Validated"
gpg --output authorized_keys --decrypt authorized_keys.sig 2>/dev/null
echo "+ Decrypted"
sed -i '/emprespresso/d' ~/.ssh/authorized_keys
grep -qv "emprespresso" ~/.ssh/authorized_keys # assert
echo "+ Removed emprespresso keys"
cat authorized_keys >> ~/.ssh/authorized_keys
echo "+ Appended emprespresso keys"
cd /tmp
rm -rf keys
echo "+ Done"
}
function handle_error() {
curl -d "ERROR IN UPDATING KEYS: $(cat /etc/hostname)" ntfy.sh/emprespresso-liz-dot-coffee
}
main || handle_error
|