Publish gpg key from user control panel
This commit is contained in:
parent
8f02e9c434
commit
166e7c28ba
|
@ -34,6 +34,7 @@ export TEXTDOMAIN=${PROJECT_NAME}-controlpanel-user
|
||||||
export TEXTDOMAINDIR="/usr/share/locale"
|
export TEXTDOMAINDIR="/usr/share/locale"
|
||||||
|
|
||||||
MY_EMAIL_ADDRESS=$USER@$HOSTNAME
|
MY_EMAIL_ADDRESS=$USER@$HOSTNAME
|
||||||
|
GPG_ID=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $1}')
|
||||||
|
|
||||||
function any_key {
|
function any_key {
|
||||||
echo ' '
|
echo ' '
|
||||||
|
@ -347,7 +348,6 @@ function block_unblock_subject {
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_gpg_key {
|
function show_gpg_key {
|
||||||
GPG_ID=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $1}')
|
|
||||||
GPG_FINGERPRINT=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "key fingerprint" | head -n 1 | awk -F '= ' '{print $2}')
|
GPG_FINGERPRINT=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "key fingerprint" | head -n 1 | awk -F '= ' '{print $2}')
|
||||||
GPG_DATE=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $2}')
|
GPG_DATE=$(gpg --fingerprint $MY_EMAIL_ADDRESS | grep -i "pub" | head -n 1 | awk -F '/' '{print $2}' | awk -F ' ' '{print $2}')
|
||||||
dialog --title $"Your PGP/GPG Key" \
|
dialog --title $"Your PGP/GPG Key" \
|
||||||
|
@ -355,6 +355,13 @@ function show_gpg_key {
|
||||||
--msgbox $"Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
|
--msgbox $"Email Address: $MY_EMAIL_ADDRESS\n\nKey ID: $GPG_ID\n\nFingerprint: $GPG_FINGERPRINT\n\nCreated: $GPG_DATE" 12 70
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function publish_gpg_key {
|
||||||
|
gpg --send-key $GPG_ID
|
||||||
|
any_key
|
||||||
|
dialog --title $"Publish your PGP/GPG key" \
|
||||||
|
--msgbox $"Your key has now been published" 6 40
|
||||||
|
}
|
||||||
|
|
||||||
function add_gpg_key {
|
function add_gpg_key {
|
||||||
data=$(tempfile 2>/dev/null)
|
data=$(tempfile 2>/dev/null)
|
||||||
trap "rm -f $data" 0 1 2 5 15
|
trap "rm -f $data" 0 1 2 5 15
|
||||||
|
@ -476,13 +483,14 @@ 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 $"Your Encryption Keys" \
|
--title $"Your Encryption Keys" \
|
||||||
--radiolist $"Choose an operation:" 14 70 6 \
|
--radiolist $"Choose an operation:" 15 70 7 \
|
||||||
1 $"Show your PGP/GPG key" off \
|
1 $"Show your PGP/GPG key" off \
|
||||||
2 $"Add someone's PGP/GPG key" off \
|
2 $"Publish your PGP/GPG key so that others can find it" off \
|
||||||
3 $"Remove someone's PGP/GPG key" off \
|
3 $"Add someone's PGP/GPG key" off \
|
||||||
4 $"Add an ssh key for logging in" off \
|
4 $"Remove someone's PGP/GPG key" off \
|
||||||
5 $"Remove an ssh key for logging in" off \
|
5 $"Add an ssh key for logging in" off \
|
||||||
6 $"Back to main menu" on 2> $data
|
6 $"Remove an ssh key for logging in" off \
|
||||||
|
7 $"Back to main menu" on 2> $data
|
||||||
sel=$?
|
sel=$?
|
||||||
case $sel in
|
case $sel in
|
||||||
1) break;;
|
1) break;;
|
||||||
|
@ -490,11 +498,12 @@ function menu_encryption_keys {
|
||||||
esac
|
esac
|
||||||
case $(cat $data) in
|
case $(cat $data) in
|
||||||
1) show_gpg_key;;
|
1) show_gpg_key;;
|
||||||
2) add_gpg_key;;
|
2) publish_gpg_key;;
|
||||||
3) remove_gpg_key;;
|
3) add_gpg_key;;
|
||||||
4) add_ssh_key;;
|
4) remove_gpg_key;;
|
||||||
5) remove_ssh_key;;
|
5) add_ssh_key;;
|
||||||
6) break;;
|
6) remove_ssh_key;;
|
||||||
|
7) break;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue