aboutsummaryrefslogtreecommitdiffstats
path: root/modules/gnupg/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gnupg/templates')
-rw-r--r--modules/gnupg/templates/batch12
-rw-r--r--modules/gnupg/templates/create_gnupg_keys.sh13
2 files changed, 25 insertions, 0 deletions
diff --git a/modules/gnupg/templates/batch b/modules/gnupg/templates/batch
new file mode 100644
index 00000000..05ffe095
--- /dev/null
+++ b/modules/gnupg/templates/batch
@@ -0,0 +1,12 @@
+%echo Generating a standard key
+Key-Type: <%= key_type %>
+Key-Length: <%= key_length %>
+Name-Real: <%= key_name %>
+Name-Comment: Key made by puppet on <%= fqdn %>
+Name-Email: <%= email %>
+Expire-Date: <%= expire_date %>
+%pubring <%= name %>.pub
+%secring <%= name %>.sec
+%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..fbb41277
--- /dev/null
+++ b/modules/gnupg/templates/create_gnupg_keys.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+NAME=$1
+
+/sbin/rngd -f -r /dev/urandom &
+RAND=$!
+cd /etc/gnupg/keys/
+gpg --homedir /etc/gnupg/keys/ --batch --gen-key /etc/gnupg/batches/$NAME.batch
+EXIT=$?
+
+kill $RAND
+
+exit $EXIT