Restore monkeysphere identifier

This commit is contained in:
Bob Mottram 2016-04-29 23:41:52 +01:00
parent 191b624871
commit d8d95b40aa
3 changed files with 1049 additions and 1003 deletions

View File

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

File diff suppressed because it is too large Load Diff

View File

@ -488,6 +488,18 @@ function restore_user_config {
done
}
function gpg_pubkey_from_email {
key_owner_username=$1
key_email_address=$2
key_id=
if [[ $key_owner_username != "root" ]]; then
key_id=$(su -c "gpg --list-keys $key_email_address | grep 'pub '" - $key_owner_username | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
else
key_id=$(gpg --list-keys $key_email_address | grep 'pub ' | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
fi
echo $key_id
}
function restore_user_monkeysphere {
if [[ $RESTORE_APP != 'all' ]]; then
if [[ $RESTORE_APP != 'usermonkeysphere' ]]; then
@ -511,6 +523,15 @@ function restore_user_monkeysphere {
rm -rf /root/tempmonkeysphere
fi
fi
# The admin user is the identity certifier
MY_EMAIL_ADDRESS="${ADMIN_USERNAME}@${HOSTNAME}"
if grep -q "MY_EMAIL_ADDRESS" $CONFIG_FILE; then
MY_EMAIL_ADDRESS=$(grep "MY_EMAIL_ADDRESS" $CONFIG_FILE | awk -F '=' '{print $2}')
fi
MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$ADMIN_USERNAME" "$MY_EMAIL_ADDRESS")
fpr=$(gpg --with-colons --fingerprint $MY_GPG_PUBLIC_KEY_ID | grep fpr | head -n 1 | awk -F ':' '{print $10}')
monkeysphere-authentication add-identity-certifier $fpr
monkeysphere-authentication update-users
done
}