Re: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-27 Thread Mirko Zeibig
On Wed, Nov 26, 2003 at 07:52:17AM -0800, Mitch (WebCob) wrote:
 Not meaning to answer for Troy, but I don't think anything is Wrong with
 this, but it doesn't do what Troy is doing...
 
 He's using localmailfilter as a recpt filter on mail acceptance - he runs
 spamassassin on acceptance (i.e. before delivery) and rejects the mail if it
 scores over X - so he doesn't get a queue full of bounces to bad addresses
 with your message was detected as spam messages... BUT his problem I think
 was that he had to run spamassassin twice - once on recpt and once in
 delivery mode.

I think there is not way out for him, then. As I understand it, localmailfilter
code *is to be* invoked twice:

- firstly as recipientfilter (even before the DATA-Command, so spamassassin
  would be a no-go here as it would only be able to check the MAIL FROM and
  RCPT TO data),

- secondly as smtpfilter, that's the way Troy does it, but without a
  recipientfilter invoked previously exiting with a value of 99 IMHO there is
  no difference between using ~/.mailfilters/smtpfilter and ~/.mailfilter
  directly.

Best Regards
Mirko


---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


RE: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-27 Thread Mitch \(WebCob\)
I think that's what he was doing - exiting 99 when the spam value was  99%.

My ponderance was if there could be a way to reinject this ALREADY processed
message for delivery, and cancel the other message silently. That would
avoid calling it twice. I see his idea having value, as it would be nice to
not even accept certain known spams rather than accepting them, delivering
them, and so on...

I'd be REALLY interested if this could be done globally instead of singly,
and as I was mentioning, I'll work on doing that by adding it to gordon's
valid sender filter perhaps...

What do you think?

m/

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mirko
Zeibig
Sent: Thursday, November 27, 2003 12:06 AM
To: [EMAIL PROTECTED]
Subject: Re: [courier-users] Spamassasin, maildropfilter, and
courier-mta integration


On Wed, Nov 26, 2003 at 07:52:17AM -0800, Mitch (WebCob) wrote:
 Not meaning to answer for Troy, but I don't think anything is Wrong with
 this, but it doesn't do what Troy is doing...

 He's using localmailfilter as a recpt filter on mail acceptance - he runs
 spamassassin on acceptance (i.e. before delivery) and rejects the mail if
it
 scores over X - so he doesn't get a queue full of bounces to bad
addresses
 with your message was detected as spam messages... BUT his problem I
think
 was that he had to run spamassassin twice - once on recpt and once in
 delivery mode.

I think there is not way out for him, then. As I understand it,
localmailfilter
code *is to be* invoked twice:

- firstly as recipientfilter (even before the DATA-Command, so spamassassin
  would be a no-go here as it would only be able to check the MAIL FROM and
  RCPT TO data),

- secondly as smtpfilter, that's the way Troy does it, but without a
  recipientfilter invoked previously exiting with a value of 99 IMHO there
is
  no difference between using ~/.mailfilters/smtpfilter and ~/.mailfilter
  directly.

Best Regards
Mirko


---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users



---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-26 Thread Mirko Zeibig
[Troy and Mitch were discussing usage of maildroprcs and .mailfilter with includes
maildroprcs ...]

Pardon me, what's wrong using just a /etc/courier/maildroprc like this:
--- snip ---
[EMAIL PROTECTED] mirko]$ cat /etc/courier/maildroprc
import SENDER
import RECIPIENT
import HOME
import USER
PATH=/bin:/usr/bin:/usr/local/bin:/usr/lib/courier/bin/
INBOX=Maildir/
DEFAULT=$INBOX
SPAMFLD=$INBOX.Trash/
SHELL=/bin/ash

xfilter reformail -A 'X-Maildrop-HOME: $HOME' -A 'X-Maildrop-SENDER: $SENDER'
-A 'X-Maildrop-RECIPIENT: $RECIPIENT' -A 'X-Maildrop-USER: $USER'

# create some needed directories
`test -d $SPAMFLD`
if( $RETURNCODE == 1 )
{
  `maildirmake $SPAMFLD`
}

# filter message
if ( $SIZE  512000 )
{
xfilter /usr/bin/spamc -U /var/run/spamassassin.sock -u $USER
}

if ( /^X-Spam-Status: Yes,/ )
{
  DEFAULT=$SPAMFLD
}
--- snap ---

The trick is to supply a value for SHELL, otherwise this snippet will not work.
I use ash because it is much smaller than bash and starts much faster:

--- snip ---
[EMAIL PROTECTED] mirko]$ ash
$ ps u
USER   PID %CPU %MEM   VSZ  RSS TTY  STAT START   TIME COMMAND
mirko26397  2.4  0.7  4896 1940 pts/6S13:45   0:00 /bin/bash
mirko26443  0.0  0.1  1448  436 pts/6S13:45   0:00 ash
mirko26444  0.0  0.2  2632  688 pts/6R13:45   0:00 ps u
[EMAIL PROTECTED] mirko]$ time bash ls
ls: /bin/ls: cannot execute binary file

