summaryrefslogtreecommitdiffstats
path: root/roles/common/files/usr/local/bin/gendhparam.sh
blob: 074986b73b6258c3f7e7c90511bb43f738cd9cbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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"