E-Mail/Server/Setup/Spam: Unterschied zwischen den Versionen
K Textersetzung - „Kategorie:E-Mail“ durch „Kategorie:Netzwerke:E-Mail“ Markierung: Zurückgesetzt |
K Textersetzung - „Kategorie:Netzwerke:E-Mail:Server“ durch „Kategorie:E-Mail:Server“ Markierung: Manuelle Zurücksetzung |
||
Zeile 74: | Zeile 74: | ||
# systemctl restart postfix | # systemctl restart postfix | ||
[[Kategorie | [[Kategorie:E-Mail:Server]] |
Version vom 29. Dezember 2022, 14:40 Uhr
Spam
- SpamAssassin
Apache SpamAssassin is a free and open source platform that allows us to find and filter out spam email.
- This software is commonly used in tandem with Postfix and Dovecot.
- Install SpamAssassin
# apt-get install spamassassin spamc
- Create a user for SpamAssassin daemon(spamd)
# adduser spamd --disabled-login
- Edit the /etc/default/spamassassin configuration file.
Set the home directory, update the OPTIONS parameter with the user that was just created (as well as the home directory), and update the CRON parameter to 1.
File: /etc/default/spamassassin [...] HOMEDIR="/home/spamd/" OPTIONS="--create-prefs --max-children 5 --username spamd --helper-home-dir ${HOMEDIR} -s ${HOMEDIR}spamd.log" PIDFILE="${HOMEDIR}spamd.pid" [...] CRON=1
Here is a detailed documentation of SpamAssassin’s configuration file that you can refer to while working through these next steps.
- Configure the Postfix email server to check each email with a score > 5.0, mark it as SPAM, and send it directly to the junk folder.
- Add or adjust the following lines inside /etc/spamassassin/local.cf to setup your anti-spam rules:
- File: /etc/spamassassin/local.cf
...
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 ... |
- Set up your Postfix email server to allow anti-spam configuration to check incoming emails.
- Edit /etc/postfix/master.cf and add a filter:
- File: /etc/postfix/master.cf
[...]
smtp inet n - - - - smtpd -o content_filter=spamassassin ... spamassassin unix - n n - - pipe user=spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}
- Start Spamassassin and enable the service to start on boot:
# systemctl start spamassassin # systemctl enable spamassassin
If not using systemd (as is the case with Debian 7 and earlier), edit the /etc/default/spamassassin configuration file instead.
- Set the ENABLED parameter to 1.
- Restart the Postfix email server to get your new anti-spam settings in place:
# systemctl restart postfix