Привожу выдержки из настроек в main.cf для фильтрации спама в версии Postfix
2.2 его собственными силами.
Использую также SASL2 для аутентификации (это не обязательно) и PCRE (аналог regexp).
/etc/postfix/main.cf
====================
disable_vrfy_command = yes
strict_rfc821_envelopes = yes
smtpd_etrn_restriction = reject
smtpd_sasl_auth_enable = yes
smtpd_helo_required = yes
smtpd_helo_restrictions =
smtpd_recipient_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_non_fqdn_recipient,
check_recipient_access pcre:/etc/postfix/recipient_checks.pcre,
reject_unknown_recipient_domain,
reject_unverified_recipient,
reject_unauth_destination,
reject_unauth_pipelining,
permit_auth_destination
smtpd_data_restrictions =
reject_unauth_pipelining,
reject_multi_recipient_bounce,
permit
smtpd_delay_reject=no
# здесь у меня пусто, но можно ввести свой контроль
smtpd_client_restrictions =
# check_client_access hash:/etc/postfix/maps/access_client
# количество RBL серверов регулируйте сами, я дал наиболее распространённые, на мой взгляд
smtpd_sender_restrictions =
permit_sasl_authenticated,
permit_mynetworks,
reject_invalid_hostname,
reject_non_fqdn_hostname,
reject_non_fqdn_sender,
check_sender_access hash:/etc/postfix/maps/ not_our_domain_as_sender,
reject_unknown_client,
reject_unknown_sender_domain,
reject_unknown_hostname,
check_client_access pcre:/etc/postfix/client_checks.pcre,
check_helo_access pcre:/etc/postfix/helo_checks.pcre,
reject_rbl_client bl.spamcop.net,
reject_rbl_client sbl-xbl.spamhaus.org,
reject_rbl_client dul.dnsbl.sorbs.net,
reject_rbl_client list.dsbl.org,
reject_rbl_client dnsbl.njabl.org,
reject_rbl_client relays.ordb.org,
reject_rbl_client cbl.abuseat.org,
reject_rbl_client opm.blitzed.org,
reject_rbl_client dul.ru,
reject_rhsbl_sender dsn.rfc-ignorant.org
====================
/etc/postfix/client_checks.pcre
====================
/(modem|dia(l|lup)|cp[ce]|dsl|p[cp]p|cable|catv|poo(l|les)|pppoe|dhcp|client|
customer|user|host|[0-9]{4,})(-|_|\.|[0-9])/ REJECT Invalid hostname (client)
/[0-9]+-[0-9]+/ REJECT Invalid hostname (D-D)
====================
/etc/postfix/helo_checks.pcre
====================
/[^[] *[0-9]+((\.|-|_)[0-9]+){3}/ REJECT Invalid hostname (ipable)
/(modem|dia(l|lup)|cp[ce]|dsl|p[cp]p|cable|catv|poo(l|les)|pppoe|dhcp|client|
customer|user|host|[0-9]{4,})(-|_|\.|[0-9])/ REJECT Invalid hostname (client)
/[0-9]+-[0-9]+/ REJECT Invalid hostname (D-D)
====================
/etc/postfix/recipient_checks.pcre
====================
/[@!%].*[@!%]/ 550 Please use user@domain address forms only.
====================
/etc/postfix/maps/not_our_domain_as_sender
====================
yourdomain.tld 554 Go away, bloody spammer!
====================
|