Greg Earle writes:

On Mar 4, 2010, at 7:13 PM, Sam Varshavchik <[email protected]> wrote:

Greg Earle writes:

grep elizabeth.r syslog | grep size= | grep earle | head -1
Mar  4 16:42:51 XXXX courierlocal: [ID 702911 mail.info] 
id=000377CA.4B90538B.00001F84,from=<[email protected]>,addr=<[email protected]>,size=709,success:
 Message delivered.
You can see the "size=709", matching the size of the file without the 
Return-Path and Delivered-To.
Given that Courier hands off the message to my preline/procmail back-end for actual 
delivery, doesn't this imply that the message is, in fact, already empty when Courier is 
finished processing it, given the "size=709"?

Yes. In the log files, the message size is the size of the file in the internal 
mail queue that contains the message.

OK.  So basically, now I know that the message is getting mangled on its way 
through Courier somehow.

I have this sickening feeling that I know where this is headed.

A long time ago I made the "manual override" change of commenting out the section in 
courier/submit.C (at ~ line 1405) that returns the "534 Message header size, or recipient 
list, exceeds policy limit." error message.

I had no choice.  People were complaining that they were not receiving
important e-mails, and it didn't matter to them that they were from dumb
secretaries that sent out e-mails with 200 people in the "To: " field or
not. They just knew that other colleagues were getting them and they
weren't.

My fear here is that what I am seeing with my "empty messages" are, in
fact, messages that would've normally would've triggered this 534 error,
but instead are getting further along into the Courier code, with the
remainder of the message elided after hitting the too-large "To: " field. Am I likely to be correct?

Yes. You commented out this:

       else if (headercnt == 0)
       {
               std::cout << "534 Message header size exceeds policy limit."
                         << std::endl << std::flush;
               mf->flag=1;
       }

But headercnt gets initially set to 0 immediately when an overflow condition is detected in the headers. After reading the headers, the loop that reads the body of the message acts accordingly, to throw away the contents of the message:

       while (read_next_line(input, line))
       {
               int     i, l;

               if ((i=input.getinputchar()) != EOF && i != '\n')
                       headercnt=0;
               if (headercnt == 0)     continue;

Your older version's code is slightly different, but the logic is the same -- when reading the body of the message, if the body contains an excessively long line, headercnt also gets set to 0, and once it hits 0, all subsequent input gets thrown away. The error message gets reported only after the error condition is already flagged and the contents of the message is thrown away.

You've disabled merely the reporting of the error message. All other aspects of it, including discarding the contents of the message, remains in place.

If I am, is there some way I can re-enable that code and manually override the 
hardcoded limit (was it 100 recipients, or an overall header byte count, or 
both?) elsewhere?

Only by auditing the entire code and disabling the actual checks for the overflow, of which there are several, rather than error reporting. Furthermore, it may not necessarily be straightforward. For example, the function that reads the next line of the message will abort when it fails to read a newline character after, I believe, 5000 characters or so, leaving the rest of the input line unread. To fully disable that, you will have to modify the logic so that it reads the input in perpetuity.

Just in case, if it's not this I've created "etc/batchsize" with "1000" in it and added 
"maxrcpts 1000" to "etc/bofh".  If neither of these cures the problem then I really have to do 
manual override.

I really can't emphasize enough that I *have* to support this capability. If users don't get e-mails or get them mangled, my mail server goes
bye-bye and people will be forced to migrate to the Institutional
Microsoft Exchange server - including me.  Obviously I don't want this to
happen.

I understand, but from my view, preventing denial of service attacks carries higher priority. This is a well-known attack vector. Just late last year, an equivalent denial-of-service attack against Apache came to light: Apache can be brought to its knees by establishing a connection and slowly dribbling one character at a time to Apache, in perpetuity, since Apache's internal logic had no checks for upper limits on its input source.


Attachment: pgpYY9JqZPo3w.pgp
Description: PGP signature

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
courier-users mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users

Reply via email to