|
@@ -728,6 +728,55 @@ function sign_gpg_key {
|
728
|
728
|
esac
|
729
|
729
|
}
|
730
|
730
|
|
|
731
|
+function gpg_key_trust {
|
|
732
|
+ data=$(tempfile 2>/dev/null)
|
|
733
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
734
|
+ dialog --title $"Trust a PGP/GPG key or website domain" \
|
|
735
|
+ --backtitle $"Freedombone User Control Panel" \
|
|
736
|
+ --inputbox $"Enter the Key ID, address or domain to be trusted.\n\nIf you are trusting a website domain then include the https:// at the beginning.\n\nIf you are trusting an ssh key then include ssh:// before the domain name." 14 75 2>$data
|
|
737
|
+ sel=$?
|
|
738
|
+ case $sel in
|
|
739
|
+ 0)
|
|
740
|
+ TRUST_ADDRESS=$(<$data)
|
|
741
|
+ if [ ${#TRUST_ADDRESS} -gt 2 ]; then
|
|
742
|
+ clear
|
|
743
|
+ gpg --search "$TRUST_ADDRESS"
|
|
744
|
+ fpr=$(gpg --with-colons --fingerprint "$TRUST_ADDRESS" | grep fpr | head -n 1 | awk -F ':' '{print $10}')
|
|
745
|
+ if [ ${#fpr} -gt 2 ]; then
|
|
746
|
+
|
|
747
|
+ data=$(tempfile 2>/dev/null)
|
|
748
|
+ trap "rm -f $data" 0 1 2 5 15
|
|
749
|
+ dialog --backtitle $"Freedombone User Control Panel" \
|
|
750
|
+ --title $"Trust a PGP/GPG key or website domain" \
|
|
751
|
+ --radiolist $"Set the trust level for $TRUST_ADDRESS:" 18 70 10 \
|
|
752
|
+ 1 $"I don't know or won't say" off \
|
|
753
|
+ 2 $"I do NOT trust" off \
|
|
754
|
+ 3 $"I trust marginally" on \
|
|
755
|
+ 4 $"I trust fully" off \
|
|
756
|
+ 5 $"I trust ultimately" off 2> $data
|
|
757
|
+ sel=$?
|
|
758
|
+ case $sel in
|
|
759
|
+ 1) return;;
|
|
760
|
+ 255) return;;
|
|
761
|
+ esac
|
|
762
|
+ TRUST_LEVEL=$(cat $data)
|
|
763
|
+ if [ ${TRUST_LEVEL} -ge 1] ; then
|
|
764
|
+ if [ ${TRUST_LEVEL} -le 5] ; then
|
|
765
|
+ echo -e "trust\n${TRUST_LEVEL}\ny\nsave\n" | gpg --command-fd 0 --edit-key $fpr
|
|
766
|
+ if [ "$?" = "0" ]; then
|
|
767
|
+ gpg --update-trustdb
|
|
768
|
+ dialog --title $"Trust a PGP/GPG key or website domain" \
|
|
769
|
+ --backtitle $"Freedombone User Control Panel" \
|
|
770
|
+ --msgbox $"$TRUST_ADDRESS was set to trust level ${TRUST_LEVEL}" 6 50
|
|
771
|
+ fi
|
|
772
|
+ fi
|
|
773
|
+ fi
|
|
774
|
+ fi
|
|
775
|
+ fi
|
|
776
|
+ ;;
|
|
777
|
+ esac
|
|
778
|
+}
|
|
779
|
+
|
731
|
780
|
function menu_encryption_keys {
|
732
|
781
|
while true
|
733
|
782
|
do
|
|
@@ -735,7 +784,7 @@ function menu_encryption_keys {
|
735
|
784
|
trap "rm -f $data" 0 1 2 5 15
|
736
|
785
|
dialog --backtitle $"Freedombone User Control Panel" \
|
737
|
786
|
--title $"My Encryption Keys" \
|
738
|
|
- --radiolist $"Choose an operation:" 17 70 9 \
|
|
787
|
+ --radiolist $"Choose an operation:" 18 70 10 \
|
739
|
788
|
1 $"Show your PGP/GPG key" off \
|
740
|
789
|
2 $"Publish your PGP/GPG key so that others can find it" off \
|
741
|
790
|
3 $"Add someone's PGP/GPG key" off \
|
|
@@ -744,7 +793,8 @@ function menu_encryption_keys {
|
744
|
793
|
6 $"Refresh your PGP/GPG keys" off \
|
745
|
794
|
7 $"Add an ssh key for logging in" off \
|
746
|
795
|
8 $"Remove an ssh key for logging in" off \
|
747
|
|
- 9 $"Back to main menu" on 2> $data
|
|
796
|
+ 9 $"Set the trust level for a PGP/GPG key" off \
|
|
797
|
+ 10 $"Back to main menu" on 2> $data
|
748
|
798
|
sel=$?
|
749
|
799
|
case $sel in
|
750
|
800
|
1) break;;
|
|
@@ -759,7 +809,8 @@ function menu_encryption_keys {
|
759
|
809
|
6) refresh_gpg_keys;;
|
760
|
810
|
7) add_ssh_key;;
|
761
|
811
|
8) remove_ssh_key;;
|
762
|
|
- 9) break;;
|
|
812
|
+ 9) gpg_key_trust;;
|
|
813
|
+ 10) break;;
|
763
|
814
|
esac
|
764
|
815
|
done
|
765
|
816
|
}
|