real0m0.044s
user0m0.010s
sys 0m0.030s
[EMAIL PROTECTED] mirko]$ time ash ls
ash: Can't open ls

real0m0.005s
user0m0.000s
sys 0m0.000s
[EMAIL PROTECTED] mirko]$ 
--- snap ---

For interactive usage I wouldn't recommand ash, as it does not offer bash's
whistles and bells (no completions, no history, no startup files), but for
simple scripts running often it's just perfect.

I am running spamd with the following options:

[EMAIL PROTECTED] mirko]$ cat /etc/sysconfig/spamassassin
# Options to spamd
SPAMDOPTIONS=-d -c -a -x -u vmail --virtual-config-dir=/home/vmail/domains/%d/%l 
--socketpath=/var/run/spamassassin.sock

as I do not deliver mail locally, using userdb to administer my virtual
domains.

You need spamassassin = 2.6 to use the virtual-config-dir option like above.

Regards
Mirko


---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


RE: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-26 Thread Mitch \(WebCob\)
Not meaning to answer for Troy, but I don't think anything is Wrong with
this, but it doesn't do what Troy is doing...

He's using localmailfilter as a recpt filter on mail acceptance - he runs
spamassassin on acceptance (i.e. before delivery) and rejects the mail if it
scores over X - so he doesn't get a queue full of bounces to bad addresses
with your message was detected as spam messages... BUT his problem I think
was that he had to run spamassassin twice - once on recpt and once in
delivery mode.

My problem was how to take his localfilter idea and apply it to mail in a
global location as I use DB storage of user preferences  I think I'll do
that by hacking gordon messmers filter to call spamc - just my current
idea - not tried it yet.

Thanks for the tip on ash.

that seems to make a big difference.

m/

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Mirko
Zeibig
Sent: Wednesday, November 26, 2003 4:55 AM
To: [EMAIL PROTECTED]
Subject: Re: [courier-users] Spamassasin, maildropfilter, and
courier-mta integration


[Troy and Mitch were discussing usage of maildroprcs and .mailfilter with
includes
maildroprcs ...]

Pardon me, what's wrong using just a /etc/courier/maildroprc like this:
--- snip ---
[EMAIL PROTECTED] mirko]$ cat /etc/courier/maildroprc
import SENDER
import RECIPIENT
import HOME
import USER
PATH=/bin:/usr/bin:/usr/local/bin:/usr/lib/courier/bin/
INBOX=Maildir/
DEFAULT=$INBOX
SPAMFLD=$INBOX.Trash/
SHELL=/bin/ash

xfilter reformail -A 'X-Maildrop-HOME: $HOME' -A 'X-Maildrop-SENDER:
$SENDER'
-A 'X-Maildrop-RECIPIENT: $RECIPIENT' -A 'X-Maildrop-USER: $USER'

# create some needed directories
`test -d $SPAMFLD`
if( $RETURNCODE == 1 )
{
  `maildirmake $SPAMFLD`
}

# filter message
if ( $SIZE  512000 )
{
xfilter /usr/bin/spamc -U /var/run/spamassassin.sock -u $USER
}

if ( /^X-Spam-Status: Yes,/ )
{
  DEFAULT=$SPAMFLD
}
--- snap ---

The trick is to supply a value for SHELL, otherwise this snippet will not
work.
I use ash because it is much smaller than bash and starts much faster:

--- snip ---
[EMAIL PROTECTED] mirko]$ ash
$ ps u
USER   PID %CPU %MEM   VSZ  RSS TTY  STAT START   TIME COMMAND
mirko26397  2.4  0.7  4896 1940 pts/6S13:45   0:00 /bin/bash
mirko26443  0.0  0.1  1448  436 pts/6S13:45   0:00 ash
mirko26444  0.0  0.2  2632  688 pts/6R13:45   0:00 ps u
[EMAIL PROTECTED] mirko]$ time bash ls
ls: /bin/ls: cannot execute binary file

real0m0.044s
user0m0.010s
sys 0m0.030s
[EMAIL PROTECTED] mirko]$ time ash ls
ash: Can't open ls

real0m0.005s
user0m0.000s
sys 0m0.000s
[EMAIL PROTECTED] mirko]$
--- snap ---

For interactive usage I wouldn't recommand ash, as it does not offer bash's
whistles and bells (no completions, no history, no startup files), but for
simple scripts running often it's just perfect.

I am running spamd with the following options:

