Nicolas Kovacs
2018-Dec-18 07:08 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
Hi, My mail server is running on CentOS 7 with Postfix, Dovecot and Spamassassin. I get quite a lot of spam on a few accounts, and Spamassassin does its job fine. Spam mail is identified correctly, and it looks like there are no false positives, e. g. valid mail is never identified as spam. When a message is flagged as spam, the subject line is rewritten to begin with [SPAM]. Then, a filter in Mozilla Thunderbird is setup, and when a subject line begins with [SPAM] the message is directly sent to Trash. I've documented the whole configuration here: * https://blog.microlinux.fr/spamassassin-centos/ The problem with this setup is that spam mail is still delivered, and I need Thunderbird's filters to weed out incoming mail. And when I'm using my webmail (running SquirrelMail), my inbox is a tsunami of unread [SPAM] messages. So I'd like to go a step further and delete all messages flagged [SPAM] directly on the server. It doesn't look like Spamassassin provides this functionality. Did any of you guys succeed in doing this anyway? Cheers, Niki -- Microlinux - Solutions informatiques durables 7, place de l'?glise - 30730 Montpezat Site : https://www.microlinux.fr Blog : https://blog.microlinux.fr Mail : info at microlinux.fr T?l. : 04 66 63 10 32
Fabian Arrotin
2018-Dec-18 09:34 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
On 18/12/2018 08:08, Nicolas Kovacs wrote:> Hi, > > My mail server is running on CentOS 7 with Postfix, Dovecot and > Spamassassin. I get quite a lot of spam on a few accounts, and > Spamassassin does its job fine. Spam mail is identified correctly, and > it looks like there are no false positives, e. g. valid mail is never > identified as spam. > > When a message is flagged as spam, the subject line is rewritten to > begin with [SPAM]. Then, a filter in Mozilla Thunderbird is setup, and > when a subject line begins with [SPAM] the message is directly sent to > Trash. > > I've documented the whole configuration here: > > * https://blog.microlinux.fr/spamassassin-centos/ > > The problem with this setup is that spam mail is still delivered, and I > need Thunderbird's filters to weed out incoming mail. And when I'm using > my webmail (running SquirrelMail), my inbox is a tsunami of unread > [SPAM] messages. > > So I'd like to go a step further and delete all messages flagged [SPAM] > directly on the server. It doesn't look like Spamassassin provides this > functionality. > > Did any of you guys succeed in doing this anyway? > > Cheers, > > Niki >I've used for quite some time now a combination of postfix+SA+MailScanner for this, not delivering mails, but letting those in a quarantine, and using Mailwatch (http frontend) to let people release mail from the quarantine, etc .. https://www.mailscanner.info/ https://mailwatch.org/ And the ansible role that I initially used for this on CentOS 7 : https://github.com/arrfab/ansible-role-mail-gateway Cheers, -- Fabian Arrotin The CentOS Project | https://www.centos.org gpg key: 56BEC54E | twitter: @arrfab -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: OpenPGP digital signature URL: <http://lists.centos.org/pipermail/centos/attachments/20181218/a6382787/attachment-0001.sig>
Pete Biggs
2018-Dec-18 09:58 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
> The problem with this setup is that spam mail is still delivered, and I > need Thunderbird's filters to weed out incoming mail. And when I'm using > my webmail (running SquirrelMail), my inbox is a tsunami of unread > [SPAM] messages. > > So I'd like to go a step further and delete all messages flagged [SPAM] > directly on the server. It doesn't look like Spamassassin provides this > functionality. >Spamassassin just tags things, it doesn't interact with the final mail delivery. What you need is some form of server-side filtering My (limited) expertise in MTAs is with Exim and that has an extensive filter syntax that goes in the user's .forward file - I use that to pre-filter my mail before the MUA sees it. From my .forward file: if $h_X-Spam-Flag: contains "Yes" then save Maildir/.spam/ finish endif if $header_subject: contains "[CentOS" then save Maildir/.CentOS/ finish endif If you don't want to use a different MTA, then the classic way of doing server side filtering is using procmail. I'm certain there will be lots of HowTos out there on how to set it all up with Postfix. Finally, I would be quite surprised if there is no built-in filtering of some form with Postfix, but from the articles I've just been looking at it doesn't seem to be a simple process. P.
Nux!
2018-Dec-18 10:02 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
Hi, Procmail, it can move messages around based on many rules. Use something like this in postfix main.cf: mailbox_command = /usr/bin/procmail-wrapper -o -a $DOMAIN -d $LOGNAME And something like this in /etc/procmailrc or $HOME/.procmailrc SPAMDIR=$HOME/Maildir/.Spam/ :0fw | /usr/bin/spamc :0 * ^X-Spam-Status: Yes $SPAMDIR DEFAULT=$HOME/Maildir/ ORGMAIL=$HOME/Maildir/ DROPPRIVS=yes HTH -- Sent from the Delta quadrant using Borg technology! Nux! www.nux.ro ----- Original Message -----> From: "Nicolas Kovacs" <info at microlinux.fr> > To: "CentOS mailing list" <centos at centos.org> > Cc: "scholae >> AA Tous les salari?s" <scholae at lists.tuxfamily.org> > Sent: Tuesday, 18 December, 2018 07:08:55 > Subject: [CentOS] Spamassassin + Postfix : delete spam mail on the server ?> Hi, > > My mail server is running on CentOS 7 with Postfix, Dovecot and > Spamassassin. I get quite a lot of spam on a few accounts, and > Spamassassin does its job fine. Spam mail is identified correctly, and > it looks like there are no false positives, e. g. valid mail is never > identified as spam. > > When a message is flagged as spam, the subject line is rewritten to > begin with [SPAM]. Then, a filter in Mozilla Thunderbird is setup, and > when a subject line begins with [SPAM] the message is directly sent to > Trash. > > I've documented the whole configuration here: > > * https://blog.microlinux.fr/spamassassin-centos/ > > The problem with this setup is that spam mail is still delivered, and I > need Thunderbird's filters to weed out incoming mail. And when I'm using > my webmail (running SquirrelMail), my inbox is a tsunami of unread > [SPAM] messages. > > So I'd like to go a step further and delete all messages flagged [SPAM] > directly on the server. It doesn't look like Spamassassin provides this > functionality. > > Did any of you guys succeed in doing this anyway? > > Cheers, > > Niki > > > -- > Microlinux - Solutions informatiques durables > 7, place de l'?glise - 30730 Montpezat > Site : https://www.microlinux.fr > Blog : https://blog.microlinux.fr > Mail : info at microlinux.fr > T?l. : 04 66 63 10 32 > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos
Robert Heller
2018-Dec-18 13:05 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
At Tue, 18 Dec 2018 08:08:55 +0100 CentOS mailing list <centos at centos.org> wrote:> > > Hi, > > My mail server is running on CentOS 7 with Postfix, Dovecot and > Spamassassin. I get quite a lot of spam on a few accounts, and > Spamassassin does its job fine. Spam mail is identified correctly, and > it looks like there are no false positives, e. g. valid mail is never > identified as spam. > > When a message is flagged as spam, the subject line is rewritten to > begin with [SPAM]. Then, a filter in Mozilla Thunderbird is setup, and > when a subject line begins with [SPAM] the message is directly sent to > Trash.You have two options: If you have mimedefang installed and using it run spamassassin over all incoming messages, you can change mimedefang's default spamassassin filter interface from merely tagging messages to actually rejecting them -- mimedefang can return a code to tell Postfix to boot the spam message with a 5xx status. Or you can have a recipe in .procmailrc to file (or otherwise) messages tagged as spam. (Another thing you can do is configure Postfix's access and client.cidr files to refuse to even talk to various hosts that are known spam sources -- pretty much all of China, Vietnam, Russia (and former USSR countries), and Brazil as well as all of the "silly" TLDs: .science, .stream, .store, .webcam, .acountant, .life, .today, and many more.)> > I've documented the whole configuration here: > > * https://blog.microlinux.fr/spamassassin-centos/ > > The problem with this setup is that spam mail is still delivered, and I > need Thunderbird's filters to weed out incoming mail. And when I'm using > my webmail (running SquirrelMail), my inbox is a tsunami of unread > [SPAM] messages. > > So I'd like to go a step further and delete all messages flagged [SPAM] > directly on the server. It doesn't look like Spamassassin provides this > functionality. > > Did any of you guys succeed in doing this anyway? > > Cheers, > > Niki > >-- Robert Heller -- 978-544-6933 Deepwoods Software -- Custom Software Services http://www.deepsoft.com/ -- Linux Administration Services heller at deepsoft.com -- Webhosting Services
Valeri Galtsev
2018-Dec-18 15:24 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
On 12/18/18 4:02 AM, Nux! wrote:> Hi, ><snip>> > HTH > > -- > Sent from the Delta quadrant using Borg technology! >I am just curios how much do they pay you for advertising them in all your posts to this mail list. Or what is different - non-monetary - incentive you have for doing so? Valeri> Nux! > www.nux.ro ><snip> -- ++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++
Valeri Galtsev
2018-Dec-18 15:37 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
On 12/18/18 3:34 AM, Fabian Arrotin wrote:> On 18/12/2018 08:08, Nicolas Kovacs wrote: >> Hi, >> >> My mail server is running on CentOS 7 with Postfix, Dovecot and >> Spamassassin. I get quite a lot of spam on a few accounts, and >> Spamassassin does its job fine. Spam mail is identified correctly, and >> it looks like there are no false positives, e. g. valid mail is never >> identified as spam. >> >> When a message is flagged as spam, the subject line is rewritten to >> begin with [SPAM]. Then, a filter in Mozilla Thunderbird is setup, and >> when a subject line begins with [SPAM] the message is directly sent to >> Trash. >> >> I've documented the whole configuration here: >> >> * https://blog.microlinux.fr/spamassassin-centos/ >> >> The problem with this setup is that spam mail is still delivered, and I >> need Thunderbird's filters to weed out incoming mail. And when I'm using >> my webmail (running SquirrelMail), my inbox is a tsunami of unread >> [SPAM] messages. >> >> So I'd like to go a step further and delete all messages flagged [SPAM] >> directly on the server. It doesn't look like Spamassassin provides this >> functionality. >> >> Did any of you guys succeed in doing this anyway? >> >> Cheers, >> >> Niki >> > > I've used for quite some time now a combination of > postfix+SA+MailScanner for this, not delivering mails, but letting those > in a quarantine, and using Mailwatch (http frontend) to let people > release mail from the quarantine, etc ..Thanks, Fabian. I was looking for something like that for long time. I was using the above under amavisd-new. And as I didn't find GUI front-end ;-( I ended up using maia mailguard. By that point I switched servers to FreeBSD, and there is FreeBSD maia port which is being actively maintained by brilliant person, so that may be the best source to get maia from, not the main maia website. Thanks again, it looks like mailwatch does everything I needed (and found in maia): per user white/blacklists, other individual setting, quarantene release, etc. Valeri> > https://www.mailscanner.info/ > https://mailwatch.org/ > > And the ansible role that I initially used for this on CentOS 7 : > https://github.com/arrfab/ansible-role-mail-gateway > > Cheers, > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos >-- ++++++++++++++++++++++++++++++++++++++++ Valeri Galtsev Sr System Administrator Department of Astronomy and Astrophysics Kavli Institute for Cosmological Physics University of Chicago Phone: 773-702-4247 ++++++++++++++++++++++++++++++++++++++++
Alexander Dalloz
2018-Dec-18 18:46 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
Am 18.12.2018 um 08:08 schrieb Nicolas Kovacs:> The problem with this setup is that spam mail is still delivered, and I > need Thunderbird's filters to weed out incoming mail. And when I'm using > my webmail (running SquirrelMail), my inbox is a tsunami of unread > [SPAM] messages. > > So I'd like to go a step further and delete all messages flagged [SPAM] > directly on the server. It doesn't look like Spamassassin provides this > functionality.What's the point of delivering identified SPAM and then deleting it? Reject SPAM at SMTP level on your MTA. Easy to do with amavisd-new in a smtp proxy setup with Postfix. Alexander
Simon Matter
2018-Dec-19 04:59 UTC
[CentOS] Spamassassin + Postfix : delete spam mail on the server ?
> Am 18.12.2018 um 08:08 schrieb Nicolas Kovacs: >> The problem with this setup is that spam mail is still delivered, and I >> need Thunderbird's filters to weed out incoming mail. And when I'm using >> my webmail (running SquirrelMail), my inbox is a tsunami of unread >> [SPAM] messages. >> >> So I'd like to go a step further and delete all messages flagged [SPAM] >> directly on the server. It doesn't look like Spamassassin provides this >> functionality. > > What's the point of delivering identified SPAM and then deleting it? > Reject SPAM at SMTP level on your MTA. Easy to do with amavisd-new in a > smtp proxy setup with Postfix.There are good reasons to not reject detected SPAM because your SPAM filter could be wrong and you reject legitimate mail. For businesses depending on email communication that's a no go, because you may lose customers that way. Regards, Simon