Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-27 Thread Jost Krieger
On Wed 19 Sep 2012 02:52:41 PM GMT, Jost Krieger wrote:
 Oops, that's not what I want!
 
 How about another command line parameter for lda to suppress the
 emergency save? We know exactly when we are trying to save probable
 spam.
 
I've tried my luck. Would the attached patch be sensible and welcome?

Yours
Jost Krieger
-- 
| jost.krieger+...@ruhr-uni-bochum.de  Please help stamp out spam! |
| Postmaster, JAPH, resident answer machineat RUB Comp. Center |
| Sincere words are not sweet, sweet words are not sincere.|
|  Lao Tse, Tao Te King 81 |
diff -r 88a05f387743 doc/man/dovecot-lda.1.in
--- a/doc/man/dovecot-lda.1.in  Thu Sep 27 02:55:14 2012 +0300
+++ b/doc/man/dovecot-lda.1.in  Thu Sep 27 11:04:56 2012 +0200
@@ -5,7 +5,7 @@
 .\
 .SH SYNOPSIS
 .B dovecot\-lda
-.RB [ \-ek ]
+.RB [ \-eEk ]
 [\fB\-a\fP \fIaddress\fP]
 [\fB\-c\fP \fIconfig_file\fP]
 [\fB\-d\fP \fIusername\fP]
@@ -61,6 +61,10 @@
 The default is to send a rejection mail ourself.
 .\-
 .TP
+.B \-E
+If mail delivery fails, don't try to do an emergency delivery attempt to INBOX.
+.\-
+.TP
 .BI \-f\  envelope_sender
 Envelope sender address.
 .\-
diff -r 88a05f387743 src/lda/main.c
--- a/src/lda/main.cThu Sep 27 02:55:14 2012 +0300
+++ b/src/lda/main.cThu Sep 27 11:04:56 2012 +0200
@@ -310,7 +310,7 @@
master_service = master_service_init(lda,
MASTER_SERVICE_FLAG_STANDALONE |
MASTER_SERVICE_FLAG_DONT_LOG_TO_STDERR,
-   argc, argv, a:d:ef:km:p:r:);
+   argc, argv, a:d:eEf:km:p:r:);
 
