Skip to content

Instantly share code, notes, and snippets.

@tuxlife
Created April 1, 2016 10:26
Show Gist options
  • Save tuxlife/1f1a3ab8213c824e366ea2df060a9295 to your computer and use it in GitHub Desktop.
Save tuxlife/1f1a3ab8213c824e366ea2df060a9295 to your computer and use it in GitHub Desktop.
GPG Setup
# Usage:
# $ . setup.sh /mnt/foobar
# additional informations/ideas
# https://blog.josefsson.org/2014/06/23/offline-gnupg-master-key-and-subkeys-on-yubikey-neo-smartcard/
# https://www.esev.com/blog/post/2015-01-pgp-ssh-key-on-yubikey-neo/
if ping -c 1 8.8.8.8; then
echo nameserver 8.8.8.8 >> /etc/resolv.conf
apt-get update
apt-get install -y gnupg2 haveged paperkey opensc pcscd scdaemon libccid pinentry-curses
fi
if [ -z "$1" ]; then
GNUPGHOME=$(pwd)/gnupghome-$(date +'%Y%m%d')
else
GNUPGHOME=$1
fi
export GNUPGHOME
mkdir -vp $GNUPGHOME
chmod 700 $GNUPGHOME
cat > $GNUPGHOME/gpg.conf << !
no-emit-version
no-comments
keyid-format 0xlong
with-fingerprint
use-agent
lock-never
personal-cipher-preferences AES256 AES192 AES CAST5
personal-digest-preferences SHA512 SHA384 SHA256 SHA224
cert-digest-algo SHA512
default-preference-list SHA512 SHA384 SHA256 SHA224 AES256 AES192 AES CAMELLIA256 CAMELLIA192 CAMELLIA128 TWOFISH CAST5 ZLIB BZIP2 ZIP Uncompressed
!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment