Bobcares

Postfix Dovecot SpamAssassin – The way we configure and fix errors

by | Oct 28, 2019

Have you ever thought of an effective way to stop spam emails?

Luckily, the Postfix Dovecot SpamAssassin combination helps to protect the mailboxes from the incoming spam mails.

However, configuring mail servers with SpamAssassin may not be easy. Often the bad configuration may lead to improper spam detection too.

At Bobcares, we often get requests from our customers to configure SpamAssassin with Postfix and Dovecot as part of our Server Management Services

Today, we’ll see how our Support Engineers make use of SpamAssassin to fight against spam mails.

 

How we integrate Postfix Dovecot SpamAssassin

Let’s begin by checking the process to integrate SpamAssassin in Postfix and Dovecot server.

Basically, SpamAssassin is an anti-spam software. Also, this is one of the best solutions to protect the mailbox from the incoming spam mails.

Moreover, Spamassassin can scan incoming emails. Depending on the spam score Spamassassin adds headers to that email to mark it spam.

Here, let’s see how our Support Engineers install SpamAssassin with Postfix and Dovecot on Ubuntu/Debian server.

1. Initially, we install SpamAssassin packages with the following command.

apt-get install spamassassin spamc

2. Then, we set up a user account and group for spamd service.

groupadd spamd
useradd -g spamd -s /bin/false -d /var/log/spamassassin spamd
mkdir /var/log/spamassassin
chown spamd:spamd /var/log/spamassassin

3. After that, we edit /etc/default/spamassassin to configure SpamAssassin as follows.

# Change to one to enable spamd
ENABLED=1

SAHOME="/var/log/spamassassin/"

......
OPTIONS="--create-prefs --max-children 5 --helper-home-dir --username spamd \
-H ${SAHOME} -s ${SAHOME}spamd.log"

4. As the next step, we change to CRON=1 at the bottom of this file.

5. Next, we start the SpamAssassin daemon.

service spamassassin start

6. The next step is to configure Postfix to use SpamAssassin as a filter. So, we open the file /etc/postfix/master.cf. Then add the following line at the end of the file.

spamassassin unix - n n - - pipe
user=spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}

Then, we restart the postfix service.

service postfix restart

7. Additionally, we configure SpamAssassin to modify emails according to spam checks. For that, we edit the configuration file /etc/spamassassin/local.cf.

Hence, we uncomment the rewrite_header line to modify the Subject lines of emails that are identified as spam. As a result, all spam emails will have a tag. Further, this helps in an easy grouping of emails.

8. Also, we configure Dovecot with a separate Spam folder. For that, Dovecot wants a Sieve interpreter plugin. This plugin helps to use Sieve to read mails. To install the plugin,

apt-get install dovecot-sieve dovecot-managesieved

And, we edit /etc/dovecot/conf.d/20-lmtp.conf file to configure dovecot to enable the sieve plugin.

protocol lmtp {
# Space separated list of plugins to load (default is global mail_plugins).
mail_plugins = $mail_plugins sieve
}

9. Finally, we restart dovecot and SpamAssassin.

service dovecot restart

service spamassassin restart

That’s it. We set up SpamAssassin with Postfix and Dovecot on Ubuntu/Debian server.

 

How we fixed the error after configuring Postfix Dovecot SpamAssassin

From our experience in managing servers, we’ve seen customers often facing problems after configuring SpamAssassin in the Postfix Dovecot server.

Now, let’s see how our Support Engineers fixed the top errors.

 

Bad SpamAssassin settings

Recently, one of our customers had a problem after configuring SpamAssassin on his server. Also, he was trying to move Spam detected by SpamAssassin automatically to the junk folder on Debian. However, it did not work.

On checking, our Support Engineers found that the customer forgot to enable spamd service in the file /etc/default/spamassassin

So, we changed ENABLED=0 to 1 in the file. Finally, a restart of the mail services solved the problem.

 

[Having difficulty in configuring SpamAssassin? We’ll fix it for you.] 

 

Conclusion

In short, SpamAssassin protects the mailboxes on a server using Postfix and Dovecot from incoming spam. Today, we saw how our Support Engineers configure and integrate SpamAssassin on mail server and fix related errors.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF