Rspamd Keyword Filter

Aus Xinux Wiki
Zur Navigation springen Zur Suche springen

Mailstack from scratch: Postfix + Rspamd + Dovecot (LMTP + Sieve)

Ziel

  • Spam wird von rspamd erkannt
  • Mail wird NICHT rejected
  • Zustellung erfolgt per LMTP an Dovecot
  • Sieve sortiert Spam automatisch nach INBOX.Junk
  • Systemuser mit Maildir im Home

Pakete

  • apt update
  • apt install postfix rspamd dovecot-core dovecot-sieve

Postfix: Grundkonfiguration

  • postconf -e "myhostname = mail.example.de"
  • postconf -e "mydestination = localhost"
  • postconf -e "inet_interfaces = all"
alles an dovecot per LMTP
  • postconf -e "mailbox_transport = lmtp:unix:private/dovecot-lmtp"
  • postconf -e "virtual_transport = lmtp:unix:private/dovecot-lmtp"
rspamd milter
  • postconf -e "smtpd_milters = inet:127.0.0.1:11332"
  • postconf -e "non_smtpd_milters = inet:127.0.0.1:11332"
  • postconf -e "milter_default_action = accept"
  • systemctl restart postfix

Rspamd: Minimal + Keyword-Policy

  • systemctl enable --now rspamd
Multimap
  • vi /etc/rspamd/local.d/multimap.conf
CUSTOM_KEYWORDS {
    type = "content";
    map = "/etc/rspamd/local.d/lists/junk_keywords.map";
    regexp = true;
    icase = true;
    symbol = "CUSTOM_KEYWORD";
    score = 8.0;
}
  • mkdir -p /etc/rspamd/local.d/lists
  • vi /etc/rspamd/local.d/lists/junk_keywords.map
\bviagra\b
\bcialis\b
\btadalafil\b
\bpenis enlargement\b
\bporn\b
\bxxx\b
  • systemctl restart rspamd

Dovecot: Maildir + Auth

  • vi /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:~/Maildir

namespace inbox {
  inbox = yes
}
  • vi /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain
auth_username_format = %n
!include auth-system.conf.ext
  • vi /etc/dovecot/conf.d/auth-system.conf.ext
passdb {
  driver = passwd
}

userdb {
  driver = passwd
}

Dovecot: LMTP

  • vi /etc/d