Undoubtedly, spam has become increasingly popular in recent periods. It is estimated that spam accounts for 80% to 90% of all emails, and many mail servers have great difficulties in dealing with the extra burden caused by the latest spam, in addition, SpamAssassin, for example, does not recognize most spams as before. Fortunately, we can block a large number of spam at the Mail Transfer Agent (MTA) level, for example, you can run a test on the sender and receiver domains by using a blacklist. An additional advantage of this is that it can reduce the load on the mail server, because the spam filter requires fewer emails to be viewed.
Basic work
This article will discuss how to configure Postfix (2.x and 1.x) and block it before spam enters the server. However, after applying the methods discussed in this article to your email server, you should check your email logs to ensure that valid user emails are not blocked.
You can view the following links for some guidance:
Http://www.howtoforge.com/virtual_postfix_antispam
The following link contains some other anti-spam solutions:
Http://www.howtoforge.com/taxonomy_menu/1/78/24
Postfix 2.x
Open the/etc/postfix/main. cf file and add the following lines in it (if the related configuration exists, replace it ):
Vi/etc/postfix/main. cf
[...]
Smtpd_helo_required = yes
Disable_vrfy_command = yes
Strict_rfc821_envelopes = yes
Invalid_hostname_reject_code = 554
Multi_recipient_bounce_reject_code = 554
Non_fqdn_reject_code = 554.
Relay_domains_reject_code = 554
Unknown_address_reject_code = 554
Unknown_client_reject_code = 554
Unknown_hostname_reject_code = 554
Unknown_local_recipient_reject_code = 554
Unknown_relay_recipient_reject_code = 554
Unknown_sender_reject_code = 554
Unknown_virtual_alias_reject_code = 554
Unknown_virtual_mailbox_reject_code = 554
Unverified_recipient_reject_code = 554
Unverified_sender_reject_code = 554
Smtpd_recipient_restrictions =
Reject_invalid_hostname,
Reject_unknown_recipient_domain,
Reject_unauth_pipelining,
Permit_mynetworks,
Permit_sasl_authenticated,
Reject_unauth_destination,
Reject_rbl_client multi.uribl.com,
Reject_rbl_client dsn.rfc-ignorant.org,
Reject_rbl_client dul.dnsbl.sorbs.net,
Reject_rbl_client list.dsbl.org,
Reject_rbl_client sbl-xbl.spamhaus.org,
Reject_rbl_client bl.spamcop.net,
Reject_rbl_client dnsbl.sorbs.net,
Reject_rbl_client cbl.abuseat.org,
Reject_rbl_client ix.dnsbl.manitu.net,
Reject_rbl_client combined.rbl.msrbl.net,
Reject_rbl_client rabl.nuclearelephant.com,
Permit
[...]
Then restart Postfix:
/Etc/init. d/postfix restart
Postfix 1.x
Open/etc/postfix/main. cf and add the following lines to it (if the related configuration already exists, replace it ):
Vi/etc/postfix/main. cf
[...]
Smtpd_helo_required = yes
Disable_vrfy_command = yes
Strict_rfc821_envelopes = yes
Invalid_hostname_reject_code = 554
Multi_recipient_bounce_reject_code = 554
Non_fqdn_reject_code = 554.
Relay_domains_reject_code = 554
Unknown_address_reject_code = 554
Unknown_client_reject_code = 554
Unknown_hostname_reject_code = 554
Unknown_local_recipient_reject_code = 554
Unknown_relay_recipient_reject_code = 554
Unknown_sender_reject_code = 554
Unknown_virtual_alias_reject_code = 554
Unknown_virtual_mailbox_reject_code = 554
Unverified_recipient_reject_code = 554
Unverified_sender_reject_code = 554
Maps_rbl_domains =
Multi.uribl.com,
Dsn.rfc-ignorant.org,
Dul.dnsbl.sorbs.net,
List.dsbl.org,
Sbl-xbl.spamhaus.org,
Bl.spamcop.net,
Dnsbl.sorbs.net,
Cbl.abuseat.org,
Ix.dnsbl.manitu.net,
Combined.rbl.msrbl.net,
Rabl.nuclearelephant.com
Smtpd_recipient_restrictions =
Permit_sasl_authenticated,
Permit_mynetworks,
Reject_invalid_hostname,
Reject_non_fqdn_hostname,
Reject_non_fqdn_sender,
Reject_unknown_sender_domain,
Reject_unknown_recipient_domain,
Reject_maps_rbl,
Check_relay_domains
[...]
Then restart Postfix:
/Etc/init. d/postfix restart (responsible editor: Li Lei)
[Related materials]
More blacklists
You can find more DNS and RHS blacklists at the following URL and add them to your Postfix Configuration:
Http://spamlinks.net/filter-dnsbl-lists.htm
Postfix Link
Http://www.postfix.org