Skip to navigation
Install SpamAssassin on a debian sever for the postfix mail server
05.12.19
Step 1: Install SpamAssassin and its client $ apt-get install spamassassin spamc Step 2: Add a user for the spamd daemon $ adduser spamd --disabled-login Step 3: Edit the configuration settings at /etc/default/spamassassin I'll only list the values I'm changing. # Change to one to enable the spamd daemon ENABLED=1 # Set the username, home directory and log file SPAMD_HOME="/home/spamd/" OPTIONS="--create-prefs --max-children 5 --username spamd --helper-home-dir ${SPAMD_HOME} -s ${SPAMD_HOME}spamd.log" # Set a location for the Process ID file PIDFILE="${SPAMD_HOME}spamd.pid" # Set the sa-update process to update the anti-spam rules automatically on a nightly basis CRON=1 Step 4. Edit /etc/spamassassin/local.cf to set up some anti-spam rules I use the following settings: rewrite_header Subject ***** SPAM _SCORE_ ***** report_safe 0 required_score 5.0 use_bayes 1 use_bayes_rules 1 bayes_auto_learn 1 skip_rbl_checks 0 use_razor2 0 use_dcc 0 use_pyzor 0 This will cause each email that scores 5.0 or greater on its spam checks to marked with ***** SPAM ***** and the score in its subject line. Most email clients already recognize the headers or text that SpamAssassin adds to incoming emails, but if you have a client that doesn't, you can set up a filtering rule to send any message with ***** SPAM ***** in its subject line directly to your junk folder. The "bayes" rules allow the Bayesian filter to try to identify spam. And if report_safe is set to 0, incoming spam will be identified by "X-Spam-" headers added to the message while no changes are made to the message body. Step 5: Tell Postfix to pass incoming messages to the anti-spam system for checking Edit /etc/postfix/master.cf and add a content filter to your SMTP server: smtp inet n - - - - smtpd -o content_filter=spamassassin Still in /etc/postfix/master.cf, add this to 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} This tells the client to pass its completed checks to the default MTA (mail transfer agent, /usr/sbin/sendmail, i.e., the Postfix-Sendmail compatibility interface) for handoff to the MDA (mail delivery agent, Dovecot) for delivery. Step 6: Start/restart everything and test $ service spamassassin start $ service postfix restart
https://www.geoffstratton.com/spamassassin-ubuntu
Reply
Anonymous
Information Epoch 1751866784
Use software leverage to your advantage.
Home
Notebook
Contact us