Mailing List Archive

moving spam to junk folder
i am using CentOS 7, spamassassin-3.4.0-2.el7.x86_64,
postfix-2.10.1-6.el7.x86_64, with amavisd.

i set my local.cf to use MySQL as a bayes store and it seems to work
fine setting ham and spam in the database when a message is flagged. 
however it has had no impact on spam received to the inboxes.  we are
still receiving a large amount of junk email.

i originally installed spamassassin according to this guide
http://forums.sentora.org/showthread.php?tid=1118 and it does indeed
filter the test message so it should be working ok?
Re: moving spam to junk folder [ In reply to ]
On Saturday 13 January 2018 at 09:35:47, Matthew Broadhead wrote:

> i am using CentOS 7, spamassassin-3.4.0-2.el7.x86_64,
> postfix-2.10.1-6.el7.x86_64, with amavisd.
>
> i set my local.cf to use MySQL as a bayes store and it seems to work
> fine setting ham and spam in the database when a message is flagged.
> however it has had no impact on spam received to the inboxes. we are
> still receiving a large amount of junk email.

What do you expect to happen to spam instead of it being delivered to inboxes?

> i originally installed spamassassin according to this guide
> http://forums.sentora.org/showthread.php?tid=1118 and it does indeed
> filter the test message so it should be working ok?

That set of steps is designed to do is to change the subject line of spam
emails to contain (it's not clear to me whether it then becomes the only
content, or whether the original content is also retained) the phrase
"***SPAM***"

Are the spam emails which are still arriving in your inbox/es labelled in this
way? If they are, then what you have installed is working as expected.

Also, you say you "originally installed spamassassin according to that guide"
- what have you changed since then? How does your current setup differ from
what those steps create?


Antony.

--
"I think both KDE and Gnome suck - I'm quite unbiased in that, because I use a
Mac."

- Jason Isitt

Please reply to the list;
please *don't* CC me.
Re: moving spam to junk folder [ In reply to ]
On 13.01.18 09:35, Matthew Broadhead wrote:
>i set my local.cf to use MySQL as a bayes store and it seems to work
>fine setting ham and spam in the database when a message is flagged.?
>however it has had no impact on spam received to the inboxes.? we are
>still receiving a large amount of junk email.
>
>i originally installed spamassassin according to this guide
>http://forums.sentora.org/showthread.php?tid=1118 and it does indeed
>filter the test message so it should be working ok?

spamassassin detects and marks mail, it does not deliver it.
the MDA (mail delivery agent) delivers the mail.

you need to configure your MDA (procmail, maildrop, sieve etc) to deliver
mail marked as spam to Junk folder.

--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
One OS to rule them all, One OS to find them,
One OS to bring them all and into darkness bind them
Re: moving spam to junk folder [ In reply to ]
On 2018-01-13 09:42, Matus UHLAR - fantomas wrote:
> On 13.01.18 09:35, Matthew Broadhead wrote:
>> i set my local.cf to use MySQL as a bayes store and it seems to work fine
>> setting ham and spam in the database when a message is flagged. however it has
>> had no impact on spam received to the inboxes.  we are still receiving a large
>> amount of junk email.
>>
>> i originally installed spamassassin according to this guide
>> http://forums.sentora.org/showthread.php?tid=1118 and it does indeed filter
>> the test message so it should be working ok?
>
> spamassassin detects and marks mail, it does not deliver it.
> the MDA (mail delivery agent) delivers the mail.
>
> you need to configure your MDA (procmail, maildrop, sieve etc) to deliver
> mail marked as spam to Junk folder.

Or, if it is sufficient, he could have his MUA sort incoming marked as spam into
his local spam bucket for examination before disposal. I make that easy by
telling SA I want a header that looks like this: "*****SPAM***** 009.1 ** You
have 3 missed Nigerian Spam Pill Adds". Sorting incoming based on the
"*****SPAM*****" part is rather easy.

