diff options
Diffstat (limited to 'modules/gnupg/templates')
| -rw-r--r-- | modules/gnupg/templates/batch | 8 | ||||
| -rw-r--r-- | modules/gnupg/templates/create_gnupg_keys.sh | 26 |
2 files changed, 34 insertions, 0 deletions
diff --git a/modules/gnupg/templates/batch b/modules/gnupg/templates/batch new file mode 100644 index 00000000..d55bdd52 --- /dev/null +++ b/modules/gnupg/templates/batch @@ -0,0 +1,8 @@ +%echo Generating a standard key +Key-Type: <%= @key_type %> +Key-Length: <%= @key_length %> +Name-Real: <%= @key_name %> +Name-Email: <%= @email %> +Expire-Date: <%= @expire_date %> +%commit +%echo done diff --git a/modules/gnupg/templates/create_gnupg_keys.sh b/modules/gnupg/templates/create_gnupg_keys.sh new file mode 100644 index 00000000..a2caba2d --- /dev/null +++ b/modules/gnupg/templates/create_gnupg_keys.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +BATCHFILE="$1" +HOMEDIR="$2" +LOCK="$3" + +test $# -eq 3 || exit 1 + +if [ -e "$LOCK" ] +then + echo "Lock file already exist." 1>&2 + echo "Remove $LOCK if you want to regenerate key." 1>&2 + exit 2 +fi + +touch "$LOCK" + +/sbin/rngd -f -r /dev/urandom & +RAND=$! +cd $HOMEDIR +gpg --homedir $HOMEDIR --batch --gen-key $BATCHFILE +EXIT=$? + +kill $RAND + +exit $EXIT |
