Skip to content

Commit

Permalink
update.sh: precaution ask for deletion of dns_blocklists.cf if old fo…
Browse files Browse the repository at this point in the history
…rmat (#6154)
  • Loading branch information
DerLinkman authored Nov 11, 2024
1 parent be79f32 commit 52f3f93
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 52f3f93

Please sign in to comment.