{^_^}
Re: moving spam to junk folder [ In reply to ]
thanks for your quick reply.  i expected the spam to be filtered into
the Junk mailbox on the server I guess.
i just sent a test email with GTUBE subject line and i got this
Jan 15 17:28:40 ns1 amavis[23493]: (23493-20) Blocked SPAM
{DiscardedInbound,Quarantined}, [74.125.82.46]:39246 [74.125.82.46]
<nbmlaw@gmail.com> -> <matthew.broadhead@nbmlaw.co.uk>, Queue-ID:
2B73F2C26FD, Message-ID:
<CAMu-6rBEGJHaByMZ=NY-qVY5199ko7XS==rr3Szqtc8bK+WH6A@mail.gmail.com>,
mail_id: oRq2de4T0Gvi, Hits: 997.982, size: 3387,
dkim_sd=20161025:gmail.com, 7408 ms
so does that mean amavis is discarding the spams or only above a certain
hits?

this is the local.cf after configuring the bayes:
# These values can be overridden by editing ~/.spamassassin/user_prefs.cf
# (see spamassassin(1) for details)

# These should be safe assumptions and allow for simple visual sifting
# without risking lost emails.

required_hits 5
report_safe 0
rewrite_header Subject [SPAM]

use_bayes          1
bayes_auto_learn   1
bayes_auto_expire  1

# Store bayesian data in MySQL
bayes_store_module Mail::SpamAssassin::BayesStore::MySQL
bayes_sql_dsn      DBI:mysql:sa_bayes:localhost:3306

# Store bayesian data in MySQL
#bayes_store_module Mail::SpamAssassin::BayesStore::PgSQL
#bayes_sql_dsn      DBI:Pg:database:sql_server:sql_port
#
bayes_sql_username sa_user
bayes_sql_password <my password>
#
# Override the username used for storing
# data in the database. This could be used to group users together to
# share bayesian filter data. You can also use this config option to
# trick sa-learn to learn data as a specific user.
#
#bayes_sql_override_username vmail

