aboutsummaryrefslogtreecommitdiff
path: root/keys/update.sh
blob: 66d0e6a5b1109275153a2bead752a5ca20b1c6a2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh
# Easy script to throw in the crontab of a system to update SSH keys from
# my personal server via HTTPs. This implies that you trust all of the CAs
# on your system.... It's up to you whether you are going to risk that.
set -e
_timeout=5
_url="https://www.rygel.us/etc/keys/personal"
keys="$HOME/.ssh/authorized_keys"

_temp="$(mktemp)"

if curl \
	--connect-timeout $_timeout \
	"$_url" > "$_temp" 2>/dev/null
then
	cp "$_temp" "$keys"
	chmod 600 "$keys"
fi

rm "$_temp"