From 5802c2c04337f0f04d629f25a37547df5bec11a6 Mon Sep 17 00:00:00 2001 From: thorstenspille Date: Sun, 10 Sep 2023 11:17:10 +0200 Subject: [PATCH] Add dhparam generation function --- src/functions.sh | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/functions.sh b/src/functions.sh index 50356f1..f5eb4b4 100644 --- a/src/functions.sh +++ b/src/functions.sh @@ -6,4 +6,15 @@ LXC_RANDOMPWD=32 random_password() { set +o pipefail LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom 2>/dev/null | head -c${LXC_RANDOMPWD} -} \ No newline at end of file +} + +generate_dhparam() { + openssl dhparam -out /etc/nginx/dhparam.pem 2048 + cat << EOF > /etc/cron.weekly/generate-dhparams +#!/bin/bash +openssl dhparam -out /etc/nginx/dhparam.gen 4096 > /dev/null 2>&1 +mv /etc/nginx/dhparam.gen /etc/nginx/dhparam.pem +systemctl restart nginx +EOF + chmod +x /etc/cron.weekly/generate-dhparams +}