summaryrefslogtreecommitdiff
path: root/refresh_keys.sh
blob: 5beea8991578b72c1cf84939179957923376765d (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
#!/bin/bash

set -e

function main() {
    echo "DC4323D1738F27358793D6E87BB52F7036FA7C18:6:" | gpg --import-ownertrust && gpg --update-trustdb

    cd /tmp
    rm -rf /tmp/keys || true
    git clone https://code.liz.coffee/keys
    cd keys
    gpg --status-fd 1 --verify authorized_keys.sig | grep -q "VALIDSIG DC4323D1738F27358793D6E87BB52F7036FA7C18" || exit 1
    gpg --decrypt authorized_keys.sig

    sed '/emprespresso/d' ~/.ssh/authorized_keys 
    cat authorized_keys >> ~/.ssh/authorized_keys
    cd /tmp
    rm -rf keys
}

function handle_error() {
    curl -d "ERROR IN UPDATING KEYS: $(cat /etc/hostname)" ntfy.sh/emprespresso-liz-dot-coffee
}

main || handle_error