Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-27 Thread Jérôme MOLLIER-PIERRET


Rick

Inserting maildrop into .qmail-default is a fine implementation solution 
 but this patch provide thoses advantages :


- Maildrop handle correctly the maildir quota (and in you mailfilter 
sample you should handle the exit codde 77).  But for example, this 
configuration will nevers bounce the quota-warn and over-quota message ...


- Imagine you use and admin tool like qmailadmin, you'll have to patch 
it to modify permanently the behavior of .qmail-default of the domain.


This patch let you use you mailfterfile in very simple way handling all 
specific case maildrop do, and the implementation is in our mind 
cleanest ... for many raison.


Hoping this feature help.

Regards,

Jerome MOLLIER-PIERRET

Rick Romero a écrit :

On Thu, 2006-10-26 at 12:39 -0400, John Simpson wrote:

On 2006-10-26, at 0359, Jérôme MOLLIER-PIERRET wrote:

John Simpson a écrit :
also, what if a user (i.e. the owner of one specific mailbox)  
wants to create their own .mailfilter file, either directly or  
using some kind of web interface which gives them a set of options  
and writes a .mailfilter file based on their choices? i would  
search for /home/vpopmail/domains/.mailfilter-userid before the  
file names you're already checking for.
This case is not implemented in the patch, and therefore because it  
is not simple to handle .qmail-* style for maildrop. But it  
should be very easy to do this in maildrop style in the main or  
referal .mailfilter file.


For the web interface, i agree ... it would be very nice. But there  
is lot of job to do before :)))
that's what i was thinking- at some point in the future, somebody  
(maybe myself, if i ever get some free time) (yeah, right) will want  
to write a web interface which gives individual mailbox owners the  
ability to either edit their own .mailfilter file, or choose from a  
list of options which will cause the web back-end to create or modify  
a per-mailbox .mailfilter file, maybe using some kind of templates to  
support each available option.


Horde has a module that allows for mailfiler file modification, but I
haven't looked into it.  It uses FTP to put it in the user's mailbox.
Also, There's an FTP Server called Pure-FTPd that can auth against
MySQL, and use that home folder as the user's FTP folder (this I've used
to give my mail users an FTP option) - so something is out there to
implement.  I just don't trust my users with, IMHO essentially, shell
access.

i just don't like seeing patches which lock out future possibilities.  
flexibility is a good thing.


other than that, your patch looks like a good idea.


I don't know what everyone else is doing, but my .qmail-default looks
like this:
|maildrop  /home/vpopmail/domains/havokmon.com/mailfilter
| /usr/home/vpopmail/bin/vdelivermail
'' /usr/home/vpopmail/domains/havokmon.com/rick

