You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Charles Gregory <cg...@hwcn.org> on 2010/07/09 18:49:37 UTC

Re: Move SPAM to directory and notify user

On Fri, 9 Jul 2010, Jose Luis Marin Perez wrote:
> In a CentOS 4.7 server I installed qmail + simscan + ClamAV + Spamassassin
> 3.3.0 that is working properly.
> Now my intention is that when a mail is considered SPAM this is moved to a
> folder called SPAM and in turn notifies the user (via email) so you can
> review it.
> Is it possible?

If your Spamassassin is properly adding a header showing the Spam 'score' 
as a row of asterisks, then you can check for that header in procmail and 
deliver accordingly. I would suggest, to avoid having a notice for every 
piece of spam, try instead to have a cron job that checks the spam folder 
for *new* mail, once nightly, and sends a single message to the user. Of 
course, if the user is always getting spam, then that notice gets ignored 
pretty quickly, so you may want to decide whether it is worth the trouble.

- C

Re: Move SPAM to directory and notify user

Posted by John Hardin <jh...@impsec.org>.
On Sat, 10 Jul 2010, Michelle Konzack wrote:

> :0
> * ^X-Spam-Level: \*\*\*\*\*
> {
>  DUMMY_EXEC=`rplay /usr/share/sounds/aol/You_Have_New_Spam.wav`
>  :0
>  .Spam/
> }

Heh. If you've implemented Peep (http://peep.sourceforge.net/intro.html) 
you could use these for the pool of random "you've got spam" ambient 
sounds:

http://www.pacdv.com/sounds/fart-sounds.html

-- 
  John Hardin KA7OHZ                    http://www.impsec.org/~jhardin/
  jhardin@impsec.org    FALaholic #11174     pgpk -a jhardin@impsec.org
  key: 0xB8732E79 -- 2D8C 34F4 6411 F507 136C  AF76 D822 E6E6 B873 2E79
-----------------------------------------------------------------------
   Our government wants to do everything it can "for the children,"
   except sparing them crushing tax burdens.
-----------------------------------------------------------------------
  11 days until the 41st anniversary of Apollo 11 landing on the Moon

Re: Move SPAM to directory and notify user

Posted by Michelle Konzack <li...@tamay-dogan.net>.
Hello *

Oh, Entschuldige Karsten für die PM, meine muttrc funktioniert derzeit
nicht wie ich will.  :-/

Am 2010-07-09 19:44:54, hacktest Du folgendes herunter:
> [1] Anyone else have that old AOL commercial in mind, with the female
>     voice announcing an incoming mail? ;)

:0
* ^X-Spam-Level: \*\*\*\*\*
{
  DUMMY_EXEC=`rplay /usr/share/sounds/aol/You_Have_New_Spam.wav`
  :0
  .Spam/
}


Thanks, Greetings and nice Day/Evening
    Michelle Konzack

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems@tdnet France EURL       itsystems@tdnet UG (limited liability)
Owner Michelle Konzack            Owner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz                 Kinzigstraße 17
67100 Strasbourg/France           77694 Kehl/Germany
Tel: +33-6-61925193 mobil         Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/>         <http://www.can4linux.org/>

Jabber linux4michelle@jabber.ccc.de
ICQ    #328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/

Re: Move SPAM to directory and notify user

Posted by David Morton <mo...@dgrmm.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 7/9/10 1:40 PM, Karsten Bräckelmann wrote:
> On Fri, 2010-07-09 at 19:22 +0100, Martin Gregorie wrote:
>> On Fri, 2010-07-09 at 19:44 +0200, Karsten Bräckelmann wrote:
>>
>>> Do rate limit it. Don't generate an annoying "you've got spam" [1]
>>> message for each spam received. That'd be a horribly poor exchange rate.
>> but I got the impression that the OP didn't like the cron job solution.
> 
> Hmm, I got the impression that it just wasn't clear to him, how to use a
> cron job parsing his particular IMAP server local storage per user and
> generating the summary mail.

Of course, I'm biased, but this is one of the things Maia Mailguard does
very well... :)   (well, not in an imap storage, but in the database)

- -- 
David Morton <mo...@dgrmm.net>

Morton Software & Design  http://www.dgrmm.net - Ruby on Rails
                                                 PHP Applications
Maia Mailguard http://www.maiamailguard.com    - Spam management
                                                 for mail servers
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFMN3/mUy30ODPkzl0RAsOYAJ9D7AhFmiqRi0/+rgxRrIEYCLuHbwCfQVku
BT+N830jriAgKFK9zKoWFe8=
=eG0x
-----END PGP SIGNATURE-----

RE: Move SPAM to directory and notify user

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Fri, 2010-07-09 at 19:22 +0100, Martin Gregorie wrote:
> On Fri, 2010-07-09 at 19:44 +0200, Karsten Bräckelmann wrote:
> 
> > Do rate limit it. Don't generate an annoying "you've got spam" [1]
> > message for each spam received. That'd be a horribly poor exchange rate.
> 
> I agree entirely,

