A hook to use the Spamhaus DQS service to avoid the error “open resolver”
First, create a DQS service account and create the /etc/postfix/dnsbl-reply-map file. Information here —> Configuring DQS on Postfix — Spamhaus Technology Documentation 2.0 documentation
Read this thread : Blocked using zen.spamhaus.org; Error: open resolver; - #22 by Gwylohm
Activate antispam :
yunohost settings set email.antispam.enable_blocklists -v yes
yunohost tools regen-conf postfix
Create a hook 20-postfix_spamhaus in /etc/yunohost/hooks.d/conf_regen/
modify PERSONALKEY by DQS Spamhaus key
#!/bin/bash
action=$1
pending_dir=$4
postfix_conf=$pending_dir/../postfix/etc/postfix/main.cf
[[ $action == "pre" ]] || exit 0
[[ -e $postfix_conf ]] || exit 0
sed -i '/smtpd_recipient_restrictions/a\ reject_rhsbl_sender PERSONALKEY.dbl.dq.spamhaus.net=127.0.1.[2..99],\
reject_rhsbl_helo PERSONALKEY.dbl.dq.spamhaus.net=127.0.1.[2..99],\
reject_rhsbl_reverse_client PERSONALKEY.dbl.dq.spamhaus.net=127.0.1.[2..99],\
reject_rhsbl_sender PERSONALKEY.zrd.dq.spamhaus.net=127.0.2.[2..24],\
reject_rhsbl_helo PERSONALKEY.zrd.dq.spamhaus.net=127.0.2.[2..24],\
reject_rhsbl_reverse_client PERSONALKEY.zrd.dq.spamhaus.net=127.0.2.[2..24],\
reject_rbl_client PERSONALKEY.zen.dq.spamhaus.net=127.0.0.[2..255],' $postfix_conf
sed -i '/zen.spamhaus.org/d' $postfix_conf
echo '
rbl_reply_maps = hash:/etc/postfix/dnsbl-reply-map' >> $postfix_conf
Activate the hook :
yunohost tools regen-conf postfix --force
Don’t forget to postmap /etc/postfix/dnsbl-reply-map (see spamhaus doc) and reload the postfix service.
Thanks to @Gwylohm for this solution. ![]()
Edit : Modify smtpd_client _restrictions with smtpd_recipient_restrictions —> Postfix SMTP server: errors from smtp.ladirection.cloud[80.64.218.141] - #28 by Jean31