On Sat, Jun 15, 2024 at 12:14:01PM +0200, John Levine via Postfix-users wrote:

> People I'm working with have a short list of addresses from which they
> don't want to accept mail at all, and they'd like to reject as early
> as possible without running it through anti-spam milters, ideally by
> rejecting the SMTP MAIL FROM command. What's the best way to do this?
> The list is short so if it has to be hand-edited into config files,
> that's OK.
> 
> I'm not sure exactly why they want to do it this way but they have
> been running mail systems for a long time (some of you surely know
> them) and I assume they have sensible reasons.

For very short lists, the simplest is:

    main.cf:
        thash = texthash:${config_directory}/
        smtpd_sender_restrictions =
            check_sender_access ${thash}blocked-senders

    blocked-senders:
        m...@example.com     REJECT Stooges not accepted here
        la...@example.com   REJECT Stooges not accepted here
        cu...@example.com   REJECT Stooges not accepted here

This admits occasional editing of the list without having to touch
main.cf.  If the list is sufficiently static that bolting it into
main.cf is a sensible tradeoff, then:

    main.cf:
        smtpd_sender_restrictions =
            check_sender_access inline:{
                    { m...@example.com   = REJECT Stooges not accepted here },
                    { la...@example.com = REJECT Stooges not accepted here },
                    { cu...@example.com = REJECT Stooges not accepted here },
                }

Of course you can also use any of the fancier dictionary types, putting
the data in LDAP, a SQL database, a CDB table, LMDB, ...

-- 
    Viktor.
_______________________________________________
Postfix-users mailing list -- postfix-users@postfix.org
To unsubscribe send an email to postfix-users-le...@postfix.org

Reply via email to