Skip to content

Instantly share code, notes, and snippets.

@CajuCLC
Forked from vrillusions/README.mkd
Created May 29, 2019 23:22
Show Gist options
  • Save CajuCLC/857e729b097f1425c07b09fceddd0d0b to your computer and use it in GitHub Desktop.
Save CajuCLC/857e729b097f1425c07b09fceddd0d0b to your computer and use it in GitHub Desktop.
Generate gpg key via batch file

Introduction

This is how to create a gpg key without any user interaction or password. This can be used in cases where the primary goal is to secure the data in transit but the gpg key can/must be stored locally without a password. An example of this is the hiera-gpg plugin which doesn't support passwords.

The below genkey-batch file will use the default which currently are RSA/RSA and 2048 bit length. See the reference link to set this to something else.

References

%no-protection
Key-Type: default
Subkey-Type: default
Name-Real: YOUR NAME
Name-Email: YOUR EMAIL@example.com
Expire-Date: 0
gpg --batch --gen-key genkey-batch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment