瀏覽代碼

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

Niklas Meyer 9 月之前
父節點
當前提交
52f3f93aee
共有 1 個文件被更改,包括 30 次插入0 次删除
  1. 30 0
      update.sh

+ 30 - 0
update.sh

@@ -275,6 +275,34 @@ detect_bad_asn() {
   fi
   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 ##############
 ############## End Function Section ##############
 
 
 # Check permissions
 # Check permissions
@@ -437,6 +465,8 @@ source mailcow.conf
 
 
 detect_docker_compose_command
 detect_docker_compose_command
 
 
+fix_broken_dnslist_conf
+
 DOTS=${MAILCOW_HOSTNAME//[^.]};
 DOTS=${MAILCOW_HOSTNAME//[^.]};
 if [ ${#DOTS} -lt 1 ]; then
 if [ ${#DOTS} -lt 1 ]; then
   echo -e "\e[31mMAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!\e[0m"
   echo -e "\e[31mMAILCOW_HOSTNAME (${MAILCOW_HOSTNAME}) is not a FQDN!\e[0m"