Hi, I'm currently fine-tuning my mail server (Postfix and Dovecot on CentOS 7). SPF, DKIM and DMARC work fine, now I'd like to limit the spam tsunami. Besides the official Postfix documentation, I've read a few articles about Postfix spam restrictions, namely these : https://www.linuxbabe.com/mail-server/block-email-spam-postfix https://wiki.centos.org/HowTos/postfix_restrictions After some experimenting, here's what I currently have on my test server: --8<----- /etc/postfix/main.cf ----------------------------- ... smtpd_helo_required = yes smtpd_helo_restrictions permit_mynetworks, permit_sasl_authenticated, check_helo_access hash:/etc/postfix/helo_access reject_invalid_helo_hostname, reject_non_fqdn_helo_hostname, reject_unknown_helo_hostname smtpd_sender_restrictions permit_mynetworks, permit_sasl_authenticated, check_sender_access hash:/etc/postfix/sender_access, reject_unknown_sender_domain, reject_unknown_reverse_client_hostname, reject_unknown_client_hostname smtpd_recipient_restrictions permit_mynetworks, permit_sasl_authenticated, check_client_access hash:/etc/postfix/rbl_override, reject_rhsbl_helo dbl.spamhaus.org, reject_rhsbl_reverse_client dbl.spamhaus.org, reject_rhsbl_sender dbl.spamhaus.org, reject_rbl_client zen.spamhaus.org --8<-------------------------------------------------------- Before committing this configuration to my main server, I thought I'd share this configuration on the list. Maybe the Postfix gurus among you have the odd comment to make. My aim is simply to eliminate as much spam as possible (that is, before adding SpamAssassin) while keeping false positives to a minimum. Any suggestions ? Niki -- Microlinux - Solutions informatiques durables 7, place de l'?glise - 30730 Montpezat Site : https://www.microlinux.fr Mail : info at microlinux.fr T?l. : 04 66 63 10 32 Mob. : 06 51 80 12 12
On Sun, Jun 7, 2020, 2:47 AM Nicolas Kovacs <info at microlinux.fr> wrote:> .... > My aim is simply to eliminate as much spam as possible (that is, before > adding > SpamAssassin) while keeping false positives to a minimum. >The one thing that stopped the most spam on my last mailserver was greylisting. Any mta that connects to you to send you mail, you check against a white list, and if they are not on it, you reject the connection with a 'try again later' code and add them to a grey list that will let them in after 10 minutes or so. The vast majority of spambots don't queue up retries, they just move on to the next target. The downside of greylisting is delayed delivery of mail from non white listed servers, dependent on their retry cycle. I finally gave up on running my own email services and use Gmail which has excellent spam filtering>
Am 07.06.2020 um 11:46 schrieb Nicolas Kovacs:> Hi, > > I'm currently fine-tuning my mail server (Postfix and Dovecot on CentOS 7). > > SPF, DKIM and DMARC work fine, now I'd like to limit the spam tsunami. > > Besides the official Postfix documentation, I've read a few articles about > Postfix spam restrictions, namely these : > > https://www.linuxbabe.com/mail-server/block-email-spam-postfix > > https://wiki.centos.org/HowTos/postfix_restrictions > > After some experimenting, here's what I currently have on my test server: > > --8<----- /etc/postfix/main.cf ----------------------------- > ... > smtpd_helo_required = yes > smtpd_helo_restrictions > permit_mynetworks, > permit_sasl_authenticated, > check_helo_access hash:/etc/postfix/helo_access > reject_invalid_helo_hostname, > reject_non_fqdn_helo_hostname, > reject_unknown_helo_hostname > smtpd_sender_restrictions > permit_mynetworks, > permit_sasl_authenticated, > check_sender_access hash:/etc/postfix/sender_access, > reject_unknown_sender_domain, > reject_unknown_reverse_client_hostname, > reject_unknown_client_hostname > smtpd_recipient_restrictions > permit_mynetworks, > permit_sasl_authenticated, > check_client_access hash:/etc/postfix/rbl_override, > reject_rhsbl_helo dbl.spamhaus.org, > reject_rhsbl_reverse_client dbl.spamhaus.org, > reject_rhsbl_sender dbl.spamhaus.org, > reject_rbl_client zen.spamhaus.org > --8<-------------------------------------------------------- > > Before committing this configuration to my main server, I thought I'd share > this configuration on the list. Maybe the Postfix gurus among you have the odd > comment to make. > > My aim is simply to eliminate as much spam as possible (that is, before adding > SpamAssassin) while keeping false positives to a minimum. > > Any suggestions ? > > NikiHi, a few points: - don't split up the smtpd_*_restrictions as shown above. It is simpler to maintain by keeping everything under smtpd_recipient_restrictions. - use postscreen, it is a Postfix feature. That way relocate the RBL and RHSBL calls to postscreen in a weighted approach - don't offer SMTP AUTH on smtp port 25. Offer submission (port 587) or submissions (465) or both for your known clients. That way you can much better control what's allowed on port 25. - reject_non_fqdn_helo_hostname could lead to reject valid mail, use warn_if_reject for some time to check if that would be relevant for you. - don't make use of permit_mynetworks, control relaying by use of SMTP AUTH. Alexander
On Sun, Jun 07, 2020 at 05:53:28AM -0700, John Pierce wrote:> On Sun, Jun 7, 2020, 2:47 AM Nicolas Kovacs <info at microlinux.fr> wrote: > > > .... > > My aim is simply to eliminate as much spam as possible (that is, before > > adding > > SpamAssassin) while keeping false positives to a minimum. > > > > The one thing that stopped the most spam on my last mailserver was > greylisting. Any mta that connects to you to send you mail, you check > against a white list, and if they are not on it, you reject the connection > with a 'try again later' code and add them to a grey list that will let > them in after 10 minutes or so. The vast majority of spambots don't queue > up retries, they just move on to the next target. > > The downside of greylisting is delayed delivery of mail from non white > listed servers, dependent on their retry cycle.I hit another limitation. My backup MX handler is a 3rd party who will not use greylisting. Thus all the 1st timers I rejected just delivered to my alternate MX address and were not blocked at all. Jon -- Jon H. LaBadie jcu at labadie.us