"Chunk exceeds message size limit"

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

"Chunk exceeds message size limit"

Thorben Thuermer
Hello,

i am running postfix 3.4.1-1 (from debian sid).

i recently noticed that mails from multiple senders (most importantly google mail)
are being rejected with:
>  552 5.3.4 Chunk exceeds message size limit

postfix logs:
> Mar 19 17:42:48 ngs postfix/smtpd[22671]: warning: 25E74C1: BDAT request from mail-ed1-f44.google.com[209.85.208.44] exceeds message size limit

this happens regardless of the actual message size,
even a one-line plaintext message is rejected.

/etc/postfix/main.cf has:
header_size_limit = 4096000
message_size_limit = 0

downgrading to 3.3.2 fixed the issue.

i found the responsible code in postfix-3.4.1/src/smtpd/smtpd.c
commenting out that check also fixes the issue.

    /* Block too large chunks. */
    if (state->act_size > var_message_limit - chunk_size) {
        state->error_mask |= MAIL_ERROR_POLICY;
        msg_warn("%s: BDAT request from %s exceeds message size limit",
                 state->queue_id ? state->queue_id : "NOQUEUE",
                 state->namaddr);
        return skip_bdat(state, chunk_size, final_chunk,
                         "552 5.3.4 Chunk exceeds message size limit");
    }

- T.
Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Thorben Thuermer
On Tue, 19 Mar 2019 17:45:50 +0000 (UTC)
Thorben Thuermer <[hidden email]> wrote:

> i am running postfix 3.4.1-1 (from debian sid).
>
> i recently noticed that mails from multiple senders (most importantly
> google mail) are being rejected with:
> >  552 5.3.4 Chunk exceeds message size limit
>
> postfix logs:
> > Mar 19 17:42:48 ngs postfix/smtpd[22671]: warning: 25E74C1: BDAT
> > request from mail-ed1-f44.google.com[209.85.208.44] exceeds message
> > size limit
>
> this happens regardless of the actual message size,
> even a one-line plaintext message is rejected.
>
> /etc/postfix/main.cf has:
> header_size_limit = 4096000
> message_size_limit = 0
>
> downgrading to 3.3.2 fixed the issue.
>
> i found the responsible code in postfix-3.4.1/src/smtpd/smtpd.c
> commenting out that check also fixes the issue.
>
>     /* Block too large chunks. */
>     if (state->act_size > var_message_limit - chunk_size) {

after some more reading of code,
it turns out that this usage of `var_message_limit` is missing the check
of `var_message_limit > 0` that in other places enables `0` to mean
"no limit", and thus it enforces a limit of 0 with my config :(

>         state->error_mask |= MAIL_ERROR_POLICY;
>         msg_warn("%s: BDAT request from %s exceeds message size
> limit", state->queue_id ? state->queue_id : "NOQUEUE",
>                  state->namaddr);
>         return skip_bdat(state, chunk_size, final_chunk,
>                          "552 5.3.4 Chunk exceeds message size
> limit"); }

- T.

Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Wilfried.Essig@Essignetz.de
Hi,


how do you come to set message_size_limit = 0?

I'd suggest to comment it out for the default of 10240000. Or set
something reasonable for your environment.

Or switch chunking off: http://www.postfix.org/BDAT_README.html


>> downgrading to 3.3.2 fixed the issue.As i know, chunking came with PF 3.4.



Willi



>>
>> i found the responsible code in postfix-3.4.1/src/smtpd/smtpd.c
>> commenting out that check also fixes the issue.
>>
>>     /* Block too large chunks. */
>>     if (state->act_size > var_message_limit - chunk_size) {
>
> after some more reading of code,
> it turns out that this usage of `var_message_limit` is missing the check
> of `var_message_limit > 0` that in other places enables `0` to mean
> "no limit", and thus it enforces a limit of 0 with my config :(
>
>>         state->error_mask |= MAIL_ERROR_POLICY;
>>         msg_warn("%s: BDAT request from %s exceeds message size
>> limit", state->queue_id ? state->queue_id : "NOQUEUE",
>>                  state->namaddr);
>>         return skip_bdat(state, chunk_size, final_chunk,
>>                          "552 5.3.4 Chunk exceeds message size
>> limit"); }
>
> - T.
>
Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Viktor Dukhovni
In reply to this post by Thorben Thuermer
On Tue, Mar 19, 2019 at 06:08:27PM +0000, Thorben Thuermer wrote:

> > /etc/postfix/main.cf has:
> > header_size_limit = 4096000
> > message_size_limit = 0
> >
> > I found the responsible code in postfix-3.4.1/src/smtpd/smtpd.c
> > commenting out that check also fixes the issue.
> >
> >     /* Block too large chunks. */
> >     if (state->act_size > var_message_limit - chunk_size) {
>
> after some more reading of code,
> it turns out that this usage of `var_message_limit` is missing the check
> of `var_message_limit > 0` that in other places enables `0` to mean
> "no limit", and thus it enforces a limit of 0 with my config :(

Correct.  The code should read:

--- src/smtpd/smtpd.c
+++ src/smtpd/smtpd.c
@@ -3878,7 +3878,8 @@ static int bdat_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
  }
     }
     /* Block too large chunks. */
-    if (state->act_size > var_message_limit - chunk_size) {
+    if (var_message_limit > 0
+ && state->act_size > var_message_limit - chunk_size) {
  state->error_mask |= MAIL_ERROR_POLICY;
  msg_warn("%s: BDAT request from %s exceeds message size limit",
  state->queue_id ? state->queue_id : "NOQUEUE",

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Viktor Dukhovni
On Tue, Mar 19, 2019 at 02:46:02PM -0400, Viktor Dukhovni wrote:

> > it turns out that this usage of `var_message_limit` is missing the check
> > of `var_message_limit > 0` that in other places enables `0` to mean
> > "no limit", and thus it enforces a limit of 0 with my config :(
>
> Correct.  The code should read:
>
> --- src/smtpd/smtpd.c
> +++ src/smtpd/smtpd.c
> @@ -3878,7 +3878,8 @@ static int bdat_cmd(SMTPD_STATE *state, int argc, SMTPD_TOKEN *argv)
>   }
>      }
>      /* Block too large chunks. */
> -    if (state->act_size > var_message_limit - chunk_size) {
> +    if (var_message_limit > 0
> + && state->act_size > var_message_limit - chunk_size) {
>   state->error_mask |= MAIL_ERROR_POLICY;
>   msg_warn("%s: BDAT request from %s exceeds message size limit",
>   state->queue_id ? state->queue_id : "NOQUEUE",

Note that, perhaps unintentionally, the treatment of "message_size_limit
= 0" is not documented to mean "no limit".  Perhaps we should also
address that.

--
        Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Thorben Thuermer
In reply to this post by Wilfried.Essig@Essignetz.de
On Tue, 19 Mar 2019 19:21:43 +0100
"[hidden email]" <[hidden email]> wrote:
> Hi,
>
> how do you come to set message_size_limit = 0?
>
> I'd suggest to comment it out for the default of 10240000. Or set
> something reasonable for your environment.

i changed this when i needed to receive a message that was larger than
ten megabytes. (yes, sadly people use email to transfer files.)
i did check now and i do find that it is not mentioned in the official
documentation,
but outside of the newly added chunking, the code implements a logic of
"0 means no limit".
(i probably found that suggestion somewhere on the web.)
(yes, that is probably a bad choice for production systems.)

feel free to choose what the correct behavior is,
but maybe it should be consistent between chunked and non-chunked.

> Or switch chunking off: http://www.postfix.org/BDAT_README.html
>
>
> >> downgrading to 3.3.2 fixed the issue.
>
> As i know, chunking came with PF 3.4.
>
> Willi

- T.

> >> i found the responsible code in postfix-3.4.1/src/smtpd/smtpd.c
> >> commenting out that check also fixes the issue.
> >>
> >>     /* Block too large chunks. */
> >>     if (state->act_size > var_message_limit - chunk_size) {
> >
> > after some more reading of code,
> > it turns out that this usage of `var_message_limit` is missing the
> > check of `var_message_limit > 0` that in other places enables `0`
> > to mean "no limit", and thus it enforces a limit of 0 with my
> > config :(
> >
> >>         state->error_mask |= MAIL_ERROR_POLICY;
> >>         msg_warn("%s: BDAT request from %s exceeds message size
> >> limit", state->queue_id ? state->queue_id : "NOQUEUE",
> >>                  state->namaddr);
> >>         return skip_bdat(state, chunk_size, final_chunk,
> >>                          "552 5.3.4 Chunk exceeds message size limit");
> >>     }
Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Markus Schönhaber-16
In reply to this post by Viktor Dukhovni
Viktor Dukhovni, 19.3.2019 20:00 +0100:

> Note that, perhaps unintentionally, the treatment of "message_size_limit
> = 0" is not documented to mean "no limit".  Perhaps we should also
> address that.

I asked about that some years ago and Wietse told me that it is
intentionally not documented:
> http://postfix.1071664.n5.nabble.com/value-of-zero-not-documented-for-message-size-limit-td66874.html

--
Regards
  mks

Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

@lbutlr
In reply to this post by Viktor Dukhovni
On 19 Mar 2019, at 13:00, Viktor Dukhovni <[hidden email]> wrote:
> Note that, perhaps unintentionally, the treatment of "message_size_limit
> = 0" is not documented to mean "no limit".  Perhaps we should also
> address that.

By forbidding a setting of 0?



--
'They're the cream!' Rincewind sighed. 'Cohen, they're the cheese.'


Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Peter Ajamian
In reply to this post by Markus Schönhaber-16
On 20/03/19 21:11, Markus Schönhaber wrote:
> Viktor Dukhovni, 19.3.2019 20:00 +0100:
>
>> Note that, perhaps unintentionally, the treatment of "message_size_limit
>> = 0" is not documented to mean "no limit".  Perhaps we should also
>> address that.
>
> I asked about that some years ago and Wietse told me that it is
> intentionally not documented:
>> http://postfix.1071664.n5.nabble.com/value-of-zero-not-documented-for-message-size-limit-td66874.html

I just had this come up in the IRC chat room.  It is becoming apparent
that even though message_size_limit=0 has undocumented behavior a not
insignificant number of people have come to be using it in their configs
and when postfix 3.4 hits mainstream releases we will get a lot more
complaints about this.

Can we either (1) fix this with the patch mentioned before in this
thread and document the behavior, or (2) still fix it but add in a
warning that fires on startup if this setting is 0 to try to encourage
people to change it?


Peter
Reply | Threaded
Open this post in threaded view
|

Re: "Chunk exceeds message size limit"

Wietse Venema
Peter:

> On 20/03/19 21:11, Markus Sch?nhaber wrote:
> > Viktor Dukhovni, 19.3.2019 20:00 +0100:
> >
> >> Note that, perhaps unintentionally, the treatment of "message_size_limit
> >> = 0" is not documented to mean "no limit".  Perhaps we should also
> >> address that.
> >
> > I asked about that some years ago and Wietse told me that it is
> > intentionally not documented:
> >> http://postfix.1071664.n5.nabble.com/value-of-zero-not-documented-for-message-size-limit-td66874.html
>
> I just had this come up in the IRC chat room.  It is becoming apparent
> that even though message_size_limit=0 has undocumented behavior a not
> insignificant number of people have come to be using it in their configs
> and when postfix 3.4 hits mainstream releases we will get a lot more
> complaints about this.
>
> Can we either (1) fix this with the patch mentioned before in this
> thread and document the behavior, or (2) still fix it but add in a
> warning that fires on startup if this setting is 0 to try to encourage
> people to change it?

I am working on this. In the meantime, don't set a zero size limit.

        Wietse