On 13/01/2018 10:51, Antony Stone wrote:
> On Saturday 13 January 2018 at 09:35:47, Matthew Broadhead wrote:
>
>> i am using CentOS 7, spamassassin-3.4.0-2.el7.x86_64,
>> postfix-2.10.1-6.el7.x86_64, with amavisd.
>>
>> i set my local.cf to use MySQL as a bayes store and it seems to work
>> fine setting ham and spam in the database when a message is flagged.
>> however it has had no impact on spam received to the inboxes. we are
>> still receiving a large amount of junk email.
> What do you expect to happen to spam instead of it being delivered to inboxes?
>
>> i originally installed spamassassin according to this guide
>> http://forums.sentora.org/showthread.php?tid=1118 and it does indeed
>> filter the test message so it should be working ok?
> That set of steps is designed to do is to change the subject line of spam
> emails to contain (it's not clear to me whether it then becomes the only
> content, or whether the original content is also retained) the phrase
> "***SPAM***"
>
> Are the spam emails which are still arriving in your inbox/es labelled in this
> way? If they are, then what you have installed is working as expected.
>
> Also, you say you "originally installed spamassassin according to that guide"
> - what have you changed since then? How does your current setup differ from
> what those steps create?
>
>
> Antony.
>
Re: moving spam to junk folder [ In reply to ]
On 01/15/2018 11:37 AM, Matthew Broadhead wrote:
> thanks for your quick reply.  i expected the spam to be filtered into
> the Junk mailbox on the server I guess.
> i just sent a test email with GTUBE subject line and i got this
> Jan 15 17:28:40 ns1 amavis[23493]: (23493-20) Blocked SPAM
> {DiscardedInbound,Quarantined}, [74.125.82.46]:39246 [74.125.82.46]
> <nbmlaw@gmail.com> -> <matthew.broadhead@nbmlaw.co.uk>, Queue-ID:
> 2B73F2C26FD, Message-ID:
> <CAMu-6rBEGJHaByMZ=NY-qVY5199ko7XS==rr3Szqtc8bK+WH6A@mail.gmail.com>,
> mail_id: oRq2de4T0Gvi, Hits: 997.982, size: 3387,
> dkim_sd=20161025:gmail.com, 7408 ms
> so does that mean amavis is discarding the spams or only above a certain
> hits?
>
> this is the local.cf after configuring the bayes:
> # These values can be overridden by editing ~/.spamassassin/user_prefs.cf
> # (see spamassassin(1) for details)
>
> # These should be safe assumptions and allow for simple visual sifting
> # without risking lost emails.
>
> required_hits 5
> report_safe 0
> rewrite_header Subject [SPAM]
>
> use_bayes          1
> bayes_auto_learn   1
> bayes_auto_expire  1
>
> # Store bayesian data in MySQL
> bayes_store_module Mail::SpamAssassin::BayesStore::MySQL
> bayes_sql_dsn      DBI:mysql:sa_bayes:localhost:3306
>
> # Store bayesian data in MySQL
> #bayes_store_module Mail::SpamAssassin::BayesStore::PgSQL
> #bayes_sql_dsn      DBI:Pg:database:sql_server:sql_port
> #
> bayes_sql_username sa_user
> bayes_sql_password <my password>
> #
> # Override the username used for storing
> # data in the database. This could be used to group users together to
> # share bayesian filter data. You can also use this config option to
> # trick sa-learn to learn data as a specific user.
> #
> #bayes_sql_override_username vmail
>
> On 13/01/2018 10:51, Antony Stone wrote:
>> On Saturday 13 January 2018 at 09:35:47, Matthew Broadhead wrote:
>>
>>> i am using CentOS 7, spamassassin-3.4.0-2.el7.x86_64,
>>> postfix-2.10.1-6.el7.x86_64, with amavisd.
>>>
>>> i set my local.cf to use MySQL as a bayes store and it seems to work
>>> fine setting ham and spam in the database when a message is flagged.
>>> however it has had no impact on spam received to the inboxes.  we are
>>> still receiving a large amount of junk email.
>> What do you expect to happen to spam instead of it being delivered to
>> inboxes?
>>
>>> i originally installed spamassassin according to this guide
>>> http://forums.sentora.org/showthread.php?tid=1118  and it does indeed
>>> filter the test message so it should be working ok?
>> That set of steps is designed to do is to change the subject line of spam
>> emails to contain (it's not clear to me whether it then becomes the only
>> content, or whether the original content is also retained) the phrase
>> "***SPAM***"
>>
>> Are the spam emails which are still arriving in your inbox/es labelled
>> in this
>> way?  If they are, then what you have installed is working as expected.
>>
>> Also, you say you "originally installed spamassassin according to that
>> guide"
>> - what have you changed since then?  How does your current setup
>> differ from
>> what those steps create?
>>
>>
>> Antony.
>>
>

Amavis will be calling SpamAssassin on it's own most likely as a milter
inside Postfix. You shouldn't need any other SA integration in the
master.cf so make sure you only have SA being called once in amavis then
look at the /etc/amavisd/amavis.conf (most likely location but could be
somewhere else depending on how you installed it) for the SA-related
settings.

Once Amavis is done with the message and it passes clean, there will be
an MDA like dovecot that will be responsible for moving the message into
the Junk/Spam folder.

