update_postfix_dh_parameters.sh: change function dectec_os to dectect_os_1.
This commit is contained in:
parent
ccc527abc2
commit
b717e88130
@ -84,18 +84,17 @@ blank_line() {
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
detect_os () {
|
||||
detect_os_1 () {
|
||||
|
||||
if $(which lsb_release > /dev/null 2>&1) ; then
|
||||
|
||||
DIST="$(lsb_release -i | awk '{print tolower($3)}')"
|
||||
DIST_VERSION="$(lsb_release -r | awk '{print tolower($2)}')"
|
||||
DIST_CODENAME="$(lsb_release -c | awk '{print tolower($2)}')"
|
||||
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 [[ "$DIST" = "debian" ]]; then
|
||||
if $(echo "$DIST_VERSION" | grep -q '\.') ; then
|
||||
DIST_VERSION=$(echo "$DIST_VERSION" | cut --delimiter='.' -f1)
|
||||
if [[ "$os_dist" = "debian" ]]; then
|
||||
if $(echo "$os_version" | grep -q '\.') ; then
|
||||
os_version=$(echo "$os_version" | cut --delimiter='.' -f1)
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -103,14 +102,14 @@ detect_os () {
|
||||
|
||||
. /etc/os-release
|
||||
|
||||
DIST=$ID
|
||||
DIST_VERSION=${VERSION_ID}
|
||||
os_dist=$ID
|
||||
os_version=${VERSION_ID}
|
||||
|
||||
fi
|
||||
|
||||
# remove whitespace from DIST and DIST_VERSION
|
||||
DIST="${DIST// /}"
|
||||
DIST_VERSION="${DIST_VERSION// /}"
|
||||
# remove whitespace from os_dist and os_version
|
||||
os_dist="${os_dist// /}"
|
||||
os_version="${os_version// /}"
|
||||
|
||||
}
|
||||
|
||||
@ -157,7 +156,7 @@ fi
|
||||
|
||||
blank_line
|
||||
echononl "Detect distribution/release of running OS.."
|
||||
detect_os > /dev/null 2>&1
|
||||
detect_os_1 > /dev/null 2>&1
|
||||
if [[ $? -ne 0 ]]; then
|
||||
echo_failed
|
||||
else
|
||||
@ -179,7 +178,7 @@ fi
|
||||
## -
|
||||
echononl " Generate DH key length=512 \"/etc/postfix/ssl/dh_512.pem\""
|
||||
if [[ ! -f /etc/postfix/ssl/dh_512.pem ]]; then
|
||||
if [[ $DIST_VERSION -gt 11 ]] ; then
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] ; then
|
||||
openssl dhparam -out /etc/postfix/ssl/dh_512.pem 512 > /dev/null 2>&1
|
||||
else
|
||||
openssl dhparam -dsaparam -out /etc/postfix/ssl/dh_512.pem 512 > /dev/null 2>&1
|
||||
@ -190,7 +189,7 @@ if [[ ! -f /etc/postfix/ssl/dh_512.pem ]]; then
|
||||
echo_failed
|
||||
fi
|
||||
else
|
||||
if [[ $DIST_VERSION -gt 11 ]] ; then
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] ; then
|
||||
if $(grep -q -E "X9.42" /etc/postfix/ssl/dh_512.pem 2> /dev/null); then
|
||||
openssl dhparam -out /etc/postfix/ssl/dh_512.pem 512 > /dev/null 2>&1
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
@ -207,7 +206,7 @@ else
|
||||
fi
|
||||
echononl " Generate DH key length=1024 \"/etc/postfix/ssl/dh_1024.pem\""
|
||||
if [[ ! -f /etc/postfix/ssl/dh_1024.pem ]]; then
|
||||
if [[ $DIST_VERSION -gt 11 ]] ; then
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] ; then
|
||||
openssl dhparam -out /etc/postfix/ssl/dh_1024.pem 1024 > /dev/null 2>&1
|
||||
else
|
||||
openssl dhparam -dsaparam -out /etc/postfix/ssl/dh_1024.pem 1024 > /dev/null 2>&1
|
||||
@ -218,7 +217,7 @@ if [[ ! -f /etc/postfix/ssl/dh_1024.pem ]]; then
|
||||
echo_failed
|
||||
fi
|
||||
else
|
||||
if [[ $DIST_VERSION -gt 11 ]] ; then
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] ; then
|
||||
if $(grep -q -E "X9.42" /etc/postfix/ssl/dh_1024.pem 2> /dev/null); then
|
||||
openssl dhparam -out /etc/postfix/ssl/dh_1024.pem 1024 > /dev/null 2>&1
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
@ -235,7 +234,7 @@ else
|
||||
fi
|
||||
echononl " Generate DH key length=2048 \"/etc/postfix/ssl/dh_2048.pem\""
|
||||
if [[ ! -f /etc/postfix/ssl/dh_2048.pem ]]; then
|
||||
if [[ $DIST_VERSION -gt 11 ]] ; then
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] ; then
|
||||
openssl dhparam -out /etc/postfix/ssl/dh_2048.pem 2048 > /dev/null 2>&1
|
||||
else
|
||||
openssl dhparam -dsaparam -out /etc/postfix/ssl/dh_2048.pem 2048 > /dev/null 2>&1
|
||||
@ -246,7 +245,7 @@ if [[ ! -f /etc/postfix/ssl/dh_2048.pem ]]; then
|
||||
echo_failed
|
||||
fi
|
||||
else
|
||||
if [[ $DIST_VERSION -gt 11 ]] ; then
|
||||
if [[ "$os_dist" = "debian" ]] && [[ $os_version -gt 11 ]] ; then
|
||||
if $(grep -q -E "X9.42" /etc/postfix/ssl/dh_2048.pem 2> /dev/null); then
|
||||
openssl dhparam -out /etc/postfix/ssl/dh_2048.pem 2048 > /dev/null 2>&1
|
||||
if [[ $? -eq 0 ]] ; then
|
||||
|
Loading…
Reference in New Issue
Block a user