Zum Inhalt springen

E-Mail/Server/Setup/Spam: Unterschied zwischen den Versionen

Aus Foxwiki
K Textersetzung - „Kategorie:Netzwerke:E-Mail:Server“ durch „Kategorie:E-Mail:Server“
Markierung: Manuelle Zurücksetzung
K Textersetzung - „ Postfix “ durch „ Postfix
 
(6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt)
Zeile 3: Zeile 3:


[https://spamassassin.apache.org/ Apache SpamAssassin] is a free and open source platform that allows us to find and filter out spam email.  
[https://spamassassin.apache.org/ 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.
* This software is commonly used in tandem with [[Postfix]] and Dovecot.


;Install SpamAssassin
;Install SpamAssassin
Zeile 27: Zeile 27:
Here is a [https://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Conf.html detailed documentation] of SpamAssassin’s configuration file that you can refer to while working through these next steps.
Here is a [https://spamassassin.apache.org/full/3.1.x/doc/Mail_SpamAssassin_Conf.html 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.  
; 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:
* Add or adjust the following lines inside /etc/spamassassin/local.cf to setup your anti-spam rules:


* File: /etc/spamassassin/local.cf
* File: /etc/spamassassin/local.cf


{|  
{| class="wikitable" \n|-  
|-  
||  
||
|| ...
|| ...


rewrite_header Subject ***** SPAM _SCORE_ *****
rewrite_header Subject ***** SPAM _SCORE_ *****
report_safe             0
report_safe       0
required_score         5.0
required_score     5.0
use_bayes               1
use_bayes       1
use_bayes_rules         1
use_bayes_rules     1
bayes_auto_learn       1
bayes_auto_learn   1
skip_rbl_checks         0
skip_rbl_checks     0
use_razor2             0
use_razor2       0
use_dcc                 0
use_dcc         0
use_pyzor               0
use_pyzor       0


...
...
|-
|-
|}
|}
* Set up your Postfix email server to allow anti-spam configuration to check incoming emails.  
* Set up your [[Postfix]] email server to allow anti-spam configuration to check incoming emails.  
* Edit /etc/postfix/master.cf and add a filter:
* Edit /etc/postfix/master.cf and add a filter:


# File: /etc/postfix/master.cf
# File: /etc/postfix/master.cf
  [...]
  [...]


  smtp     inet n       -       -       -       -       smtpd
  smtp   inet n   -   -   -   -   smtpd
  -o content_filter=spamassassin
  -o content_filter=spamassassin
   
   
  ...
  ...
   
   
  spamassassin unix -     n       n       -       -       pipe
  spamassassin unix -   n   n   -   -   pipe
  user=spamd argv=/usr/bin/spamc -f -e
  user=spamd argv=/usr/bin/spamc -f -e
/usr/sbin/sendmail -oi -f ${sender} ${recipient}
/usr/sbin/sendmail -oi -f ${sender} ${recipient}
Zeile 71: Zeile 70:
If not using systemd (as is the case with Debian 7 and earlier), edit the /etc/default/spamassassin configuration file instead.  
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.
* Set the ENABLED parameter to 1.
# Restart the Postfix email server to get your new anti-spam settings in place:
# Restart the [[Postfix]] email server to get your new anti-spam settings in place:
  # systemctl restart postfix
  # systemctl restart postfix


[[Kategorie:E-Mail:Server]]
[[Kategorie:E-Mail/Server]]

Aktuelle Version vom 4. Juli 2026, 13:06 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:
  1. 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}

  1. 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.
  1. Restart the Postfix email server to get your new anti-spam settings in place:
# systemctl restart postfix