[EMAIL PROTECTED] mirko]$ cat /etc/sysconfig/spamassassin
# Options to spamd
SPAMDOPTIONS=-d -c -a -x -u
vmail --virtual-config-dir=/home/vmail/domains/%d/%l --socketpath=/var/run/s
pamassassin.sock

as I do not deliver mail locally, using userdb to administer my virtual
domains.

You need spamassassin = 2.6 to use the virtual-config-dir option like
above.

Regards
Mirko


---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users



---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-25 Thread Troy Benjegerdes
Documentation is occasionally hard to find..

This is useing the embedded mode of maildrop.

http://www.courier-mta.org/localmailfilter.html


You also need to have a '/etc/courier/maildropfilter' file with the
location of your version of maildrop.

On Mon, Nov 24, 2003 at 11:40:15AM -0800, Mitch (WebCob) wrote:
 Hey Troy - this is the first time I've heard of .mailfilters/smtpfilter?
 
 Where did you see that in the manual / can you point me to how to do that?
 
 Thanks!
 
 m/
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Troy
 Benjegerdes
 Sent: Sunday, November 23, 2003 9:43 PM
 To: [EMAIL PROTECTED]
 Subject: [courier-users] Spamassasin, maildropfilter, and courier-mta
 integration
 
 
 I'd like to have maildropfilter call spamassassin to reject spam, based
 on individual user prefs before accepting messages for delivery.
 
 I've got this working, however to get the spamassasin headers in my
 message, I seem to need to call it twice.. once in
 .mailfilters/smtpfilter and also in .mailfilter
 
 Is this really the only way to accomplish what I want, or is there some
 better way with couriermailfilter, etc?  (also, any comments on the
 relative merits/dismerits of useing spamc/spamd?)
 
 Thanks.


---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


RE: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-25 Thread Mitch \(WebCob\)
In that case, then I know the answer to your question.

The reason you have to run the spamassassin twice, is because the output of
this first run is never used...

I think this gets back to how queue message files are not editable and so
on... the only data used from your first run is the return code to make a
decision, whereas the second run is in delivery mode, and the modified
message is actually used to deliver the message.

I wonder if there is a way to use your smtpfilter to silently mark the
message as delivered and handle it directly, but that might break delivery
to bcc, cc, etc. addresses.

Does that explain it for you or confuse you further? Regardless, I think
your bounce trick is a nice one.

Do you see a way to run a maildrop filter from a central location on
recept - like maildroprc? I've been moving away from per user config files
to a system based on database lookup and a centralized maildroprc with
conditional code (based on environment variables) - would be nice to do the
same for this type of filtering.

m/

-Original Message-
From: Troy Benjegerdes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 10:46 AM
To: Mitch (WebCob)
Cc: [EMAIL PROTECTED]
Subject: Re: [courier-users] Spamassasin, maildropfilter, and
courier-mta integration


Documentation is occasionally hard to find..

This is useing the embedded mode of maildrop.

http://www.courier-mta.org/localmailfilter.html


You also need to have a '/etc/courier/maildropfilter' file with the
location of your version of maildrop.

On Mon, Nov 24, 2003 at 11:40:15AM -0800, Mitch (WebCob) wrote:
 Hey Troy - this is the first time I've heard of .mailfilters/smtpfilter?

 Where did you see that in the manual / can you point me to how to do that?

 Thanks!

 m/

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Troy
 Benjegerdes
 Sent: Sunday, November 23, 2003 9:43 PM
 To: [EMAIL PROTECTED]
 Subject: [courier-users] Spamassasin, maildropfilter, and courier-mta
 integration


 I'd like to have maildropfilter call spamassassin to reject spam, based
 on individual user prefs before accepting messages for delivery.

 I've got this working, however to get the spamassasin headers in my
 message, I seem to need to call it twice.. once in
 .mailfilters/smtpfilter and also in .mailfilter

 Is this really the only way to accomplish what I want, or is there some
 better way with couriermailfilter, etc?  (also, any comments on the
 relative merits/dismerits of useing spamc/spamd?)

 Thanks.



---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-25 Thread Troy Benjegerdes
On Tue, Nov 25, 2003 at 10:56:51AM -0800, Mitch (WebCob) wrote:
 In that case, then I know the answer to your question.
 
 The reason you have to run the spamassassin twice, is because the output of
 this first run is never used...
 
 I think this gets back to how queue message files are not editable and so
 on... the only data used from your first run is the return code to make a
 decision, whereas the second run is in delivery mode, and the modified
 message is actually used to deliver the message.
 
 I wonder if there is a way to use your smtpfilter to silently mark the
 message as delivered and handle it directly, but that might break delivery
 to bcc, cc, etc. addresses.
 
 Does that explain it for you or confuse you further? Regardless, I think
 your bounce trick is a nice one.

