Visits: 5266
Postfix Email Servers can filter or Reject Spam
Open Source spam solution
This is the simplest solution for rejecting 90% of spam with no false positives For your Postfix Email Server.
smtpd_recipient_restrictions = permit_sasl_authenticated, reject_non_fqdn_recipient, reject_unknown_recipient_domain, permit_mynetworks, reject_unauth_destination, reject_rbl_client zen.spamhaus.org, reject_rbl_client bl.spamcop.net
This makes your Postfix email server reject mail from servers that are known to send spam. Spamhaus and spamcop aren’t self righteous.
Make your life easy and perform a simple installation method, Install Postfix Email Server with Webmail, Https Cert, Easy User Admin
Also see
https://rspamd.com/doc/quickstart.html
https://www.vultr.com/docs/simple-mailserver-postfix-dovecot-sieve-centos-7
https://www.vultr.com/docs/simple-mailserver-postfix-dovecot-sieve-debian
More ideas for getting rid of Spam on your Postfix Email Server
I am using
Amazon Linux 2
dovecot 2.2.33.2
spamassassin 3.4.1
amavisd
The goal is to run an e-mail server, which I achieved already. I can access the e-mails at the server using Thunderbird and the imap protocol.
For the postfix configuration I followed this tutorial: https://help.ubuntu.com/community/PostfixBasicSetupHowto but using Maildir instead.
Dovecot got configured following:
https://www.linuxbabe.com/mail-server/secure-email-server-ubuntu-16-04-postfix-dovecothttps://help.ubuntu.com/community/Dovecot
In addition I installed fail2ban, which got tested successfully.
The next step is e-mail filtering. Following https://help.ubuntu.com/lts/serverguide/mail-filtering.html.en worked out nicely. Spamassassin is blocking all spam. But acutally I do not want to block it, I just want that spamassassin marks it as spam and that the spam gets redirected into my spam-folder. This is just in case something gets filtered out that was not a spam.
For that I set /etc/amavis/conf.d/21-ubuntu_defaults:
$final_spam_destiny = D_PASS;
and the subject gets added ****SPAM****
The next step is that dovecot automatically moves this mail to my junk folder. And there I get stuck. I followed this tutorial: https://workaround.org/ispmail/stretch/filtering-out-spam-with-rspamd
and there the part “Sending spam to the Junk folder”. But it doesn’t work. I have seen that sieve is not working for imap. But I cannot find any tutorial or manual on imap_sieve, that would solve my problem. Does anyone of you has an idea? I also do not find any log entry where I could see that sieve is working (or not)?
down vote
I got a bit further in my problem:
By setting conf.d/10-logging.conf
mail_debug = yes
and conf.d/90-sieve.conf
sieve_plugins = sieve_imapsieve sieve_global_dir = /etc/dovecot/sieve/`
as well as in:
conf.d/90-plugin.conf `
plugin { sieve_plugins = sieve_imapsieve sieve_extprograms imapsieve_mailbox1_name = INBOX imapsieve_mailbox1_after = file:/etc/dovecot/sieve/default.sieve sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment }
and sieve/default.sieve: `
require [“fileinto”, “mailbox”, “imap4flags”]; if header :contains “subject” [“*SPAM*”] { setflag “\\Seen”; #setflag “\\Deleted”; fileinto :create “Junk”; stop; }
as well as compiling by sievec sieve/default.sieve I made it that junk mail gets copied into the junk folder. But unfortunately the mail stays as well in the Inbox. It seems it is just copied?