Importing trust

This commit is contained in:
Bob Mottram 2014-10-02 15:46:19 +01:00
parent 09bb9a3c7f
commit f46cc04d36
1 changed files with 4 additions and 0 deletions

View File

@ -319,11 +319,15 @@ function create_backup_script {
# This is a compromise. backup needs access to things which the user # This is a compromise. backup needs access to things which the user
# doesn't have access to, but also needs to be able to encrypt as the user # doesn't have access to, but also needs to be able to encrypt as the user
# Perhaps there is some better way to do this. # Perhaps there is some better way to do this.
# Maybe there should be a separate backup GPG key. Discuss.
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 $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
fi fi
echo '#!/bin/bash' > /usr/bin/$BACKUP_SCRIPT_NAME echo '#!/bin/bash' > /usr/bin/$BACKUP_SCRIPT_NAME