gpg key generation

This commit is contained in:
Bob Mottram 2017-06-01 17:43:09 +01:00
parent bd33b8145c
commit f0692f51fe
3 changed files with 4 additions and 4 deletions

View File

@ -144,7 +144,7 @@ echo "Name-Real: $ADD_USERNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
echo "Name-Email: $ADD_USERNAME@$HOSTNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf echo "Name-Email: $ADD_USERNAME@$HOSTNAME" >> /home/$ADD_USERNAME/gpg-genkey.conf
echo 'Expire-Date: 0' >> /home/$ADD_USERNAME/gpg-genkey.conf echo 'Expire-Date: 0' >> /home/$ADD_USERNAME/gpg-genkey.conf
chown $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/gpg-genkey.conf chown $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/gpg-genkey.conf
su -m root -c "gpg --homedir /home/$ADD_USERNAME/.gnupg --batch --passphrase '' --gen-key /home/$ADD_USERNAME/gpg-genkey.conf" - $ADD_USERNAME su -m root -c "gpg --homedir /home/$ADD_USERNAME/.gnupg --batch --passphrase '' --full-gen-key /home/$ADD_USERNAME/gpg-genkey.conf" - $ADD_USERNAME
chown -R $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/.gnupg chown -R $ADD_USERNAME:$ADD_USERNAME /home/$ADD_USERNAME/.gnupg
shred -zu /home/$ADD_USERNAME/gpg-genkey.conf shred -zu /home/$ADD_USERNAME/gpg-genkey.conf
MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$ADD_USERNAME" "$ADD_USERNAME@$HOSTNAME") MY_GPG_PUBLIC_KEY_ID=$(gpg_pubkey_from_email "$ADD_USERNAME" "$ADD_USERNAME@$HOSTNAME")

View File

@ -1499,7 +1499,7 @@ function create_gpg_subkey {
echo "Name-Comment: $GPG_KEY_USAGE" >> /home/$MY_USERNAME/gpg-genkey.conf echo "Name-Comment: $GPG_KEY_USAGE" >> /home/$MY_USERNAME/gpg-genkey.conf
echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
su -m root -c "gpg --homedir /home/$MY_USERNAME/.gnupg --batch --passphrase '' --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME su -m root -c "gpg --homedir /home/$MY_USERNAME/.gnupg --batch --passphrase '' --full-gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
shred -zu /home/$MY_USERNAME/gpg-genkey.conf shred -zu /home/$MY_USERNAME/gpg-genkey.conf
@ -1614,7 +1614,7 @@ function configure_gpg {
echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
echo $'Generating a new GPG key' echo $'Generating a new GPG key'
su -m root -c "gpg --homedir /home/$MY_USERNAME/.gnupg --batch --passphrase '' --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME su -m root -c "gpg --homedir /home/$MY_USERNAME/.gnupg --batch --passphrase '' --full-gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
KEY_EXISTS=$(gpg_key_exists "$MY_USERNAME" "$MY_EMAIL_ADDRESS") KEY_EXISTS=$(gpg_key_exists "$MY_USERNAME" "$MY_EMAIL_ADDRESS")
if [[ $KEY_EXISTS == "no" ]]; then if [[ $KEY_EXISTS == "no" ]]; then

View File

@ -72,7 +72,7 @@ function configure_backup_key {
echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf
echo $'Backup key does not exist. Creating it.' echo $'Backup key does not exist. Creating it.'
su -m root -c "gpg --homedir /home/$MY_USERNAME/.gnupg --batch --passphrase '' --gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME su -m root -c "gpg --homedir /home/$MY_USERNAME/.gnupg --batch --passphrase '' --full-gen-key /home/$MY_USERNAME/gpg-genkey.conf" - $MY_USERNAME
chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg chown -R $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/.gnupg
shred -zu /home/$MY_USERNAME/gpg-genkey.conf shred -zu /home/$MY_USERNAME/gpg-genkey.conf