memset(ctx, 0, sizeof(ctx));
ctx.session = mail_deliver_session_init();
@@ -334,6 +334,9 @@
case 'e':
stderr_rejection = TRUE;
break;
+   case 'E':
+   ctx.suppress_emergency_delivery = TRUE;
+   break;
case 'f':
/* envelope sender address */
ctx.src_envelope_sender =
diff -r 88a05f387743 src/lib-lda/mail-deliver.c
--- a/src/lib-lda/mail-deliver.cThu Sep 27 02:55:14 2012 +0300
+++ b/src/lib-lda/mail-deliver.cThu Sep 27 11:04:56 2012 +0200
@@ -402,7 +402,7 @@
ret = mail_deliver_save(ctx, ctx-dest_mailbox_name, 0, NULL,
storage_r);
}
-   if (ret  0  strcasecmp(ctx-dest_mailbox_name, INBOX) != 0) {
+   if (ret  0  !ctx-suppress_emergency_delivery  
strcasecmp(ctx-dest_mailbox_name, INBOX) != 0) {
/* still didn't work. try once more to save it
   to INBOX. */
ret = mail_deliver_save(ctx, INBOX, 0, NULL, storage_r);
diff -r 88a05f387743 src/lib-lda/mail-deliver.h
--- a/src/lib-lda/mail-deliver.hThu Sep 27 02:55:14 2012 +0300
+++ b/src/lib-lda/mail-deliver.hThu Sep 27 11:04:56 2012 +0200
@@ -49,6 +49,7 @@
struct var_expand_table *var_expand_table;
 
bool tried_default_save;
+   bool suppress_emergency_delivery;
bool saved_mail;
bool save_dest_mail;
/* Delivery failed because user is out of quota / disk space */


Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-19 Thread Jost Krieger
On Tue 18 Sep 2012 07:17:50 PM GMT, Timo Sirainen wrote:
 
 On 18.9.2012, at 14.40, Jost Krieger wrote:
 ...
  The idea is to not eat up the users storage with spam, so that spam
  stays in the queue (for some time) while real mail gets delivered.
 
 Interesting idea. This was pretty easy to fix:
 
 http://hg.dovecot.org/dovecot-2.1/rev/74d639b2a5bf

Thank you!

 Now, the next problem is that if LDA can't save the message to UCE-TMP
 because of quota failure it saves it to INBOX. I'm not really sure how
 that should be fixed, since generally it's a good idea to do it..

Oops, that's not what I want!

How about another command line parameter for lda to suppress the
emergency save? We know exactly when we are trying to save probable
spam.
 
Yours
Jost Krieger
-- 
| jost.krieger+...@ruhr-uni-bochum.de  Please help stamp out spam! |
| Postmaster, JAPH, resident answer machineat RUB Comp. Center |
| Sincere words are not sweet, sweet words are not sincere.|
|  Lao Tse, Tao Te King 81 |


Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-19 Thread Jost Krieger
On Tue 18 Sep 2012 07:47:09 PM GMT, Robert Schetterer wrote:

 some allready existing way is i.e
 with milter and postfix tagged spam get in hold queue for i.e human
 admin investigate, or some quarantaine with amavis

Human admin is not a good idea if you have 5 users :-)
Quarantine's a possibility, but that's taking it out of Mail and adds
complexity.

 for sure there are benefits getting dovecot involved in spam tagging
 but i would leave spam tagging to the mailserver in first way and
 deliver it to Junk folder by global sieve rule with giving more quota or
 ignoring  Quota to Junk folder, but i see this isnt the same what you
 might wanna goal
 
That's just what we want to do, *but* although it's in the Wiki I don't
think it a good idea to *raise* the limit for the junk folder if you
*deliver* to it. It's somewhat ok if you move mail there and someone
picks it up (we do that with a different folder). But on delivery it
means at some point you can receive spam but no real messages. Not nice.

ignore may work if it does what I think (never even count bytes and
messages in this folder) but it is open to abuse ...

Yours
Jost Krieger
-- 
| jost.krieger+...@ruhr-uni-bochum.de  Please help stamp out spam! |
| Postmaster, JAPH, resident answer machineat RUB Comp. Center |
| Sincere words are not sweet, sweet words are not sincere.|
|  Lao Tse, Tao Te King 81 |


Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-19 Thread Robert Schetterer
Am 19.09.2012 14:53, schrieb Jost Krieger:
 On Tue 18 Sep 2012 07:47:09 PM GMT, Robert Schetterer wrote:
 
 some allready existing way is i.e
 with milter and postfix tagged spam get in hold queue for i.e human
 admin investigate, or some quarantaine with amavis
 
 Human admin is not a good idea if you have 5 users :-)
 Quarantine's a possibility, but that's taking it out of Mail and adds
 complexity.


as ever ,this is different in different places
specially Quarantine is wide used

 
 for sure there are benefits getting dovecot involved in spam tagging
 but i would leave spam tagging to the mailserver in first way and
 deliver it to Junk folder by global sieve rule with giving more quota or
 ignoring  Quota to Junk folder, but i see this isnt the same what you
 might wanna goal
  
 That's just what we want to do, *but* although it's in the Wiki I don't
 think it a good idea to *raise* the limit for the junk folder if you
 *deliver* to it. It's somewhat ok if you move mail there and someone
 picks it up (we do that with a different folder). But on delivery it
 means at some point you can receive spam but no real messages. Not nice.
 
 ignore may work if it does what I think (never even count bytes and
 messages in this folder) but it is open to abuse ...

there is no good or evil to this case, its a design question which may
change in different places,, the abuse case might be acceptable, as the
Junk folder i.e is imap special used autoconfigured
and has auto empty feature, i give 50 mb plus quota on Junk folder
and delete mail older then 3 month there

 
 Yours
 Jost Krieger
 


-- 
Best Regards
MfG Robert Schetterer


Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-19 Thread Jost Krieger
On Wed 19 Sep 2012 04:03:45 PM GMT, Robert Schetterer wrote:

 as ever ,this is different in different places
 specially Quarantine is wide used

Of course, it's often useful.

 there is no good or evil to this case, its a design question which may
 change in different places,, the abuse case might be acceptable, as the
 Junk folder i.e is imap special used autoconfigured
 and has auto empty feature, i give 50 mb plus quota on Junk folder
 and delete mail older then 3 month there
 
The abuse may be tolerable, but I just don't get how your +50M works.
For me it would mean that someone with a large Junk folder just wouldn't
get an more mail except something delivered straight to Junk. And if you
don't deliver to Junk but the clients move stuff there, there's still a
problem. I'm justing raising the limit for folders that clients use for
deleting (like Trash or whatever it is called).

