zamba-lxc-toolbox/src/functions.sh

21 lines
562 B
Bash
Raw Normal View History

#!/bin/bash
#
# This script has basic functions like a random password generator
LXC_RANDOMPWD=32
random_password() {
set +o pipefail
2023-08-24 20:28:59 +02:00
LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom 2>/dev/null | head -c${LXC_RANDOMPWD}
2023-09-10 11:17:10 +02:00
}
generate_dhparam() {
openssl dhparam -out /etc/nginx/dhparam.pem 2048
2023-09-10 11:22:40 +02:00
cat << EOF > /etc/cron.monthly/generate-dhparams
2023-09-10 11:17:10 +02:00
#!/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
2023-09-10 11:22:40 +02:00
chmod +x /etc/cron.monthly/generate-dhparams
2023-09-10 11:17:10 +02:00
}