Rspamd (Ubuntu 18.04)

Aus Tutorials
Zur Navigation springen Zur Suche springen

Noch in Bearbeitung


Installation

sudo su
apt-get install -y lsb-release wget # optional
CODENAME=`lsb_release -c -s`
wget -O- https://rspamd.com/apt-stable/gpg.key | apt-key add -
echo "deb [arch=amd64] http://rspamd.com/apt-stable/ $CODENAME main" > /etc/apt/sources.list.d/rspamd.list
echo "deb-src [arch=amd64] http://rspamd.com/apt-stable/ $CODENAME main" >> /etc/apt/sources.list.d/rspamd.list
apt-get update
apt-get --no-install-recommends install rspamd
exit

Links

https://rspamd.com/downloads.html

Konfiguration

Den Dämon stoppen:

sudo service rspamd stop

/etc/rspamd/local.d/options.inc

Die Datei

sudo vi /etc/rspamd/local.d/options.inc

für globale Netzwerkkonfigurationen anlegen und mit folgenden Inhalt befüllen:

local_addrs = "127.0.0.0/8, ::1";

dns {
    nameserver = ["10.0.0.100:53:10"];
}

Es können auch mehrere Mailserver mit Gewichtung angegeben werden. Muster: <ip address>:<port>:<weight>

Links

https://rspamd.com/doc/configuration/options.html

/etc/rspamd/local.d/worker-normal.inc

Die Datei

sudo vi /etc/rspamd/local.d/worker-normal.inc

für Konfiguration des normal worker anlegen und mit folgenden Inhalt befüllen:

bind_socket = "localhost:11333";

Links

https://rspamd.com/doc/workers/

/etc/rspamd/local.d/worker-controller.inc

Die Datei

sudo vi /etc/rspamd/local.d/worker-controller.inc

für Controller-Einstellungen anlegen und mit folgenden Inhalt befüllen:

password = "<password for web-interface>";

Das Passwort wird mittels dem Kommando

rspamadm pw

generiert.

Links

https://rspamd.com/doc/workers/

/etc/rspamd/local.d/worker-proxy.inc

Die Datei

sudo vi /etc/rspamd/local.d/worker-proxy.inc

für Controller-Einstellungen anlegen und mit folgenden Inhalt befüllen:

bind_socket = "localhost:11332";
milter = yes;
timeout = 120s;
upstream "local" {
    default = yes;
    self_scan = yes;
}

Links

https://rspamd.com/doc/workers/rspamd_proxy.html

Postfix

/etc/postfix/main.cf

sudo vi /etc/postfix/main.cf
## Spamfilter und DKIM-Signaturen via Rspamd ##

smtpd_milters = inet:localhost:11332
non_smtpd_milters = inet:localhost:11332
milter_protocol = 6
milter_mail_macros =  i {mail_addr} {client_addr} {client_name} {auth_authen}
milter_default_action = accept

Dovecot

dovecot.conf

sudo vi /etc/dovecot/dovecot.conf
plugin {
    sieve_plugins = sieve_imapsieve sieve_extprograms

    ### Spam learning ###

    # From elsewhere to Spam folder
    imapsieve_mailbox1_name = Spam
    imapsieve_mailbox1_causes = COPY
    imapsieve_mailbox1_before = file:/var/vmail/sieve/global/report-spam.sieve

    # From Spam folder to elsewhere
    imapsieve_mailbox2_name = *
    imapsieve_mailbox2_from = Spam
    imapsieve_mailbox2_causes = COPY
    imapsieve_mailbox2_before = file:/var/vmail/sieve/global/report-ham.sieve

    sieve_pipe_bin_dir = /usr/bin
    sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
}

Links

https://wiki2.dovecot.org/HowTo/AntispamWithSieve

Sieve-Filterscripts

sudo -u vmail vi /var/vmail/sieve/learn-spam.sieve
require ["vnd.dovecot.pipe", "copy", "imapsieve"];
pipe :copy "rspamc" ["learn_spam"];
sudo -u vmail vi /var/vmail/sieve/learn-ham.sieve
require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];

if environment :matches "imap.mailbox" "*" {
    set "mailbox" "${1}";
}

if string "${mailbox}" "Trash" {
    stop;
}

pipe :copy "rspamc" ["learn_ham"];

Links

https://rspamd.com/doc/quickstart.html

https://www.syn-flut.de/rspamd-das-bessere-spamassassin

https://thomas-leister.de/mailserver-debian-stretch/

https://help.united-domains.de/faq-article/was-ist-ein-dkim-eintrag


Zurück zu Spamfilter