gpg key generation

This commit is contained in:
Bob Mottram 2014-09-23 16:10:46 +01:00
parent bcf920ee6d
commit 245a43c40c
1 changed files with 91 additions and 88 deletions

View File

@ -866,19 +866,22 @@ function configure_gpg {
shred -zu $MY_GPG_PRIVATE_KEY shred -zu $MY_GPG_PRIVATE_KEY
else else
# Generate a GPG key # Generate a GPG key
echo "%echo Generating a GPG key for `hostname --fqdn`" > /home/$MY_USERNAME/gpg-genkey.conf umask 0277
echo 'Key-Type: RSA' >> /home/$MY_USERNAME/gpg-genkey.conf cat << EOF > /tmp/$MY_USERNAME-gpg-genkey.conf
echo 'Key-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf %echo Generating a GPG key
echo 'Subkey-Type: ELG-E' >> /home/$MY_USERNAME/gpg-genkey.conf Key-Type: RSA
echo 'Subkey-Length: 4096' >> /home/$MY_USERNAME/gpg-genkey.conf Key-Length: 4096
echo 'Name-Real: `hostname --fqdn`' >> /home/$MY_USERNAME/gpg-genkey.conf Subkey-Type: ELG-E
echo "Name-Email: $MY_USERNAME@$DOMAIN_NAME" >> /home/$MY_USERNAME/gpg-genkey.conf Subkey-Length: 4096
echo 'Expire-Date: 0' >> /home/$MY_USERNAME/gpg-genkey.conf Name-Real: `hostname --fqdn`
echo '%commit' >> /home/$MY_USERNAME/gpg-genkey.conf Name-Email: $MY_USERNAME@`hostname --fqdn`
echo '%echo Done' >> /home/$MY_USERNAME/gpg-genkey.conf Expire-Date: 0
chown $MY_USERNAME:$MY_USERNAME /home/$MY_USERNAME/gpg-genkey.conf %commit
su - $MY_USERNAME gpg --batch --gen-key /home/$MY_USERNAME/gpg-genkey.conf %echo Done
shred -zu /home/$MY_USERNAME/gpg-genkey.conf EOF
umask 0002
su $MY_USERNAME gpg --batch --gen-key /tmp/$MY_USERNAME-gpg-genkey.conf > gpg-keygen.log 2> gpg-keygen_error.log
shred -zu /tmp/$MY_USERNAME-gpg-genkey.conf
fi fi
echo 'configure_gpg' >> $COMPLETION_FILE echo 'configure_gpg' >> $COMPLETION_FILE