| Both sides previous revision Previous revision Next revision | Previous revision |
| bernardspil:mailserver [2017/03/18 21:39] – No longer mask-source on submission mails BernardSpil | bernardspil:mailserver [2018/04/24 19:58] (current) – Update for rspamd BernardSpil |
|---|
| %%OpenSMTPd%%, jails and amavisd-new for virus scanning and DKIM signing and spam classification using [[/SpamAssassin|SpamAssassin]] and DSPAM | %%OpenSMTPd%%, jails and amavisd-new for virus scanning and DKIM signing and spam classification using %%SpamAssassin%% and DSPAM |
| |
| ====== Installation ====== | ====== Installation ====== |
| * [[https://github.com/Sp1l/ports/tree/master/mail/opensmtpd-extras|mail/opensmtpd-extras]] %%OpenSMTPd%% extra filters | * [[https://github.com/Sp1l/ports/tree/master/mail/opensmtpd-extras|mail/opensmtpd-extras]] %%OpenSMTPd%% extra filters |
| * [[http://freshports.org/security/amavisd-new|security/amavisd-new]] "A Mail and Virus Scanner" | * [[http://freshports.org/security/amavisd-new|security/amavisd-new]] "A Mail and Virus Scanner" |
| * [[http://freshports.org/mail/spamassassin|mail/spamassassin]] Apache [[/SpamAssassin|SpamAssassin]] e-mail classifier | * [[http://freshports.org/mail/spamassassin|mail/spamassassin]] Apache %%SpamAssassin%% e-mail classifier |
| * [[http://freshports.org/mail/dspam|mail/dspam]] Bayesian e-mail classifier | * <del>[[http://freshports.org/mail/dspam|mail/dspam]] Bayesian e-mail classifier</del> |
| | * [[http://freshports.org/mail/rspamd|mail/rspamd]] rspamd e-mail classifier |
| * [[http://freshports.org/security/clamav|security/clamav]] Open source virus scanner | * [[http://freshports.org/security/clamav|security/clamav]] Open source virus scanner |
| * [[http://eric.lubow.org/projects/dspam-spamassassin-plugin/|DSPAM SpamAssassin]] plug-in | * [[http://eric.lubow.org/projects/dspam-spamassassin-plugin/|DSPAM !SpamAssassin]] plug-in |
| * One of [[http://freshports.org/databases/mariadb100-client|MariaDB/MySQL]], [[http://freshports.org/databases/postgresql94-client|PostreSQL]], [[http://www.freshports.org/databases/sqlite3/|SQLite]] or Hash database | * One of [[http://freshports.org/databases/mariadb100-client|MariaDB/MySQL]], [[http://freshports.org/databases/postgresql94-client|PostreSQL]], [[http://www.freshports.org/databases/sqlite3/|SQLite]] or Hash database |
| |
| |
| | Jail | What | When | Why | | | Jail | What | When | Why | |
| | scan | [[#sa-update|sa-update]] | daily | Keep [[/SpamAssassin|SpamAssassin]] rules up-to-date | | | scan | [[#sa-update|sa-update]] | daily | Keep %%SpamAssassin%% rules up-to-date | |
| | scan | [[#freshclam.sh|freshclam]] | hourly | Keep %%ClamAV%% signatures up-to-date | | | scan | [[#freshclam.sh|freshclam]] | hourly | Keep %%ClamAV%% signatures up-to-date | |
| | scan%%|%%db | [[#dspam-purge|dspam-purge]] | daily | Remove old messages and signatures from dspam database | | | scan%%|%%db | [[#dspam-purge|dspam-purge]] | daily | Remove old messages and signatures from dspam database | |
| - Domain of receiver is one of allowed domains | - Domain of receiver is one of allowed domains |
| - Forward to %%AMaViS%% service | - Forward to %%AMaViS%% service |
| - Bayesian classification using DSPAM b. Rule-based classification using [[/SpamAssassin|SpamAssassin]] c. Virus scan using %%ClamAV%% | - Bayesian classification using DSPAM b. Rule-based classification using %%SpamAssassin%% c. Virus scan using %%ClamAV%% |
| - Receive from %%AMaViS%% service (tag Scanned) | - Receive from %%AMaViS%% service (tag Scanned) |
| - Deliver to Dovecot using aliases db | - Deliver to Dovecot using aliases db |
| - Sieve language support (plugin) | - Sieve language support (plugin) |
| |
| This setup adds [[http://www.freshports.org/mail/dovecot2-antispam-plugin/|mail/dovecot2-antispam-plugin]] to the configuration for easy (re-)classification of mails. This triggers copying of a message when copied/moved into or out of the Spam folder. The [[/NotSpam|NotSpam]] and [[/IsSpam|IsSpam]] have to be trained with DSPAM. | This setup adds [[http://www.freshports.org/mail/dovecot2-antispam-plugin/|mail/dovecot2-antispam-plugin]] to the configuration for easy (re-)classification of mails. This triggers copying of a message when copied/moved into or out of the Spam folder. The %%NotSpam%% and %%IsSpam%% have to be trained with DSPAM. |
| |
| ===== AMaViSd ===== | ===== AMaViSd ===== |
| ==== Scanning ==== | ==== Scanning ==== |
| - %%ClamAV%% | - %%ClamAV%% |
| - DSPAM | - <del>DSPAM</del> |
| - [[/SpamAssassin|SpamAssassin]] | - rspamd |
| | - %%SpamAssassin%% |
| |
| Viruses can be rejected without spam classification/scanning. \\ | Viruses can be rejected without spam classification/scanning. \\ |
| First pass through DSPAM for bayesian classification (I've found it to be **//far//** superior to [[/SpamAssassin|SpamAssassin]]'s bayesian classifier) and then through [[/SpamAssassin|SpamAssassin]] to allow [[/SpamAssassin|SpamAssassin]] to take the ''%%X-DSPAM%%'' headers generated by dspam into account when scoring | First pass through DSPAM for bayesian classification (I've found it to be **//far//** superior to %%SpamAssassin%%'s bayesian classifier) and then through %%SpamAssassin%% to allow %%SpamAssassin%% to take the ''%%X-DSPAM%%'' headers generated by dspam into account when scoring |
| |
| All this results in the following headers: | All this results in the following headers: |
| |
| **NOTE:** Documentation seems to be gone from the sourceforge.net project page | **NOTE:** Documentation seems to be gone from the sourceforge.net project page |
| | **NOTE2:** I'm no longer using DSPAM, I've moved to rspamd (with spamassassin rules added) |
| |
| This setup creates a 'site-wide' configuration, all mail is classified and trained under the ''%%vscan%%'' user. | This setup creates a 'site-wide' configuration, all mail is classified and trained under the ''%%vscan%%'' user. |
| The Dovecot antispam-plugin must be configured to put mis-classified messages in /path/to/%%NotHam%% and /path/to/%%NotSpam%% folders. | The Dovecot antispam-plugin must be configured to put mis-classified messages in /path/to/%%NotHam%% and /path/to/%%NotSpam%% folders. |
| You'll need to create a script to feed these to dspam to update the database tokens | You'll need to create a script to feed these to dspam to update the database tokens |
| | |
| | ===== rspamd ===== |
| | |
| | Yet to be documented |
| |
| ===== SpamAssassin ===== | ===== SpamAssassin ===== |
| |
| Download the [[https://github.com/elubow/dspam-spamassassin|dspam]] [[/SpamAssassin|SpamAssassin]] module (''%%dspam.pm%%'') and ruleset (''%%dspam.cf%%'') and drop them in ''%%/usr/local/etc/mail/spamassassin%%''\\ | **NOTE:** Now integrated into my rspamd config |
| | |
| | Download the [[https://github.com/elubow/dspam-spamassassin|dspam]] %%SpamAssassin%% module (''%%dspam.pm%%'') and ruleset (''%%dspam.cf%%'') and drop them in ''%%/usr/local/etc/mail/spamassassin%%''\\ |
| Add to your init.pre | Add to your init.pre |
| |
| |
| https://paste.xinu.at/ypY62/ | https://paste.xinu.at/ypY62/ |
| | |
| | ---- |
| | |
| | {{tag>HowTo}} |
| |