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 08:22] – 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 | + | rspamd requires redis, but somehow it doesn' |
| + | |||
| + | |||
| + | ===== Configure rspamd ===== | ||
| + | |||
| + | Create **/ | ||
| + | <file - actions.conf> | ||
| + | # Basic action thresholds | ||
| + | reject = 15; # Reject obvious spam | ||
| + | add_header = 6; # Add spam headers | ||
| + | greylist = 4; # Temporary delay suspicious mail | ||
| + | </ | ||
| + | |||
| + | Configure redis **/ | ||
| + | <file redis.conf> | ||
| + | # Redis connection for statistics | ||
| + | servers = " | ||
| + | </ | ||
| + | |||
| + | Setup a controller password for the web interface: | ||
| + | <code bash> | ||
| + | rspamadm pw | ||
| + | </ | ||
| + | |||
| + | Create **/ | ||
| + | <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 **/ | ||
| + | < | ||
| + | # Enable Rspamd milter | ||
| + | smtpd_milters = inet: | ||
| + | milter_default_action = accept | ||
| + | milter_protocol = 6 | ||
| + | </ | ||
| + | |||
| + | Configure Rspamd proxy worker in **/ | ||
| + | <file - worker-proxy.inc> | ||
| + | # Enable milter mode for Postfix integration | ||
| + | milter = yes; | ||
| + | timeout = 120s; | ||
| + | upstream " | ||
| + | default = yes; | ||
| + | self_scan = yes; # Scan messages directly | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Startup ===== | ||
| + | |||
| + | Ensure all the services are running and setup to start on boot: | ||
| + | <code bash> | ||
| + | for i in rspamd redis postfix | ||
| + | do | ||
| + | | ||
| + | / | ||
| + | done | ||
| + | </ | ||
| + | |||
| + | |||
| + | ===== Web interface ===== | ||
| + | |||
| + | By default rspamd web interface is exposed on **http:// | ||
| + | < | ||
| + | location /rspamd/ { | ||
| + | proxy_pass http:// | ||
| + | proxy_redirect | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | proxy_set_header | ||
| + | } | ||
| + | </ | ||
| + | |||