From b050cb9864c09bb78d747c4e0243f2ba4c144b43 Mon Sep 17 00:00:00 2001 From: FreddleSpl0it Date: Thu, 3 Aug 2023 09:00:08 +0200 Subject: [PATCH] [Postfix] remove dnsbl_reply.map if not required --- .gitignore | 1 + data/Dockerfiles/postfix/postfix.sh | 9 ++++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 0169c439..3595ecb1 100644 --- a/.gitignore +++ b/.gitignore @@ -37,6 +37,7 @@ data/conf/postfix/sni.map data/conf/postfix/sni.map.db data/conf/postfix/sql data/conf/postfix/dns_blocklists.cf +data/conf/postfix/dnsbl_reply.map data/conf/rspamd/custom/* data/conf/rspamd/local.d/* data/conf/rspamd/override.d/* diff --git a/data/Dockerfiles/postfix/postfix.sh b/data/Dockerfiles/postfix/postfix.sh index ba87aaa2..f981bff6 100755 --- a/data/Dockerfiles/postfix/postfix.sh +++ b/data/Dockerfiles/postfix/postfix.sh @@ -435,10 +435,10 @@ if [ ! -z "$DNSBL_CONFIG" ]; then ${SPAMHAUS_DQS_KEY}.zen.dq.spamhaus.net=127.0.0.[10;11]*8 ${SPAMHAUS_DQS_KEY}.zen.dq.spamhaus.net=127.0.0.3*4 ${SPAMHAUS_DQS_KEY}.zen.dq.spamhaus.net=127.0.0.2*3 -postscreen_dnsbl_reply_map = texthash:/opt/postfix/conf/dnsbl_reply +postscreen_dnsbl_reply_map = texthash:/opt/postfix/conf/dnsbl_reply.map EOF - cat < /opt/postfix/conf/dnsbl_reply + cat < /opt/postfix/conf/dnsbl_reply.map # Autogenerated by mailcow, using Spamhaus DQS reply domains ${SPAMHAUS_DQS_KEY}.sbl.dq.spamhaus.net sbl.spamhaus.org ${SPAMHAUS_DQS_KEY}.xbl.dq.spamhaus.net xbl.spamhaus.org @@ -449,6 +449,9 @@ ${SPAMHAUS_DQS_KEY}.zrd.dq.spamhaus.net zrd.spamhaus.org EOF ) else + if [ -f "/opt/postfix/conf/dnsbl_reply.map" ]; then + rm /opt/postfix/conf/dnsbl_reply.map + fi response=$(curl --connect-timeout 15 --max-time 30 -s -o /dev/null -w "%{http_code}" "https://asn-check.mailcow.email") if [ "$response" -eq 503 ]; then echo -e "\e[31mThe AS of your IP is listed as a banned AS from Spamhaus!\e[0m" @@ -519,4 +522,4 @@ if [[ $? != 0 ]]; then else postfix -c /opt/postfix/conf start sleep 126144000 -fi \ No newline at end of file +fi