summaryrefslogtreecommitdiffstats
path: root/roles/common/files/usr/local/bin/gendhparam.sh
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2015-05-26 00:55:19 +0200
committerGuilhem Moulin <guilhem@fripost.org>2015-06-07 02:53:52 +0200
commit64e8603cf9790aa4419d0f2746671bd242e6344d (patch)
treea54c623bbe44f52c583bacf80848d3b9d4467abe /roles/common/files/usr/local/bin/gendhparam.sh
parent6b424a8f4155dea449b1dde746eae77bded63f7c (diff)
logjam mitigation.
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"