summaryrefslogtreecommitdiffstats
path: root/roles/common/files/usr/local/bin/gendhparam.sh
diff options
context:
space:
mode:
Diffstat (limited to 'roles/common/files/usr/local/bin/gendhparam.sh')
-rwxr-xr-xroles/common/files/usr/local/bin/gendhparam.sh13
1 files changed, 13 insertions, 0 deletions
diff --git a/roles/common/files/usr/local/bin/gendhparam.sh b/roles/common/files/usr/local/bin/gendhparam.sh
new file mode 100755
index 0000000..074986b
--- /dev/null
+++ b/roles/common/files/usr/local/bin/gendhparam.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -ue
+PATH=/usr/bin:/bin
+
+privkey="$1"
+bits="${2:-2048}"
+rand=
+
+mv -f "$(mktemp)" "$privkey"
+chmod og-rwx "$privkey"
+
+openssl dhparam -rand "${rand:-/dev/urandom}" "$bits" >"$privkey"