Try setting up a quick test VM with iRedmail (https://iredmail.org) to
see how all of this fits together. It only takes a few minutes to
install iRedMail on a clean VM installation then you have everything
setup properly to see how it should be done.

--
David Jones
Re: moving spam to junk folder [ In reply to ]
On 15.01.18 18:37, Matthew Broadhead wrote:
>thanks for your quick reply.? i expected the spam to be filtered into
>the Junk mailbox on the server I guess.

That's precisely why I was talking about MDA (procmail, maildrop, sieve).

if you use one globally, you can configure it to deliver mail to Junk, if it
matches spam headerd (X-Spam-Flag: YES).

--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I'm not interested in your website anymore.
If you need cookies, bake them yourself.
Re: Moving Spam to Junk Folder [ In reply to ]
On Thu, 3 Sep 2020, bobby wrote:

> I am following this tutorial:?https://www.linuxbabe.com/redhat/spamassassin-centos-rhel-block-email-spam.I followed the steps in "Move Spam
> into the Junk Folder".? When I send an email from a blacklisted e-mail address, I get a bounce e-mail?from my e-mail server.? Here is what
> is in my spamass-milter file:
> EXTRA_FLAGS="-m -r 8 -R NO_SPAM -i 127.0.0.1 -g sa-milt -- --max-size=5120000"
> I would prefer it to go into my Junk folder.? How can I make this happen?

Bobby,

You need to read the spamass-milter documentation to understand what those
options are doing.

That "-r 8" tells spamass-milter to return a 'SMIFS_REJECT' status to postfix if
the spam score is over 8. This causes postfix to refuse to accept the message
at all (sort of like when somebody tries to send a message to a bogus
recipient).

So if postfix never lets spam get in the front door it cannot be delivered to
any kind of "Junk Folder"


--
Dave Funk University of Iowa
<dbfunk (at) engineering.uiowa.edu> College of Engineering
319/335-5751 FAX: 319/384-0549 1256 Seamans Center, 103 S Capitol St.
Sys_admin/Postmaster/cell_admin Iowa City, IA 52242-1527
#include <std_disclaimer.h>
Better is not better, 'standard' is better. B{
Re: Moving Spam to Junk Folder [ In reply to ]
On Thu, 3 Sep 2020, David B Funk wrote:

> On Thu, 3 Sep 2020, bobby wrote:
>
>> I am following this
>> tutorial:?https://www.linuxbabe.com/redhat/spamassassin-centos-rhel-block-email-spam.I
>> followed the steps in "Move Spam
>> into the Junk Folder".? When I send an email from a blacklisted e-mail
>> address, I get a bounce e-mail?from my e-mail server.? Here is what
>> is in my spamass-milter file:
>> EXTRA_FLAGS="-m -r 8 -R NO_SPAM -i 127.0.0.1 -g sa-milt --
>> --max-size=5120000"
>> I would prefer it to go into my Junk folder.? How can I make this happen?
>
> Bobby,
>
> You need to read the spamass-milter documentation to understand what those
> options are doing.
>
> That "-r 8" tells spamass-milter to return a 'SMIFS_REJECT' status to postfix
> if the spam score is over 8. This causes postfix to refuse to accept the
> message at all (sort of like when somebody tries to send a message to a bogus
> recipient).
>
> So if postfix never lets spam get in the front door it cannot be delivered to
> any kind of "Junk Folder"

You probably want either the -b or -B option, which allows you to
specify an address that tagged mail gets sent to. It's particularly
useful in combination with the -r option so that you can get a sense
of what's being rejected outright.

--
Public key #7BBC68D9 at | Shane Williams
http://pgp.mit.edu/ | System Admin - UT CompSci
=----------------------------------+-------------------------------
All syllogisms contain three lines | shanew@shanew.net
Therefore this is not a syllogism | www.ischool.utexas.edu/~shanew
Re: Moving Spam to Junk Folder [ In reply to ]
--On Thursday, September 03, 2020 3:03 PM -0400 bobby
<architectofthefuture@gmail.com> wrote:

> I would prefer it to go into my Junk folder. How can I make this happen?

That blog article shows how to do it with Dovecot's lmtp using its
dovecot-pigeon rule system. But it can't put a message in a folder if it
never gets it. Which is why you need to disable the 8 point reject rule in
Postfix while you test your delivery system. (I use 10 points and do it
with Sendmail+MIMEDefang, but will eventually switch to Postfix+MIMEDefang.)