1
0
mirror of https://github.com/mailcow/mailcow-dockerized.git synced 2025-01-02 03:38:23 +02:00

update.sh: precaution ask for deletion of dns_blocklists.cf if old format (#6154)

This commit is contained in:
Niklas Meyer 2024-11-11 16:50:14 +01:00 committed by GitHub
parent be79f320d2
commit 52f3f93aee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -275,6 +275,34 @@ detect_bad_asn() {
fi
}
fix_broken_dnslist_conf() {
# Fixing issue: #6143. To be removed in a later patch
local file="${SCRIPT_DIR}/data/conf/postfix/dns_blocklists.cf"
# Check if the file exists
if [[ ! -f "$file" ]]; then
return 1
fi
# Check if the file contains the autogenerated comment
if grep -q "# Autogenerated by mailcow" "$file"; then
# Ask the user if custom changes were made
echo -e "\e[91mWARNING!!! \e[31mAn old version of dns_blocklists.cnf has been detected which may cause a broken postfix upon startup (see: https://github.com/mailcow/mailcow-dockerized/issues/6143)...\e[0m"
echo -e "\e[31mIf you have any custom settings in there you might copy it away and adapt the changes after the file is regenerated...\e[0m"
read -p "Do you want to delete the file now and let mailcow regenerate it properly? " response
if [[ "${response}" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
rm "$file"
echo -e "\e[32mdns_blocklists.cf has been deleted and will be properly regenerated"
return 0
else
echo -e "\e[35mOk, not deleting it! Please make sure you take a look at postfix upon start then..."
return 2
fi
fi
}
############## End Function Section ##############
# Check permissions
@ -437,6 +465,8 @@ source mailcow.conf
detect_docker_compose_command
fix_broken_dnslist_conf
DOTS=${MAILCOW_HOSTNAME//[^.]};
if [ ${#DOTS} -lt 1 ]; then
echo -e "\e[31mMAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!\e[0m"