And my mailfiler is essentially:
SHELL=/bin/sh
VHOME=`/usr/local/vpopmail/bin/vuserinfo -d [EMAIL PROTECTED]

if (/^X-Spam-Status: Yes*/)
{

 # Delete messages with a score of 10 or higher, filter all other
# spam messages into a spam folder
/^X-Spam-Status: yes, (hits|score)=![:digit:]+\.[:digit:]+!.*/
if ( $MATCH2 = 10.0 )
{
exception {
 EXITCODE = 99
 to  /dev/null
 exit
}
}
else
{

# then try delivering it to a Spam folder
exception {
  EXITCODE = 99
  to $VHOME/Maildir/.Spam/
  exit
}
}
}
exit


I forget exactly what option does it - it's either the EXITCODE with
exit, and or the exception{} blocks, but my .qmail-default is processeed
entirely.  


It took a bit of searching to get that to work - it was a few years
ago...

Rick




Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-27 Thread Rick Romero
On Fri, 2006-10-27 at 09:42 +0200, Jérôme MOLLIER-PIERRET wrote:
 Rick
 
 Inserting maildrop into .qmail-default is a fine implementation solution 
   but this patch provide thoses advantages :
 
 - Maildrop handle correctly the maildir quota (and in you mailfilter 
 sample you should handle the exit codde 77).  But for example, this 
 configuration will nevers bounce the quota-warn and over-quota message ...
 
 - Imagine you use and admin tool like qmailadmin, you'll have to patch 
 it to modify permanently the behavior of .qmail-default of the domain.

Ahhh That's what I was missing - I wasn't sure what wasn't covered by
what I was doing.  Thanks. :)

Rick




Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-26 Thread Jérôme MOLLIER-PIERRET




John Simpson a écrit :

what if there happens to be a mailbox with the name mailfilter? (yes, 
it's a rather contrived example, but you see some really weird stuff 
when you run an ISP... as an example, we had one user who ran one of the 
local post offices and wanted postmaster as his userid, the tech 
support guy who took the signup told him he could have it, and i was the 
one who got to call him back and explain why he couldn't have it... i 
ended up telling him it was already used, and that was that. of course 
for the next three weeks i got a series of who are you? emails to the 
postmaster mailbox from this guy...)


instead of using mailfilter, you should probably use .mailfilter as 
the filename. names starting with a letter or number should really be 
reserved for mailbox names.


Yes your remark is good, just have to sed mailfilter by .mailfilter ... 
in the patch file.




also, what if a user (i.e. the owner of one specific mailbox) wants to 
create their own .mailfilter file, either directly or using some kind of 
web interface which gives them a set of options and writes a .mailfilter 
file based on their choices? i would search for 
/home/vpopmail/domains/.mailfilter-userid before the file names you're 
already checking for.


This case is not implemented in the patch, and therefore because it is 
not simple to handle .qmail-* style for maildrop.
But it should be very easy to do this in maildrop style in the main or 
referal .mailfilter file.


For the web interface, i agree ... it would be very nice. But there is 
lot of job to do before :)))



Jérôme MOLLIER-PIERRET


Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-26 Thread Jérôme MOLLIER-PIERRET




On Oct 25, 2006, at 8:52 AM, Jérôme MOLLIER-PIERRET wrote:

You'll find our patch below, if it can help someone ...


I'll put it in my personal patch queue for inclusion in a future release 
of vpopmail, but since I don't use maildrop, I may not include it unless 
others tell me it's worth adding.


Let us know, but if you add this to future realease it would be nice to 
include IFDEF header to activate or not this feature in the configure...




Please upload it to SourceForge http://vpopmail.sf.net/ so there's a 
permanent record of it out there, and someone searching for that 
functionality can use your patch until it's added to the release 
versions of vpopmail.


I'll post it today.

Regards,

Jérôme.


Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-26 Thread John Simpson

On 2006-10-26, at 0359, Jérôme MOLLIER-PIERRET wrote:

John Simpson a écrit :


also, what if a user (i.e. the owner of one specific mailbox)  
wants to create their own .mailfilter file, either directly or  
using some kind of web interface which gives them a set of options  
and writes a .mailfilter file based on their choices? i would  
search for /home/vpopmail/domains/.mailfilter-userid before the  
file names you're already checking for.


This case is not implemented in the patch, and therefore because it  
is not simple to handle .qmail-* style for maildrop. But it  
should be very easy to do this in maildrop style in the main or  
referal .mailfilter file.


For the web interface, i agree ... it would be very nice. But there  
is lot of job to do before :)))


that's what i was thinking- at some point in the future, somebody  
(maybe myself, if i ever get some free time) (yeah, right) will want  
to write a web interface which gives individual mailbox owners the  
ability to either edit their own .mailfilter file, or choose from a  
list of options which will cause the web back-end to create or modify  
a per-mailbox .mailfilter file, maybe using some kind of templates to  
support each available option.


i just don't like seeing patches which lock out future possibilities.  
flexibility is a good thing.


other than that, your patch looks like a good idea.

--
| John M. Simpson - KG4ZOW - Programmer At Large |
| http://www.jms1.net/   [EMAIL PROTECTED] |
--
| Mac OS X proves that it's easier to make UNIX  |
| pretty than it is to make Windows secure.  |
--




PGP.sig
Description: This is a digitally signed message part


Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-26 Thread John Simpson

On 2006-10-26, at 1251, Rick Romero wrote:


I don't know what everyone else is doing, but my .qmail-default looks
like this:
|maildrop  /home/vpopmail/domains/havokmon.com/mailfilter
| /usr/home/vpopmail/bin/vdelivermail
'' /usr/home/vpopmail/domains/havokmon.com/rick

And my mailfiler is essentially:
...
 # Delete messages with a score of 10 or higher, filter all other
# spam messages into a spam folder
/^X-Spam-Status: yes, (hits|score)=![:digit:]+\.[:digit:]+!.*/
if ( $MATCH2 = 10.0 )
{
exception {
 EXITCODE = 99
 to  /dev/null


it's been my experience that this line is not necessary, just setting  
EXITCODE=99 and then exit is enough to cause the message to NOT be  
delivered anywhere.



I forget exactly what option does it - it's either the EXITCODE with
exit, and or the exception{} blocks, but my .qmail-default is  
processeed

entirely.


setting EXITCODE to 99 tells qmail-local (which is what actually  
reads the .qmail file) that the delivery is done, it was  
successful, and it should stop processing the .qmail file (i.e. don't  
go on to the next line.) the exit codes are documented in man qmail- 
command.


--
| John M. Simpson - KG4ZOW - Programmer At Large |
| http://www.jms1.net/   [EMAIL PROTECTED] |
--
| Mac OS X proves that it's easier to make UNIX  |
| pretty than it is to make Windows secure.  |
--




PGP.sig
Description: This is a digitally signed message part


Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-26 Thread Christopher Chan


that's what i was thinking- at some point in the future, somebody (maybe 
myself, if i ever get some free time) (yeah, right) will want to write a 
web interface which gives individual mailbox owners the ability to 
either edit their own .mailfilter file, or choose from a list of options 
which will cause the web back-end to create or modify a per-mailbox 
.mailfilter file, maybe using some kind of templates to support each 
available option.


sqwebmail provides some ability to generate .mailfilter files although 
the interface isn't the greatest.


There is also a module for squirrelmail too that generates .mailfilter 
files. However I had to make some changes before it would work properly.


[vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-25 Thread Jérôme MOLLIER-PIERRET


Dear list,

We were looking over internet for someone who patched vdelivermail in 
order to call maildrop in the delivery process for filtering purpose.


This kind of implementation using maildrop for filtering seems to be the 
cleanest way for us in our mind, because we do not have to change 
.qmail-default behavior in many ways (ie because of other qmail tools 
like qmailadmin…).
And therefore, using vdelivermail make us sure to do many more check 
regarding vpopmail, like for sample ‘bouncing over-quota mails over full 
mailboxes’ and reading dot qmail files.


We founded a patch located here : 
http://katastrophos.net/andre/blog/2006/10/03/vpopmail-maildrop-sqwebmail-mailfilter-patch/

but after many check and test this was not as clean as we wanted.

So we rewritted a patch from scratch, witch is working fine in ours  tests …

in synthesis :

This patch keep the behavior of vdelivermail on all delivering cases 
(like bouncing, deferals …). This is particularly important on the way 
that vdelivermail handle quota, and the users notifications.


It also has the granularity of a using a mailfilter configuration file 
for domains (ie /home/vpopmail/domains/onedomain/mailfilter), all 
domains (ie /home/vpopmail/domains/mailfilter) … and indeed a default 
one in /etc/mailfilter.

If no mailfilter file is present, vdelivermail act as it does naturally.

You'll find our patch below, if it can help someone ...

Any feedback would be cool :)

Regards,

--- vpopmail-5.4.17/vdelivermail.c  2006-06-29 21:36:43.0 +0200
+++ vpopmail-5.4.17.patchmaildrop_actinux/vdelivermail.c	2006-10-25 
16:59:17.0 +0200

@@ -22,6 +22,13 @@
  *
  */

+/* Patch insertion for using maildrop delivery program October 2006
+ * by Actinux Team
+ * Jerome MOLLIER-PIERRET [EMAIL PROTECTED],
+ * Brian PASSANTE [EMAIL PROTECTED]
+ *
+ */
+
 /* include files */
 #include unistd.h
 #include stdlib.h
@@ -81,6 +88,9 @@
 /* from qmail's wait.h for run_command() */
 #define wait_exitcode(w) ((w)  8)

+/* Maildrop binary path */
+#define MAILDROP /usr/local/bin/maildrop
+
 /* Forward declarations */
 int process_valias(void);
 void get_arguments(int argc, char **argv);
@@ -93,6 +103,7 @@
 void usernotfound(void);
 int is_loop_match( const char *dt, const char *address);
 int deliver_quota_warning(const char *dir, const char *q);
+int launchmaildrop(void);


 /* print an error string and then exit
@@ -610,7 +621,7 @@
 maildir_to_email(address));
 }

-switch (deliver_to_maildir (address, DeliveredTo, 0, 
message_size)) {

+switch (launchmaildrop()) {
 case -1:
 vexiterr (EXIT_OVERQUOTA, user is over quota);
 break;
@@ -620,6 +631,22 @@
 case -3:
 vexiterr (EXIT_BOUNCE, mail is looping);
 break;
+case -200:
+   /*start the old launch */
+   printf (trying_normal_delivery: );
+   switch (deliver_to_maildir (address, DeliveredTo, 0, 
message_size)) {
+case -1:
+   vexiterr (EXIT_OVERQUOTA, user is over quota);
+   break;
+   case -2:
+   vexiterr (EXIT_DEFER, system error);
+   break;
+   case -3:
+   vexiterr (EXIT_BOUNCE, mail is looping);
+   break;
+   default:
+   return;
+   }
 default:
 return;
 }
@@ -1042,6 +1069,7 @@
 maildir_to_email(newdir), date_header());
 }

+
 err = deliver_to_maildir (dir, DeliveredTo, read_fd, sb.st_size);

 close (read_fd);
@@ -1063,3 +1091,67 @@

 return (strcasecmp (compare, (dt+14)) == 0);
 }
+
+int launchmaildrop(void)
+{
+ char *prog;
+ int child;
+ char *(args[4]);
+ int wstat;
+ char mailfilter_file[256];
+ FILE *fs;
+
+ printf(trying_through_maildrop: );
+
+ sprintf(mailfilter_file, %s/mailfilter,TheDomainDir);
+ if ( (fs=fopen(mailfilter_file, r)) == NULL ) {
+  /* if no mailfilter in domain then check in vpopmail dir */
+  sprintf(mailfilter_file, %s/%s/mailfilter,VPOPMAILDIR,DOMAINS_DIR);
+  if ( (fs=fopen(mailfilter_file, r)) == NULL ) {
+   /* if no mailfilter in vpopmail dir check in /etc/ */
+   sprintf(mailfilter_file, /etc/mailfilter);
+   if ( (fs=fopen(mailfilter_file, r)) == NULL ) {
+   /* no mailfilter file present */
+   printf(Ouups,_no_mailfilter_file: );
+   return -200;
+   }
+  }
+ }
+
+snprintf(prog, AUTH_SIZE, | /usr/bin/env HOME=%s VDOMAINDIR=%s 
VUSERDIR=%s VUSER=%s VDOMAIN=%s preline \%s\ %s, TheDomainDir, 
TheDomainDir, vpw-pw_dir, TheUser, TheDomain, MAILDROP, mailfilter_file);

+
+/*to put maildrop in debug mode uncomment theses line
+snprintf(prog, AUTH_SIZE, | /usr/bin/env HOME=%s VDOMAINDIR=%s 
VUSERDIR=%s VUSER=%s VDOMAIN=%s 

Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-25 Thread Tom Collins

On Oct 25, 2006, at 8:52 AM, Jérôme MOLLIER-PIERRET wrote:

You'll find our patch below, if it can help someone ...


I'll put it in my personal patch queue for inclusion in a future  
release of vpopmail, but since I don't use maildrop, I may not  
include it unless others tell me it's worth adding.


Please upload it to SourceForge http://vpopmail.sf.net/ so there's  
a permanent record of it out there, and someone searching for that  
functionality can use your patch until it's added to the release  
versions of vpopmail.


--
Tom Collins  -  [EMAIL PROTECTED]
Vpopmail - virtual domains for qmail: http://vpopmail.sf.net/
QmailAdmin - web interface for Vpopmail: http://qmailadmin.sf.net/




Re: [vchkpw] vdelivermail patch in order to handle maildrop filtering capabilities

2006-10-25 Thread John Simpson

On 2006-10-25, at 1152, Jérôme MOLLIER-PIERRET wrote:


It also has the granularity of a using a mailfilter configuration  
file for domains (ie /home/vpopmail/domains/onedomain/mailfilter),  
all domains (ie /home/vpopmail/domains/mailfilter) … and indeed a  
default one in /etc/mailfilter.


what if there happens to be a mailbox with the name mailfilter?  
(yes, it's a rather contrived example, but you see some really weird  
stuff when you run an ISP... as an example, we had one user who ran  
one of the local post offices and wanted postmaster as his userid,  
the tech support guy who took the signup told him he could have it,  
and i was the one who got to call him back and explain why he  
couldn't have it... i ended up telling him it was already used, and  
that was that. of course for the next three weeks i got a series of  
who are you? emails to the postmaster mailbox from this guy...)


instead of using mailfilter, you should probably use .mailfilter  
as the filename. names starting with a letter or number should really  
be reserved for mailbox names.


also, what if a user (i.e. the owner of one specific mailbox) wants  
to create their own .mailfilter file, either directly or using some  
kind of web interface which gives them a set of options and writes  
a .mailfilter file based on their choices? i would search for /home/ 
vpopmail/domains/.mailfilter-userid before the file names you're  
already checking for.


--
| John M. Simpson - KG4ZOW - Programmer At Large |
| http://www.jms1.net/   [EMAIL PROTECTED] |
--
| Mac OS X proves that it's easier to make UNIX  |
| pretty than it is to make Windows secure.  |
--




PGP.sig
Description: This is a digitally signed message part