Last active
August 12, 2022 05:12
-
-
Save tpokorra/84aef5f97981535b871fe9e4719e940d to your computer and use it in GitHub Desktop.
Update WKD for PGP/GnuPG Keys on Hostsharing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ -z $1 ] | |
then | |
echo "Bitte den Pfad für die Datei mit dem öffentlichen Key mitgeben: z.B. $0 ~/public.txt" | |
exit | |
fi | |
publickeyfile=$(realpath $1) | |
if [ ! -f $publickeyfile ] | |
then | |
echo "Kann den öffentlichen Schlüssel nicht finden: $publickeyfile" | |
exit | |
fi | |
DOMAIN=$(find ~/doms/openpgpkey.*/htdocs-ssl | head -n 1 | awk -F/ '{ print $8 }' | sed -e 's/openpgpkey.//g') | |
if [ -z $DOMAIN ] | |
then | |
echo "Zuerst muss die subdomain openpgpkey.$DOMAIN im HSAdmin eingerichtet werden!" | |
exit | |
fi | |
cd ~/doms/openpgpkey.$DOMAIN | |
cat > .htaccess <<FINISH | |
ForceType application/octet-stream; | |
<IfModule mod_headers.c> | |
Header set Access-Control-Allow-Origin "*" | |
</IfModule> | |
FINISH | |
cd ~/doms/openpgpkey.$DOMAIN/htdocs-ssl/ | |
rm -f .htaccess | |
mkdir -p .well-known/openpgpkey | |
cd .well-known | |
gpg --import < $publickeyfile | |
gpg --list-options show-only-fpr-mbox -k "@$DOMAIN" | /usr/lib/gnupg/gpg-wks-client --install-key | |
touch openpgpkey/$DOMAIN/policy | |
chmod a+x openpgpkey/$DOMAIN/ | |
chmod a+x openpgpkey/$DOMAIN/hu/ | |
touch openpgpkey/$DOMAIN/hu/index.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment