GNU Privacy Guard: Difference between revisions
From Leo's Notes
This page was last edited on 23 November 2015, at 05:14.
m Leo moved page GPG to GNU Privacy Guard: Use the full name instead |
generating a new key |
||
| Line 1: | Line 1: | ||
GNU Privacy Guard (GPG) is a open source replacement for the | GNU Privacy Guard (GPG or GnuPG) is a open source replacement for the original Pretty Good Privacy software suite. It is capable of encrypt and decrypt data. | ||
== Creating a New Key == | |||
To generate a new key, run {{code| gpg --gen-key}} | |||
{{highlight|lang=text|code= | |||
# gpg --gen-key | |||
gpg (GnuPG) 1.4.19; Copyright (C) 2015 Free Software Foundation, Inc. | |||
This is free software: you are free to change and redistribute it. | |||
There is NO WARRANTY, to the extent permitted by law. | |||
Please select what kind of key you want: | |||
(1) RSA and RSA (default) | |||
(2) DSA and Elgamal | |||
(3) DSA (sign only) | |||
(4) RSA (sign only) | |||
}} | |||
== Changing Private Key Passphrase == | == Changing Private Key Passphrase == | ||
Revision as of 05:14, 23 November 2015
GNU Privacy Guard (GPG or GnuPG) is a open source replacement for the original Pretty Good Privacy software suite. It is capable of encrypt and decrypt data.
Creating a New Key
To generate a new key, run gpg --gen-key
# gpg --gen-key
gpg (GnuPG) 1.4.19; Copyright (C) 2015 Free Software Foundation, Inc.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Please select what kind of key you want:
(1) RSA and RSA (default)
(2) DSA and Elgamal
(3) DSA (sign only)
(4) RSA (sign only)
Changing Private Key Passphrase
$ gpg --edit-key [keyID]
Command> passwd
Enter passphrase:
Enter the new passphrase for this secret key.
Enter passphrase:
Repeat passphrase:
Command> save
Exporting Public Key
gpg --armor --export leo@steamr.com --output leo.steamr.pub
Automating Encrypted Backups using Asymmetric Keys
#!/bin/sh HOSTNAME=`hostname` DATE=`date +%Y-%m-%d` # Get the public key to encrypt with wget -O - http://leo.home.steamr.com/public/backup_key.pub | gpg --import # Create archive, pipe to gpg to encrypt, then send to freebsd tar -czpf - \ /usr/share/sickbeard/ \ /etc/init.d/sickbeard \ \ /usr/share/SABnzbd/ \ /etc/init.d/SABnzbd \ \ /home/rt \ /var/www/html/rutorrent \ /usr/lib64/httpd/modules/mod_scgi.so \ /etc/httpd/conf.d \ /etc/httpd/conf/httpd.conf \ \ /etc/fstab \ /etc/passwd \ /etc/group \ /etc/shadow \ | gpg --encrypt --yes --no-tty --trust-model always --recipient leo@steamr.com \ | ssh backup@freebsd "cd /storage/backups/archived/sickbeard; cat - > $HOSTNAME.$DATE.tar.gz.gpg" # Requires mailx, with smtp=smtp://mail.home.steamr.com set in /etc/mail.rc echo -e "Backup Completed on `date`.\nUptime: `uptime`\n\nProcesses:\n`ps -eaf`" | mail -s "Backup Completed on `hostname`" "leo@home.steamr.com" # delete the public backup key gpg --batch --yes --delete-key leo@steamr.com