This commit is contained in:
Bob Mottram 2017-07-28 22:05:24 +01:00
commit ae62a45f70
1 changed files with 25 additions and 1 deletions

View File

@ -72,6 +72,26 @@ function upgrade_keyserver {
function_check set_repo_commit function_check set_repo_commit
set_repo_commit /var/www/$KEYSERVER_DOMAIN_NAME/htdocs "keyserver web commit" "$KEYSERVER_WEB_COMMIT" $KEYSERVER_WEB_REPO set_repo_commit /var/www/$KEYSERVER_DOMAIN_NAME/htdocs "keyserver web commit" "$KEYSERVER_WEB_COMMIT" $KEYSERVER_WEB_REPO
read_config_param MY_USERNAME
USER_EMAIL_ADDRESS=$MY_USERNAME@$HOSTNAME
GPG_ID=$(su -m root -c "gpg --list-keys $USER_EMAIL_ADDRESS | sed -n '2p' | sed 's/^[ \t]*//'" - $MY_USERNAME)
if [ ! $GPG_ID ]; then
echo $'No GPG ID for admin user'
exit 846336
fi
if [ ${#GPG_ID} -lt 5 ]; then
echo $'GPG ID not retrieved for admin user'
exit 835292
fi
if [[ "$GPG_ID" == *"error"* ]]; then
echo $'GPG ID not retrieved for admin user due to error'
exit 74825
fi
sed -i "s|###ENTERPUBLICKEYHERE###|$GPG_ID|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/404.html
sed -i "s|###ENTERPUBLICKEYHERE###|$GPG_ID|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/index.html
sed -i "s|###ENTERNAMEHERE###|$USER_EMAIL_ADDRESS|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/404.html
sed -i "s|###ENTERNAMEHERE###|$USER_EMAIL_ADDRESS|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/index.html
chown -R www-data:www-data /var/www/$KEYSERVER_DOMAIN_NAME/htdocs chown -R www-data:www-data /var/www/$KEYSERVER_DOMAIN_NAME/htdocs
} }
@ -149,7 +169,7 @@ function keyserver_import_keys {
fi fi
cd /var/lib/sks/dump cd /var/lib/sks/dump
echo $'Getting keyserver dump. This may take a few days or longer, so be patient.' echo $'Getting keyserver dump. This may take a few days or longer, so be patient.'
rm -rf cd /var/lib/sks/dump/* rm -rf /var/lib/sks/dump/*
KEYSERVER_DUMP_URL="https://keyserver.mattrude.com/dump/$(date +%F)/" KEYSERVER_DUMP_URL="https://keyserver.mattrude.com/dump/$(date +%F)/"
wget -crp -e robots=off --level=1 --cut-dirs=3 -nH \ wget -crp -e robots=off --level=1 --cut-dirs=3 -nH \
-A pgp,txt $KEYSERVER_DUMP_URL -A pgp,txt $KEYSERVER_DUMP_URL
@ -229,6 +249,10 @@ function install_keyserver {
echo $'GPG ID not retrieved for admin user due to error' echo $'GPG ID not retrieved for admin user due to error'
exit 74825 exit 74825
fi fi
sed -i "s|###ENTERPUBLICKEYHERE###|$GPG_ID|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/404.html
sed -i "s|###ENTERPUBLICKEYHERE###|$GPG_ID|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/index.html
sed -i "s|###ENTERNAMEHERE###|$USER_EMAIL_ADDRESS|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/404.html
sed -i "s|###ENTERNAMEHERE###|$USER_EMAIL_ADDRESS|g" /var/www/$KEYSERVER_DOMAIN_NAME/htdocs/index.html
sksconf_file=/var/lib/sks/sksconf sksconf_file=/var/lib/sks/sksconf
echo 'debuglevel: 3' > $sksconf_file echo 'debuglevel: 3' > $sksconf_file