diff --git a/src/freedombone-app-keyserver b/src/freedombone-app-keyserver index 829b3838..3d15bb62 100755 --- a/src/freedombone-app-keyserver +++ b/src/freedombone-app-keyserver @@ -72,6 +72,26 @@ function upgrade_keyserver { function_check set_repo_commit 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 } @@ -149,7 +169,7 @@ function keyserver_import_keys { fi cd /var/lib/sks/dump 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)/" wget -crp -e robots=off --level=1 --cut-dirs=3 -nH \ -A pgp,txt $KEYSERVER_DUMP_URL @@ -229,6 +249,10 @@ function install_keyserver { 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 sksconf_file=/var/lib/sks/sksconf echo 'debuglevel: 3' > $sksconf_file