|
@@ -573,6 +573,18 @@ function update_ciphersuite {
|
573
|
573
|
exit 0
|
574
|
574
|
}
|
575
|
575
|
|
|
576
|
+function gpg_pubkey_from_email {
|
|
577
|
+ key_owner_username=$1
|
|
578
|
+ key_email_address=$2
|
|
579
|
+ key_id=
|
|
580
|
+ if [[ $key_owner_username != "root" ]]; then
|
|
581
|
+ key_id=$(su -c "gpg --list-keys $key_email_address | grep 'pub '" - $key_owner_username | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
|
|
582
|
+ else
|
|
583
|
+ key_id=$(gpg --list-keys $key_email_address | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
|
|
584
|
+ fi
|
|
585
|
+ echo $key_id
|
|
586
|
+}
|
|
587
|
+
|
576
|
588
|
function enable_monkeysphere {
|
577
|
589
|
monkey=
|
578
|
590
|
dialog --title $"GPG based authentication" \
|
|
@@ -591,9 +603,21 @@ function enable_monkeysphere {
|
591
|
603
|
--msgbox $"$MY_USERNAME does not currently have any ids within ~/.monkeysphere/authorized_user_ids" 6 40
|
592
|
604
|
exit 0
|
593
|
605
|
fi
|
|
606
|
+
|
|
607
|
+ MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$MY_USERNAME" "$MY_USERNAME@$HOSTNAME")
|
|
608
|
+ if [ ${#MY_GPG_PUBLIC_KEY_ID} -lt 4 ]; then
|
|
609
|
+ echo $'monkeysphere unable to get GPG key ID for user $MY_USERNAME'
|
|
610
|
+ exit 52825
|
|
611
|
+ fi
|
|
612
|
+
|
594
|
613
|
sed -i 's|#AuthorizedKeysFile|AuthorizedKeysFile|g' /etc/ssh/sshd_config
|
595
|
614
|
sed -i 's|AuthorizedKeysFile.*|AuthorizedKeysFile /var/lib/monkeysphere/authorized_keys/%u|g' /etc/ssh/sshd_config
|
596
|
615
|
monkeysphere-authentication update-users
|
|
616
|
+
|
|
617
|
+ # The admin user is the identity certifier
|
|
618
|
+ fpr=$(gpg --with-colons --fingerprint $MY_GPG_PUBLIC_KEY_ID | grep fpr | head -n 1 | awk -F ':' '{print $10}')
|
|
619
|
+ monkeysphere-authentication add-identity-certifier $fpr
|
|
620
|
+
|
597
|
621
|
else
|
598
|
622
|
sed -i 's|#AuthorizedKeysFile|AuthorizedKeysFile|g' /etc/ssh/sshd_config
|
599
|
623
|
sed -i 's|AuthorizedKeysFile.*|AuthorizedKeysFile %h/.ssh/authorized_keys|g' /etc/ssh/sshd_config
|