Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| email:mailscanner [2025/06/16 09:41] – willy | email:mailscanner [2026/04/13 14:52] (current) – [Web interface] willy | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== N) Mail Scanner | + | ====== N) Spam filtering |
| - | [[https://www.mailscanner.info|MailScanner]] is a tool that integrates your mail server (MTA = Postfix) with antivirus scanners and Spam Assassin. | + | [[https://github.com/ |
| - | MailScanner Gentoo latest package is obsolete, you must install manually. | ||
| - | Download generic 'Nix tarball from [[https:// | + | ===== Installation ===== |
| - | decompress | + | My VPS is pretty ancient |
| + | <file - rspamd> | ||
| + | mail-filter/ | ||
| + | </ | ||
| + | |||
| + | Now simply emerge it: | ||
| <code bash> | <code bash> | ||
| - | mkdir / | + | emerge -vp rspamd dev-db/redis |
| - | cd / | + | |
| - | wget ... | + | |
| - | tar xvf < | + | |
| - | cd MailScanner-xxx | + | |
| - | ./install.sh | + | |
| </ | </ | ||
| - | follow instructions and answer the various questions. | + | rspamd requires redis, but somehow it doesn' |
| - | MailScanner setup, see [[https://www.mailscanner.info/ | + | |
| - | /etc/MailScanner.conf: | + | ===== Configure rspamd ===== |
| - | <code> | + | |
| - | Run As User = postfix | + | Create **/etc/rspamd/local.d/actions.conf**: |
| - | Run As Group = postfix | + | <file - actions.conf> |
| - | Incoming Queue Dir = / | + | # Basic action thresholds |
| - | Outgoing Queue Dir = /var/ | + | reject |
| - | MTA = msmail | + | add_header |
| - | MSMail Queue Type = short | + | greylist |
| - | MSMail Delivery Method = QMQP | + | </file> |
| - | MSMail Socket Type = inet | + | |
| - | MSMail Socket Dir = /var/spool/postfix/public/qmqp | + | Configure redis **/etc/rspamd/local.d/redis.conf**: |
| - | MSMail Relay Port = 628 | + | <file redis.conf> |
| - | MSMail Relay Address | + | # Redis connection for statistics and caching |
| + | servers | ||
| + | </ | ||
| + | |||
| + | Setup a controller password for the web interface: | ||
| + | <code bash> | ||
| + | rspamadm pw | ||
| </ | </ | ||
| - | /etc/default: | + | Create **/etc/rspamd/ |
| + | <file - worker-controller.inc> | ||
| + | # Replace with your generated password | ||
| + | password = " | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Configure redis ===== | ||
| + | |||
| + | Setup redis at least in a basic and secure way **/ | ||
| + | <file - redis.conf> | ||
| + | # Bind only to localhost for security | ||
| + | bind 127.0.0.1 ::1 | ||
| + | # Set memory limit | ||
| + | maxmemory 500mb | ||
| + | maxmemory-policy volatile-ttl | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Configure postfix link ===== | ||
| + | |||
| + | Add milter integration to your Postfix configuration in **/ | ||
| < | < | ||
| - | run_mailscanner=1 | + | # Enable Rspamd milter |
| + | smtpd_milters | ||
| + | milter_default_action = accept | ||
| + | milter_protocol = 6 | ||
| </ | </ | ||
| - | Postfix setup. | + | Configure Rspamd proxy worker in **/ |
| - | main.cf: | + | <file - worker-proxy.inc> |
| - | <code> | + | # Enable |
| - | # MailScanner | + | milter = yes; |
| - | #smtpd_milters | + | timeout = 120s; |
| - | # MailScanner milter may use QMQP for delivery | + | upstream " |
| - | qmqpd_authorized_clients = 127.0.0.1 | + | default = yes; |
| + | self_scan = yes; | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Startup ===== | ||
| + | |||
| + | Ensure all the services are running and setup to start on boot: | ||
| + | <code bash> | ||
| + | for i in rspamd redis postfix | ||
| + | do | ||
| + | | ||
| + | / | ||
| + | done | ||
| </ | </ | ||
| - | master.cf: | + | |
| + | |||
| + | ===== Web interface ===== | ||
| + | |||
| + | By default rspamd web interface is exposed on **http:// | ||
| < | < | ||
| - | 628 | + | location /rspamd/ { |
| + | proxy_pass http:// | ||
| + | proxy_redirect | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | } | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||