summaryrefslogtreecommitdiff
path: root/install.sh
blob: 11f5872dab7e8775d062bc9d3c47390c92be689a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/bash

gpg --import DC4323D1738F27358793D6E87BB52F7036FA7C18.asc
echo "DC4323D1738F27358793D6E87BB52F7036FA7C18:6:" | gpg --quiet --import-ownertrust && gpg --update-trustdb --quiet || return 1
echo "+ Trusting key"

sudo cp sshd_config /etc/ssh/sshd_config

HOME=$(getent passwd "$USER" | cut -d: -f6)
mkdir -p "$HOME/.local/bin/"
cp refresh_keys.sh "$HOME/.local/bin"

MIN=$(( 0x$(hostname | md5sum | cut -c1-15) % 30 ))
JOB="*/$MIN * * * * $HOME/.local/bin/refresh_keys.sh"
( crontab -l 2>/dev/null | grep -vF 'refresh_keys.sh'; echo "$JOB" ) | crontab -

mkdir -p "$HOME/.ssh"
$HOME/.local/bin/refresh_keys.sh