Refresh gpg keys on client

This commit is contained in:
Bob Mottram 2016-05-01 19:51:00 +01:00
parent 12ab51351e
commit 110a2f08d4
1 changed files with 106 additions and 88 deletions

View File

@ -53,6 +53,23 @@ SSH_MACS=$(cat $MAIN_PROJECT_FILE | grep 'SSH_MACS=' | head -n 1 | awk -F '"' '{
SSH_KEX=$(cat $MAIN_PROJECT_FILE | grep 'SSH_KEX=' | head -n 1 | awk -F '"' '{print $2}')
SSH_HOST_KEY_ALGORITHMS=$(cat $MAIN_PROJECT_FILE | grep 'SSH_HOST_KEY_ALGORITHMS=' | head -n 1 | awk -F '"' '{print $2}')
# refresh gpg keys every few hours
REFRESH_GPG_KEYS_HOURS=2
function refresh_gpg_keys {
if [ ! -f /usr/bin/gpg ]; then
sudo apt-get -y install gnupg
fi
sudo cp /etc/crontab ~/temp_crontab
sudo chown $CURR_USER:$CURR_USER ~/temp_crontab
if ! grep -q "gpg --refresh-keys" ~/temp_crontab; then
echo "0 */$REFRESH_GPG_KEYS_HOURS * * * $CURR_USER /usr/bin/gpg --refresh-keys > /dev/null" >> ~/temp_crontab
sudo cp ~/temp_crontab /etc/crontab
chown root:root /etc/crontab
fi
rm ~/temp_crontab
}
# see https://stribika.github.io/2015/01/04/secure-secure-shell.html
function ssh_remove_small_moduli {
sudo awk '$5 > 2000' /etc/ssh/moduli > /home/$CURR_USER/moduli
@ -159,6 +176,7 @@ do
done
echo $'Configuring client'
refresh_gpg_keys
configure_ssh_client
configure_monkeysphere
if [[ $MESH_CLIENT_INSTALL == $'yes' || $MESH_CLIENT_INSTALL == $'y' || $MESH_CLIENT_INSTALL == $'on' ]]; then