This commit is contained in:
Bob Mottram 2014-10-05 10:31:00 +01:00
parent bc95631cf5
commit b09125a786
1 changed files with 12 additions and 12 deletions

View File

@ -428,18 +428,18 @@ function import_gpg_key_to_root {
cp -r /home/$MY_USERNAME/.gnupg /root cp -r /home/$MY_USERNAME/.gnupg /root
# get the first entry, which we assume to be the imported key # get the first entry, which we assume to be the imported key
MY_GPG_PUBLIC_KEY_ID=$(gpg --list-keys | grep "pub " | head -n 1 | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}') MY_GPG_PUBLIC_KEY_ID=$(gpg --list-keys | grep "pub " | head -n 1 | awk -F ' ' '{print $2}' | awk -F '/' '{print $2}')
fi else
# make sure that the root user has access to your gpg public key
# make sure that the root user has access to your gpg public key if [ $MY_GPG_PUBLIC_KEY_ID ]; then
if [ $MY_GPG_PUBLIC_KEY_ID ]; then su -c "gpg --export-ownertrust > ~/temp_trust.txt" - $MY_USERNAME
su -c "gpg --export-ownertrust > ~/temp_trust.txt" - $MY_USERNAME su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
su -c "gpg --output $MY_GPG_PUBLIC_KEY --armor --export $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME su -c "gpg --output ~/temp_private_key.txt --armor --export-secret-key $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME
su -c "gpg --output ~/temp_private_key.txt --armor --export-secret-key $MY_GPG_PUBLIC_KEY_ID" - $MY_USERNAME gpg --import-ownertrust < /home/$MY_USERNAME/temp_trust.txt
gpg --import-ownertrust < /home/$MY_USERNAME/temp_trust.txt gpg --import $MY_GPG_PUBLIC_KEY
gpg --import $MY_GPG_PUBLIC_KEY gpg --allow-secret-key-import --import /home/$MY_USERNAME/temp_private_key.txt
gpg --allow-secret-key-import --import /home/$MY_USERNAME/temp_private_key.txt shred -zu /home/$MY_USERNAME/temp_private_key.txt
shred -zu /home/$MY_USERNAME/temp_private_key.txt shred -zu /home/$MY_USERNAME/temp_trust.txt
shred -zu /home/$MY_USERNAME/temp_trust.txt fi
fi fi
} }