Nagy László Zsolt wrote:
Charles Swiger írta:
Yes, well, that question implies the right direction for a solution:
you want to reject spam before trying to deliver it, rather than
accepting it and then being responsible for bouncing it back.
I'm using postfix (the most up to date version from the ports tree). I
did not know that it is bouncing back automatically. :-) How can I
reject those emails before accepting them? I need to whole body of the
message before I can classify it. Are there any other options?
You can block a lot of spam before accepting by various changes to
Postfix's main.cf file, as well as by installing the postgrey port,
however, you're right that the standard content-filter mechanism (via
content_filter or check_policy_service) needs to get the whole body of
the message before it can be classified.
Perhaps the following snippets will give you some ideas:
[ ...main.cf... ]
# readme_directory: The location of the Postfix README files.
readme_directory = no
# amavisd filtering...
# sasl config
broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = codefab.com
# tls config
smtp_use_tls = yes
smtpd_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_key_file = /usr/local/etc/postfix/smtpd.pem
smtpd_tls_cert_file = /usr/local/etc/postfix/smtpd.pem
smtpd_tls_CAfile = /usr/local/etc/postfix/smtpd.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
smtpd_helo_required = yes
strict_rfc821_envelopes = yes
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks
smtpd_recipient_restrictions = permit_sasl_authenticated,
% cat helo_checks
localhost REJECT You are not localhost.
18.104.22.168 REJECT You are not my IP, go away.
codefab.com REJECT You are not in my domain.
22.214.171.124 REJECT 456 "Stop bouncing forged spam mail to us!"
% cat recipient_checks.pcre
# Note: You must have PCRE support support built in to Postfix at
# compile time to use this. (Tho I've been told the following are
# valid POSIX RE's ["regexp:" map type], as well.)
# Postfix doesn't relay by default. But it may *appear* to do so
# to some testers. The first two statements below remove all
/^\@/ 550 Invalid address format.
/[EMAIL PROTECTED]@/ 550 This server disallows weird address syntax.
# Let email to the following destinations bypass all the remaining
# "reject" and "check" tests. We always want to let email for these
# recipients in.
# Note: The "OK"s above, for postmaster, etc., will *not*
# bypass header and body checks. There is currently no way
# to do so with Postfix :(
# Remember where I said, at the very beginning, about how
# order is important? Whatever you do, do *not* place an
# access map like this one before the "permit mynetworks"
# and "reject_unauth_destination" statements. Not unless
# you want to be an open relay, anyway.
[ ... ]
email@example.com mailing list
To unsubscribe, send any mail to "[EMAIL PROTECTED]"