Sign a key from the user control panel

This commit is contained in:
Bob Mottram 2016-05-02 16:35:58 +01:00
parent 83907dad8a
commit 24c1b859c9
1 changed files with 711 additions and 682 deletions

View File

@ -683,6 +683,33 @@ function syncthing_remove_id {
--msgbox $"The ID was removed" 6 50 --msgbox $"The ID was removed" 6 50
} }
function sign_gpg_key {
data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15
dialog --title $"Sign a PGP/GPG key" \
--backtitle $"Freedombone User Control Panel" \
--inputbox $"Enter the Key ID, address or domain to be signed" 8 75 2>$data
sel=$?
case $sel in
0)
SIGN_ADDRESS=$(<$data)
if [ ${#IMAGE_URL} -gt 2 ]; then
clear
fpr=$(gpg --with-colons --fingerprint $SIGN_ADDRESS | grep fpr | head -n 1 | awk -F ':' '{print $10}')
if [ ${#fpr} -gt 2 ]; then
gpg --sign-key $fpr
if [ "$?" = "0" ]; then
gpg --update-trustdb
dialog --title $"Sign a PGP/GPG key" \
--backtitle $"Freedombone User Control Panel" \
--msgbox $"$SIGN_ADDRESS was signed" 6 50
fi
fi
fi
;;
esac
}
function menu_encryption_keys { function menu_encryption_keys {
while true while true
do do
@ -690,14 +717,15 @@ function menu_encryption_keys {
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone User Control Panel" \ dialog --backtitle $"Freedombone User Control Panel" \
--title $"My Encryption Keys" \ --title $"My Encryption Keys" \
--radiolist $"Choose an operation:" 15 70 7 \ --radiolist $"Choose an operation:" 16 70 8 \
1 $"Show your PGP/GPG key" off \ 1 $"Show your PGP/GPG key" off \
2 $"Publish your PGP/GPG key so that others can find it" off \ 2 $"Publish your PGP/GPG key so that others can find it" off \
3 $"Add someone's PGP/GPG key" off \ 3 $"Add someone's PGP/GPG key" off \
4 $"Remove someone's PGP/GPG key" off \ 4 $"Remove someone's PGP/GPG key" off \
5 $"Add an ssh key for logging in" off \ 5 $"Sign a PGP/GPG key" off \
6 $"Remove an ssh key for logging in" off \ 6 $"Add an ssh key for logging in" off \
7 $"Back to main menu" on 2> $data 7 $"Remove an ssh key for logging in" off \
8 $"Back to main menu" on 2> $data
sel=$? sel=$?
case $sel in case $sel in
1) break;; 1) break;;
@ -708,9 +736,10 @@ function menu_encryption_keys {
2) publish_gpg_key;; 2) publish_gpg_key;;
3) add_gpg_key;; 3) add_gpg_key;;
4) remove_gpg_key;; 4) remove_gpg_key;;
5) add_ssh_key;; 5) sign_gpg_key;;
6) remove_ssh_key;; 6) add_ssh_key;;
7) break;; 7) remove_ssh_key;;
8) break;;
esac esac
done done
} }