Yeah, I understand what's going on.. but I'm thinking there isn't a good
way around it unless the architecture of courier somehow changes. In
that case, I'll settle for running it twice.

 Do you see a way to run a maildrop filter from a central location on
 recept - like maildroprc? I've been moving away from per user config files
 to a system based on database lookup and a centralized maildroprc with
 conditional code (based on environment variables) - would be nice to do the
 same for this type of filtering.
 
 m/
 

Hrrm. Part of my rationale for doing this is that filters for a
particular user are based on that users's spamassassin prefs, as well as
looking at that users's spamassassin bayesian filtering databases.

I don't see a good way to do that with a global maildroprc.

The idea here is to provide the end-user with complete control over what
gets rejected or not, and per-user whitelists, etc. And since whether a
message gets rejected or not is per-user, it will cause spammers sending
to a bunch of addressess on my server a bunch of grief with various
users rejecting the message.

Hopefully there aren't any land-mines lurking in this idea I haven't
thought of ;)


-- 
--
Troy Benjegerdes'da hozer'[EMAIL PROTECTED]   

Somone asked my why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:

Why do musicians compose symphonies and poets write poems? They do it
because life wouldn't have any meaning for them if they didn't. That's why
I draw cartoons. It's my life. -- Charles Shultz


---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


RE: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-25 Thread Mitch \(WebCob\)


-Original Message-
From: Troy Benjegerdes [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 11:57 AM
To: Mitch (WebCob)
Cc: [EMAIL PROTECTED]
Subject: Re: [courier-users] Spamassasin, maildropfilter, and
courier-mta integration

 Yeah, I understand what's going on.. but I'm thinking there isn't a good
 way around it unless the architecture of courier somehow changes. In
 that case, I'll settle for running it twice.

Yeah - there have been a few people after something like this... it makes a
lot of things easier - like your current problem, tagging outbound mail with
a footer, defanging mime attachments, etc.

Hrrm. Part of my rationale for doing this is that filters for a
particular user are based on that users's spamassassin prefs, as well as
looking at that users's spamassassin bayesian filtering databases.

I don't see a good way to do that with a global maildroprc.

The idea here is to provide the end-user with complete control over what
gets rejected or not, and per-user whitelists, etc. And since whether a
message gets rejected or not is per-user, it will cause spammers sending
to a bunch of addressess on my server a bunch of grief with various
users rejecting the message.

Hopefully there aren't any land-mines lurking in this idea I haven't
thought of ;)

SpamAssassin can run user prefs from a database. Then, there is no need for
per user files - at least not for me, so I'd still like to know if you can
think of a way to call your rcpt filter from a global place...

All my user preferences - including whitelists, and so on are done this
way - only easy way to keep things in sync with our systems - thanks.

m/



---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] Spamassasin, maildropfilter, and courier-mta integration

2003-11-25 Thread Troy Benjegerdes
  Yeah, I understand what's going on.. but I'm thinking there isn't a good
  way around it unless the architecture of courier somehow changes. In
  that case, I'll settle for running it twice.
 
 Yeah - there have been a few people after something like this... it makes a
 lot of things easier - like your current problem, tagging outbound mail with
 a footer, defanging mime attachments, etc.
 
 Hrrm. Part of my rationale for doing this is that filters for a
 particular user are based on that users's spamassassin prefs, as well as
 looking at that users's spamassassin bayesian filtering databases.
 
 I don't see a good way to do that with a global maildroprc.
 
 The idea here is to provide the end-user with complete control over what
 gets rejected or not, and per-user whitelists, etc. And since whether a
 message gets rejected or not is per-user, it will cause spammers sending
 to a bunch of addressess on my server a bunch of grief with various
 users rejecting the message.
 
 Hopefully there aren't any land-mines lurking in this idea I haven't
 thought of ;)
 
 SpamAssassin can run user prefs from a database. Then, there is no need for
 per user files - at least not for me, so I'd still like to know if you can
 think of a way to call your rcpt filter from a global place...
 
 All my user preferences - including whitelists, and so on are done this
 way - only easy way to keep things in sync with our systems - thanks.
 
 m/

Ahh, which leads into my next trick.. get this all running securely and
safely on a scalable, distributed filesystem such as AFS. (yes, there
are some patches that need to be made, particularly to maildrop)

I *think* you can call the rcptfilter from a global place.. there may be
some obscure maildrop options/files I haven't looked at.

FYI, after getting this system set up and running on my home server, and
upgrading to spamassasin 2.6, my spam load seems to have gone way down.

-- 
--
Troy Benjegerdes'da hozer'[EMAIL PROTECTED]   

Somone asked my why I work on this free (http://www.fsf.org/philosophy/)
software stuff and not get a real job. Charles Shultz had the best answer:

Why do musicians compose symphonies and poets write poems? They do it
because life wouldn't have any meaning for them if they didn't. That's why
I draw cartoons. It's my life. -- Charles Shultz


---
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
___
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users