blocked bad-header

Discussion in 'Server Operation' started by gjcomputer, Jan 24, 2009.

  1. gjcomputer

    gjcomputer New Member

    how can i allow this through my system? it is coming from a php script that i want to allow through everytime, can i turn something off? and shouldnt my relay host be what i configured, instead of localhsot?
    i am using ispconfig 3.0.0.8 on debian etch
    mail.log
    Code:
    Jan 23 17:51:52 sys1 amavis[2917]: (02917-02) Blocked BAD-HEADER, <www-data@sys1.****.com> -> <**********@gmail.com>, quarantine: badh-Q-XBCNzRss0e, Message-ID: <20090123235151.62A6F10881C6@sys1.****.com>, mail_id: Q-XBCNzRss0e, Hits: 3.95, 720 ms
    Jan 23 17:51:52 sys1 postfix/smtp[3538]: 62A6F10881C6: to=<*********@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.81, delays=0.06/0.02/0/0.72, dsn=2.7.1, status=sent (254 2.7.1 Ok, discarded, id=02917-02 - BAD_HEADER: Improper use of control character (char 0D hex): MIME-Version: 1.0\\r\\n)
    Jan 23 17:51:52 sys1 postfix/qmgr[2739]: 62A6F10881C6: removed
    Jan 23 17:52:45 sys1 postfix/pickup[2738]: 0B4D010881C6: uid=33 from=<www-data>
    Jan 23 17:52:45 sys1 postfix/cleanup[3535]: 0B4D010881C6: message-id=<20090123235245.0B4D010881C6@sys1.****.com>
    Jan 23 17:52:45 sys1 postfix/qmgr[2739]: 0B4D010881C6: from=<www-data@sys1.****.com>, size=1152, nrcpt=1 (queue active)
    Jan 23 17:52:45 sys1 amavis[2916]: (02916-03) Blocked BAD-HEADER, <www-data@sys1.****.com> -> <*********@gmail.com>, quarantine: badh-HXHB-GAK6g5h, Message-ID: <20090123235245.0B4D010881C6@sys1.****.com>, mail_id: HXHB-GAK6g5h, Hits: 3.929, 287 ms
    Jan 23 17:52:45 sys1 postfix/smtp[3538]: 0B4D010881C6: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.3, delays=0.01/0/0/0.29, dsn=2.7.1, status=sent (254 2.7.1 Ok, discarded, id=02916-03 - BAD_HEADER: Improper use of control character (char 0D hex): MIME-Version: 1.0\\r\\n)
    Jan 23 17:52:45 sys1 postfix/qmgr[2739]: 0B4D010881C6: removed
    Jan 23 17:53:30 sys1 postfix/pickup[2738]: 6942A10881C6: uid=33 from=<www-data>
    Jan 23 17:53:30 sys1 postfix/cleanup[3535]: 6942A10881C6: message-id=<20090123235330.6942A10881C6@sys1.****.com>
    Jan 23 17:53:30 sys1 postfix/qmgr[2739]: 6942A10881C6: from=<www-data@sys1.****.com>, size=1402, nrcpt=1 (queue active)
    Jan 23 17:53:30 sys1 amavis[2917]: (02917-03) Blocked BAD-HEADER, <www-data@sys1.****.com> -> <*******@gmail.com>, quarantine: badh-rLG2pIulu7N1, Message-ID: <20090123235330.6942A10881C6@sys1.****.com>, mail_id: rLG2pIulu7N1, Hits: 4.166, 240 ms
    Jan 23 17:53:30 sys1 postfix/smtp[3538]: 6942A10881C6: to=<********@gmail.com>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.26, delays=0.01/0/0/0.24, dsn=2.7.1, status=sent (254 2.7.1 Ok, discarded, id=02917-03 - BAD_HEADER: Improper use of control character (char 0D hex): MIME-Version: 1.0\\r\\n)
    Jan 23 17:53:30 sys1 postfix/qmgr[2739]: 6942A10881C6: removed
    
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Did you configure any header checks for Postfix in ISPConfig 3?
     
  3. reason8

    reason8 Member

    Amavis Blocked Header

    Hello and good day.

    I am having the same problem.

    I am trying to use an application that uses the php mail function but my logs show amavis is blocking the email from being sent.

    May 16 14:21:53 [hostname] amavis[2506]: (02506-01) Blocked BAD-HEADER, <[email protected]> -> <[email protected]>, quarantine: badh-0EgzxmrgzuPp, Message-ID: <20140516212153.3D924200D8@fqdn>, mail_id: 0EgzxmrgzuPp

    I have not made any changes to my postfix config other than relaying from my ispconfig server to an internal mail server for email delivery.

    I am running the recent version of ispconfig on openSUSE 11.3

    UPDATE:

    I just checked and it seems Amavis is lableing the message as BAD HEADER and quarantining the message. Not sure why other than some users said it had something to do with \n coding with php.

    This is what my message looks like:

    Return-Path: <>
    Delivered-To: bad-header-quarantine
    X-Envelope-From: <[email protected]>
    X-Envelope-To: <[email protected]>
    X-Envelope-To-Blocked: <[email protected]>
    X-Quarantine-ID: <zB4Dg+JFS2Jk>
    X-Amavis-Alert: BAD HEADER SECTION Improper use of control character (char 0D
    hex): MIME-Version: 1.0\r
     
    Last edited: May 17, 2014
  4. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    It seems you are using \r or \r\n instead of \n in the mails (see last part of error message). Try changing the script to use \n.
     
  5. reason8

    reason8 Member


    Thanks for the quick and timely response.

    It's not my script or program. So I do not think this will be possible.

    I have seen other posts about this \r or \r\n as well but I don't think that is something I can implement.

    Is there not a way to force amavis to simply allow this email based on the FROM friend? Application is running locally on my server.

    Any other recommendations?
     
  6. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Try changing $final_bad_header_destiny in amavis config to if you want to disable those checks (although it would be better do use mail scripts that pass correct headers)
    $final_bad_header_destiny = D_PASS;
     
  7. reason8

    reason8 Member

    That didnt work. I am still receiving a blocked error in the mail logs as seen below:

    May 18 04:01:42 [hostname] amavis[15978]: (15978-01) Blocked BAD-HEADER, <[email protected]> -> <[email protected]>, quarantine: badh-Edkkx15g6cGR, Message-ID: <20140518110142.76742200E6@fqdn>, mail_id: Edkkx15g6cGR, Hits: -, size: 585, 225 ms

    And yes, I agree with your statement.

    The ISPConfig webserver is simply relaying mail to my internal mail server. It's not really handling mail other than for localhost.
     
  8. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    Try adding/setting in amavis config:
    @bypass_header_checks_maps = (1);
     
  9. reason8

    reason8 Member

    Same thing. No difference. Still indicating a bad header. :(
     
  10. Croydon

    Croydon ISPConfig Developer ISPConfig Developer

    If you want to disable all checks on mails (no amavis involved) you could try commenting out
    content_filter = amavis:[127.0.0.1]:10024
    in the postfix main.cf - but maybe someone else has a better idea as this disables all scanning, including virus check etc.
     
  11. reason8

    reason8 Member

    That worked. Thanks!!

    If someone does have another idea or more insight into this, I would be more than appreciative.

    I do not like disabling security but as I said, this webserver is not handling email. Simply relaying it to my internal mail server.

    Thank you very much for your diligence in helping me with this.
     

Share This Page