No description
Find a file
2023-11-30 03:10:07 +01:00
defaults train spam mails from junk 2021-02-09 14:00:35 +01:00
files move shells scripts to dovecote dir 2021-02-12 16:05:19 +01:00
handlers add handlers, move shellscripts to /usr/local/bin 2021-02-10 12:01:33 +01:00
meta add initial files 2020-10-30 11:37:51 +01:00
tasks Replace include with include_tasks 2023-11-30 03:10:07 +01:00
templates add numbers to template 2023-01-27 18:34:47 +01:00
README.md add example how to write own rules 2021-05-01 11:58:32 +02:00

rspamd

configuration

redis

configure redis and tell rspamd to use it:

redis:
  instances:
    - name: rspamd
      socket_enabled: true
      maxmemory: 200M
      maxmemory_policy: volatile-ttl
    - name: rspamd-bayes
      socket_enabled: true
      maxmemory: 500M
      maxmemory_policy: volatile-ttl
    - name: rspamd-fuzzy
      socket_enabled: true
      maxmemory: 200M
      maxmemory_policy: volatile-ttl

rspamd:
  local_configs:
    redis.conf:
      servers: /var/run/redis/redis-rspamd.sock
    classifier-bayes.conf:
      backend: redis
      servers: /var/run/redis/redis-rspamd-bayes.sock
    worker-fuzzy.inc:
      backend: redis
      servers: /var/run/redis/redis-rspamd-fuzzy.sock

milter

add rspamd to your smtpd_milters:

postfix:
  smtpd_milters:
    - "inet:localhost:11332"

dkim signing

rspamd can sign outgoing mails with dkim. the following steps are necessary:

  • create a keypair: rspamadm dkim_keygen -d <domain> -s <selector>
    • domain should be the domain you want to sign mails for
    • selector should be an unique identifier, for example: 2021020801
  • add dns record
  • create private key file at /var/lib/rspamd/dkim/<domain>.<selector>.key
    • chown _rspamd /var/lib/rspamd/dkim/*
    • chmod u=r,go= /var/lib/rspamd/dkim/*
  • create/update selector in /etc/rspamd/dkim_selectors.map: <domain> <selector>

spam learning

To train ham/spam from move actions from/to junk folder, imap_sieve needs to be enabled in dovecot.

writing manual rules

example:

files:
  "/etc/rspamd/local.d/rspamd.lua":
    owner: _rspamd
    group: root
    mode: "0640"
    content: |
      -- Generica
      config['regexp']['SUBJECT_GENERICA'] = {
        re = 'Subject=/Die besten Generica/Hu',
        description = 'Subject contains "Die besten Generica"',
        score = 13.37,
        group = 'headers'
      }