Figured you would, Martin, didn't mean to imply otherwise. :)

> but I got the impression that the OP didn't like the cron job solution.

Hmm, I got the impression that it just wasn't clear to him, how to use a
cron job parsing his particular IMAP server local storage per user and
generating the summary mail.

But then again, I am not convinced this actually is about IMAP and not
about a global quarantine. Only the OP can clarify his exact environment
and needs for the question in the first place.


-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


Re: Move SPAM to directory and notify user

Posted by Michelle Konzack <li...@tamay-dogan.net>.
Hello Martin Gregorie,

Am 2010-07-09 19:22:37, hacktest Du folgendes herunter:
> I agree entirely, but I got the impression that the OP didn't like the
> cron job solution. Without the cron job its a bit difficult to tell the
> user about the all the FPs and spam he hasn't seen, and you really need
> to do that if he's to retrieve the one or two messages he actually
> wants.

:0fw
* <256000
| spamc

:0
* ^X-Spam-Level: \*\*\*\*\*
{
  SPAM_COUNT=`ls ${MAILDIR}/.Spam/new/* ${MAILDIR}/.Spam/cur/* |wc -l`
  SPAM_COUNT=`echo $((SPAM_COUNT+1)) ; :`
  :0
  * test ${SPAM_COUNT} -gt 0
  {
    LAST_MSG=`cat ${HOME}/.procmail_spam_last`

    TIME_NOW=`date +%s`
    TIME_NOW=`echo $((TIME_NOW+86400))`

    :0
    * ? test -z "${LAST_MSG}"
    {
       TIME_LAST=`date +%s`
       DUMMY_EXEC=`echo ${TIME_LAST} >${HOME}/.procmail_spam_last`
    }

    :0
    * ? test ${TIME_LAST} -gt ${TIME_NOW}
    {
      DUMMY_EXEC=`echo ${TIME_NOW} >${HOME}/.procmail_spam_last

      MSG_TO=`formail -czX To:`
      MSG_ID=`formail -czX Message-ID:`
      :0fw
      | (formail -I "From: Big Brother <@>" \
                 -I "${MSG_TO}" \
                 -I "Subject: Your spamfolder is filling up. [${SPAM_COUNT}]" \
                 -I "Date: `date --rfc-822`" \
                 -I "${MSG_ID}" ; \
         echo "Hey user," ; \
         echo "check your spamfolder which is" ; \
         echo "filled up with ${SPAM_COUNT} crap messages." )
    }
  }

  :0
  * ^X-Spam-Level:
  .Spam/
}


Thanks, Greetings and nice Day/Evening
    Michelle Konzack

-- 
##################### Debian GNU/Linux Consultant ######################
   Development of Intranet and Embedded Systems with Debian GNU/Linux

itsystems@tdnet France EURL       itsystems@tdnet UG (limited liability)
Owner Michelle Konzack            Owner Michelle Konzack

Apt. 917 (homeoffice)
50, rue de Soultz                 Kinzigstraße 17
67100 Strasbourg/France           77694 Kehl/Germany
Tel: +33-6-61925193 mobil         Tel: +49-177-9351947 mobil
Tel: +33-9-52705884 fix

<http://www.itsystems.tamay-dogan.net/>  <http://www.flexray4linux.org/>
<http://www.debian.tamay-dogan.net/>         <http://www.can4linux.org/>

Jabber linux4michelle@jabber.ccc.de
ICQ    #328449886

Linux-User #280138 with the Linux Counter, http://counter.li.org/

RE: Move SPAM to directory and notify user

Posted by Martin Gregorie <ma...@gregorie.org>.
On Fri, 2010-07-09 at 19:44 +0200, Karsten Bräckelmann wrote:

> Do rate limit it. Don't generate an annoying "you've got spam" [1]
> message for each spam received. That'd be a horribly poor exchange rate.
> 
> 
I agree entirely, but I got the impression that the OP didn't like the
cron job solution. Without the cron job its a bit difficult to tell the
user about the all the FPs and spam he hasn't seen, and you really need
to do that if he's to retrieve the one or two messages he actually
wants.

Me? Since I run Postfix, I'd have modified the pipeline in the service
that runs spamc to:

	spamc | spam_separator | sendmail

and written a cron job that deletes time-expired messages and sends each
user a daily list of spams received since the last run.

If I ran some other MTA without Postfix's custom service concept I'd
have used a procmail-driven script to save the messages as separate
files in directories named for the recipients using the timestamp as the
file name and used the same cron job for spam reporting and expiry.

Of course, as I hinted above, there needs to be some way to retrieve FPs
or spam that the user wants, but that's quite another Perl in the nest
of Pythons.


Martin



RE: Move SPAM to directory and notify user

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Fri, 2010-07-09 at 18:23 +0100, Martin Gregorie wrote:
> On Fri, 2010-07-09 at 12:12 -0500, Jose Luis Marin Perez wrote:
> > Procmail Using this understanding, my question is how to notify the user via
> > email, would read the contents of the SPAM folder? excuse my insistence but
> > I do not understand, I hope you can help me with this.
> 
> Procmail can run a shell script as well as simply dumping or filing the
> message. A shell script should be easily able to do whatever you want
> with the spam message and then call sendmail to send a 'spam received'
> message to the user.

*shudder*  I'm with Charles here. While you're of course perfectly
correct...

Do rate limit it. Don't generate an annoying "you've got spam" [1]
message for each spam received. That'd be a horribly poor exchange rate.

Where's the advantage, if instead of deleting a spam in my Inbox, I have
to delete a spam announcing message in my Inbox -- plus chasing the spam
folder, to actually delete the spam, too.


[1] Anyone else have that old AOL commercial in mind, with the female
    voice announcing an incoming mail? ;)

-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


RE: Move SPAM to directory and notify user

Posted by Martin Gregorie <ma...@gregorie.org>.
On Fri, 2010-07-09 at 12:12 -0500, Jose Luis Marin Perez wrote:
> Procmail Using this understanding, my question is how to notify the user via
> email, would read the contents of the SPAM folder? excuse my insistence but
> I do not understand, I hope you can help me with this.
> 
Procmail can run a shell script as well as simply dumping or filing the
message. A shell script should be easily able to do whatever you want
with the spam message and then call sendmail to send a 'spam received'
message to the user.


Martin



RE: Move SPAM to directory and notify user

Posted by Karsten Bräckelmann <gu...@rudersport.de>.
On Fri, 2010-07-09 at 12:12 -0500, Jose Luis Marin Perez wrote:
> Procmail Using this understanding, my question is how to notify the user via
> email, would read the contents of the SPAM folder? excuse my insistence but
> I do not understand, I hope you can help me with this.

So you are already using procmail or are ok with that?

This whole thing from the OP on spelled IMAP to me. A dedicated
(per-user) spam folder. With that, why in $diety's name have annoying
"you have spam" messages at all? The MUA just monitors all mail folders,
and "new spam" will be visually indicated by the MUA. No need to drop an
extra mail in the Inbox, stating there is new mail...

Regarding the question, see below.

> > In a CentOS 4.7 server I installed qmail + simscan + ClamAV + Spamassassin
> > 3.3.0 that is working properly.
> > Now my intention is that when a mail is considered SPAM this is moved to a
> > folder called SPAM and in turn notifies the user (via email) so you can
> > review it.
> 
> If your Spamassassin is properly adding a header showing the Spam 'score' 
> as a row of asterisks, then you can check for that header in procmail and 
> deliver accordingly. I would suggest, to avoid having a notice for every 
> piece of spam, try instead to have a cron job that checks the spam folder 
                                       ^^^^^^^^^^^^^^^^^^^^
The answer was already given. How exactly the cron job performs the
check, depends on your IMAP server and the local storage used.

IFF one really needs such a notice. I am sure your users won't want
them.

> for *new* mail, once nightly, and sends a single message to the user. Of 
> course, if the user is always getting spam, then that notice gets ignored 
> pretty quickly, so you may want to decide whether it is worth the trouble.

FWIW, if you actually mean a single, *global* spam folder, aka
quarantine, rather than per-user folders to drop spam, the solution is
outside the scope of SA. The above pretty much already is...


-- 
char *t="\10pse\0r\0dtu\0.@ghno\x4e\xc8\x79\xf4\xab\x51\x8a\x10\xf4\xf4\xc4";
main(){ char h,m=h=*t++,*x=t+2*h,c,i,l=*x,s=0; for (i=0;i<l;i++){ i%8? c<<=1:
(c=*++x); c&128 && (s+=h); if (!(h>>=1)||!t[s+h]){ putchar(t[s]);h=m;s=0; }}}


RE: Move SPAM to directory and notify user

Posted by Jose Luis Marin Perez <jm...@isp.qnet.com.pe>.
Procmail Using this understanding, my question is how to notify the user via
email, would read the contents of the SPAM folder? excuse my insistence but
I do not understand, I hope you can help me with this.

José Luis 


-----Mensaje original-----
De: Charles Gregory [mailto:cgregory@hwcn.org] 
Enviado el: Viernes, 09 de Julio de 2010 11:50 a.m.
Para: users@spamassassin.apache.org
Asunto: Re: Move SPAM to directory and notify user

On Fri, 9 Jul 2010, Jose Luis Marin Perez wrote:
> In a CentOS 4.7 server I installed qmail + simscan + ClamAV + Spamassassin
> 3.3.0 that is working properly.
> Now my intention is that when a mail is considered SPAM this is moved to a
> folder called SPAM and in turn notifies the user (via email) so you can
> review it.
> Is it possible?

If your Spamassassin is properly adding a header showing the Spam 'score' 
as a row of asterisks, then you can check for that header in procmail and 
deliver accordingly. I would suggest, to avoid having a notice for every 
piece of spam, try instead to have a cron job that checks the spam folder 
for *new* mail, once nightly, and sends a single message to the user. Of 
course, if the user is always getting spam, then that notice gets ignored 
pretty quickly, so you may want to decide whether it is worth the trouble.

- C