install_update_dovecot.sh: creating DH parameter changes if debian version is 12 or above.

This commit is contained in:
Christoph 2023-12-08 18:53:30 +01:00
parent e48b35bdd1
commit 1f05685af9

View File

@ -115,6 +115,35 @@ echo_skipped() {
echo -e "\033[71G[ \033[33m\033[1mskipped\033[m ]"
}
detect_os_1 () {
if $(which lsb_release > /dev/null 2>&1) ; then
os_dist="$(lsb_release -i | awk '{print tolower($3)}')"
os_version="$(lsb_release -r | awk '{print tolower($2)}')"
os_codename="$(lsb_release -c | awk '{print tolower($2)}')"
if [[ "$os_dist" = "debian" ]]; then
if $(echo "$os_version" | grep -q '\.') ; then
os_version=$(echo "$os_version" | cut --delimiter='.' -f1)
fi
fi
elif [[ -e "/etc/os-release" ]]; then
. /etc/os-release
os_dist=$ID
os_version=${VERSION_ID}
fi
# remove whitespace from os_dist and os_version
os_dist="${os_dist// /}"
os_version="${os_version// /}"
}
# - Support systemd ?
@ -134,6 +163,14 @@ else
fi
# - Detect OS - Set variable
# - os_dist
# - os_version
# - os_codename
# -
detect_os_1
echo
echononl "\tInclude Configuration file.."
if [[ ! -f $conf_file ]]; then
@ -1597,7 +1634,11 @@ if [[ $dovecot_major_version -ge 3 ]] \
if [[ ! -f "$dh_pem_file" ]] ; then
echononl "\tCreate SSL DH parameters '$dh_pem_file'.."
echo -en "$rc_wait"
openssl dhparam -dsaparam -out "$dh_pem_file" 4096 > /dev/null 2>&1
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] ; then
openssl dhparam -out "$dh_pem_file" 4096 > /dev/null 2>&1
else
openssl dhparam -dsaparam -out "$dh_pem_file" 4096 > /dev/null 2>&1
fi
if [[ $? -eq 0 ]]; then
echo -e "$rc_done"
else
@ -4393,6 +4434,16 @@ if [[ -x "/root/bin/monitoring/check_cert_for_dovecot.sh" ]] ; then
else
echo -e "$rc_failed"
error "$(cat "$log_file")"
echononl "\tcontinue anyway [yes/no]: "
read OK
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
echononl "Wrong entry! - repeat [yes/no]: "
read OK
done
[[ $OK = "yes" ]] || fatal "Abbruch durch User"
fi
else
echo -e "$rc_skipped"