Yours
Jost Krieger
-- 
| jost.krieger+...@ruhr-uni-bochum.de  Please help stamp out spam! |
| Postmaster, JAPH, resident answer machineat RUB Comp. Center |
| Sincere words are not sweet, sweet words are not sincere.|
|  Lao Tse, Tao Te King 81 |


Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-19 Thread Robert Schetterer
Am 19.09.2012 16:25, schrieb Jost Krieger:
 On Wed 19 Sep 2012 04:03:45 PM GMT, Robert Schetterer wrote:
 
 as ever ,this is different in different places
 specially Quarantine is wide used
 
 Of course, it's often useful.
 
 there is no good or evil to this case, its a design question which may
 change in different places,, the abuse case might be acceptable, as the
 Junk folder i.e is imap special used autoconfigured
 and has auto empty feature, i give 50 mb plus quota on Junk folder
 and delete mail older then 3 month there
  
 The abuse may be tolerable, but I just don't get how your +50M works.

the situation isnt really comparable, the plus is more configured
for copy by human to i.e Junk folder, or i.e a client filter does this auto

it makes most sense with trash, so user should mostly able to copy to
trash, even if they have got full quota, this should avoid some errors
in clients

http://wiki2.dovecot.org/Quota/Configuration
...
quota_rule = *:storage=1G
quota_rule2 = Trash:storage=+100M
quota_rule3 = SPAM:ignore
...

 For me it would mean that someone with a large Junk folder just wouldn't
 get an more mail except something delivered straight to Junk. And if you
 don't deliver to Junk but the clients move stuff there,

with auto loosing mail after some time in my setup
which is the anounced policy, Trash and Junk are autodeleted folders
no mail there ,rests forever *g

 there's still a
 problem. I'm justing raising the limit for folders that clients use for
 deleting (like Trash or whatever it is called).

as i said its a design question, your policy is ok too

no flame ,having your idea as alternative is always fine to have

 
 Yours
 Jost Krieger
 


-- 
Best Regards
MfG Robert Schetterer


[Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-18 Thread Jost Krieger
It seems there is no way to correct te quota limit downward for some
mailboxes, like:

quota_rule9 = UCE-TMP:storage=-10%%

The idea is to not eat up the users storage with spam, so that spam
stays in the queue (for some time) while real mail gets delivered.

There *is* a line

} else if (*value != '-'  relative_rule) {

in quota.c, but nothing else handles it, starting with
quota_rule_parse_percentage.
 
Yours
Jost Krieger
-- 
| jost.krieger+...@ruhr-uni-bochum.de  Please help stamp out spam! |
| Postmaster, JAPH, resident answer machineat RUB Comp. Center |
| Sincere words are not sweet, sweet words are not sincere.|
|  Lao Tse, Tao Te King 81 |


Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-18 Thread Timo Sirainen
On 18.9.2012, at 14.40, Jost Krieger wrote:

 It seems there is no way to correct te quota limit downward for some
 mailboxes, like:
 
 quota_rule9 = UCE-TMP:storage=-10%%
 
 The idea is to not eat up the users storage with spam, so that spam
 stays in the queue (for some time) while real mail gets delivered.

Interesting idea. This was pretty easy to fix:

http://hg.dovecot.org/dovecot-2.1/rev/74d639b2a5bf

Now, the next problem is that if LDA can't save the message to UCE-TMP because 
of quota failure it saves it to INBOX. I'm not really sure how that should be 
fixed, since generally it's a good idea to do it..



Re: [Dovecot] Changing Quota downward for special Mailboxes? (2.1.6)

2012-09-18 Thread Robert Schetterer
Am 18.09.2012 18:17, schrieb Timo Sirainen:
 On 18.9.2012, at 14.40, Jost Krieger wrote:
 
 It seems there is no way to correct te quota limit downward for some
 mailboxes, like:

 quota_rule9 = UCE-TMP:storage=-10%%

 The idea is to not eat up the users storage with spam, so that spam
 stays in the queue (for some time) while real mail gets delivered.
 
 Interesting idea. This was pretty easy to fix:
 
 http://hg.dovecot.org/dovecot-2.1/rev/74d639b2a5bf
 
 Now, the next problem is that if LDA can't save the message to UCE-TMP 
 because of quota failure it saves it to INBOX. I'm not really sure how that 
 should be fixed, since generally it's a good idea to do it..
 

some allready existing way is i.e
with milter and postfix tagged spam get in hold queue for i.e human
admin investigate, or some quarantaine with amavis
for sure there are benefits getting dovecot involved in spam tagging
but i would leave spam tagging to the mailserver in first way and
deliver it to Junk folder by global sieve rule with giving more quota or
ignoring  Quota to Junk folder, but i see this isnt the same what you
might wanna goal

-- 
Best Regards
MfG Robert Schetterer