Browse Source

Restore monkeysphere identifier

Bob Mottram 9 years ago
parent
commit
d8d95b40aa
3 changed files with 1076 additions and 1030 deletions
  1. 5
    1
      src/freedombone
  2. 1050
    1029
      src/freedombone-restore-local
  3. 21
    0
      src/freedombone-restore-remote

+ 5
- 1
src/freedombone View File

@@ -5376,7 +5376,11 @@ function install_monkeysphere {
5376 5376
     chmod 644 /home/$MY_USERNAME/.monkeysphere/authorized_user_ids
5377 5377
     chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.monkeysphere
5378 5378
     monkeysphere-authentication update-users
5379
-	
5379
+
5380
+    # The admin user is the identity certifier
5381
+	fpr=$(gpg --with-colons --fingerprint $MY_GPG_PUBLIC_KEY_ID | grep fpr | head -n 1 | awk -F ':' '{print $10}')	
5382
+    monkeysphere-authentication add-identity-certifier $fpr
5383
+
5380 5384
     echo 'install_monkeysphere' >> $COMPLETION_FILE
5381 5385
 }
5382 5386
 

+ 1050
- 1029
src/freedombone-restore-local
File diff suppressed because it is too large
View File


+ 21
- 0
src/freedombone-restore-remote View File

@@ -488,6 +488,18 @@ function restore_user_config {
488 488
 	done
489 489
 }
490 490
 
491
+function gpg_pubkey_from_email {
492
+	key_owner_username=$1
493
+	key_email_address=$2
494
+	key_id=
495
+	if [[ $key_owner_username != "root" ]]; then
496
+		key_id=$(su -c "gpg --list-keys $key_email_address | grep 'pub '" - $key_owner_username | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
497
+	else
498
+		key_id=$(gpg --list-keys $key_email_address | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
499
+	fi
500
+	echo $key_id
501
+}
502
+
491 503
 function restore_user_monkeysphere {
492 504
 	if [[ $RESTORE_APP != 'all' ]]; then
493 505
 		if [[ $RESTORE_APP != 'usermonkeysphere' ]]; then
@@ -511,6 +523,15 @@ function restore_user_monkeysphere {
511 523
 				rm -rf /root/tempmonkeysphere
512 524
 			fi
513 525
 		fi
526
+
527
+		# The admin user is the identity certifier
528
+		MY_EMAIL_ADDRESS="${ADMIN_USERNAME}@${HOSTNAME}"
529
+		if grep -q "MY_EMAIL_ADDRESS" $CONFIG_FILE; then
530
+			MY_EMAIL_ADDRESS=$(grep "MY_EMAIL_ADDRESS" $CONFIG_FILE | awk -F '=' '{print $2}')
531
+		fi
532
+		MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$ADMIN_USERNAME" "$MY_EMAIL_ADDRESS")
533
+		fpr=$(gpg --with-colons --fingerprint $MY_GPG_PUBLIC_KEY_ID | grep fpr | head -n 1 | awk -F ':' '{print $10}')
534
+		monkeysphere-authentication add-identity-certifier $fpr
514 535
 		monkeysphere-authentication update-users
515 536
 	done
516 537
 }