Loading ...
Sorry, an error occurred while loading the content.
 

Milter problem

Expand Messages
  • sosogh
    Hi all I am using postfix 2.5.5 and MIMEDefang 2.57 I know that the policy server can reply to Postfix with any action that is allowed in a Postfix SMTPD
    Message 1 of 12 , Nov 17, 2008
      Hi all
       
      I am using postfix 2.5.5 and MIMEDefang 2.57
       
      I know that the policy server can reply to Postfix with any action that is allowed in a Postfix SMTPD access(5) table in Postfix SMTP Access Policy Delegation ,such as:
      DISCARD optional text...
      FILTER transport:destination
      HOLD optional text...
      ..............
       
       
       
      Is FILTER transport:destination can be sent back to postfix as a milter result action?
       
      I have made a test adding the following code in mimedefang-filter:
       
      sub filter_sender {
          my ($sender, $ip, $hostname, $helo) = @_;
          if ($sender =~ /sosogh.cn/i) {
             return ("FILTER smtp:[202.96.15.55]:25","");
          }
      return ('CONTINUE', "ok");
      }
       

      But the log said 554 5.7.1 followed by a question mark:
      Nov 17 15:37:01 debian postfix/smtpd[11523]: NOQUEUE: milter-reject: MAIL from unknown[202.96.130.213]: 554 5.7.1 ?; from=<sosogh@...> proto=ESMTP helo=<9B83DB3FAA054BC>
       
      Does  milter not support the return value "FILTER smtp:[202.96.15.55]:25"?
      Thank you
       
       
      2008-11-17

      sosogh
    • Wietse Venema
      ... This is the POSTFIX mailing list. For questions about MILTERS, you may find better information on the mimedefang-filter support mailing list. Wietse
      Message 2 of 12 , Nov 17, 2008
        > I have made a test adding the following code in mimedefang-filter:
        >
        > sub filter_sender {
        > my ($sender, $ip, $hostname, $helo) = @_;
        > if ($sender =~ /sosogh.cn/i) {
        > return ("FILTER smtp:[202.96.15.55]:25","");
        > }
        > return ('CONTINUE', "ok");
        > }
        >
        > But the log said 554 5.7.1 followed by a question mark:
        > Nov 17 15:37:01 debian postfix/smtpd[11523]: NOQUEUE: milter-reject: MAIL from u
        > nknown[202.96.130.213]: 554 5.7.1 ?; from=<sosogh@...> proto=ESMTP helo=<9
        > B83DB3FAA054BC>
        >
        > Does milter not support the return value "FILTER smtp:[202.96.15.55]:25"?

        This is the POSTFIX mailing list. For questions about MILTERS, you
        may find better information on the mimedefang-filter support
        mailing list.

        Wietse
      • sosogh
        Thank you I have sent this question to mimedefang-filter maillist in fact ,but got no response So I tired to post it here : ( : ) 2008-11-17 sosogh
        Message 3 of 12 , Nov 17, 2008
          Thank you
           
          I have sent this question to mimedefang-filter maillist in fact ,but got no response
           
          So I tired to post it here  : (      :  )
           
           
          2008-11-17

          sosogh

          发件人: Wietse Venema
          发送时间: 2008-11-17  20:12:25
          收件人: sosogh
          抄送: postfix-users
          主题: Re: Milter problem
          > I have made a test adding the following code in mimedefang-filter:
          > sub filter_sender {
          >     my ($sender, $ip, $hostname, $helo) = @_; 
          >     if ($sender =~ /sosogh.cn/i) { 
          >        return ("FILTER smtp:[202.96.15.55]:25","");
          >     } 
          > return ('CONTINUE', "ok"); 
          > } 
          > But the log said 554 5.7.1 followed by a question mark:
          > Nov 17 15:37:01 debian postfix/smtpd[11523]: NOQUEUE: milter-reject: MAIL from u
          > nknown[202.96.130.213]: 554 5.7.1 ?; from=
          <sosogh@... > proto=ESMTP helo= <9
          > B83DB3FAA054BC >
          > Does  milter not support the return value "FILTER smtp:[202.96.15.55]:25"?
           
          This is the POSTFIX mailing list. For questions about MILTERS, you
          may find better information on the mimedefang-filter support
          mailing list.
           
          Wietse
           
           
          __________ NOD32 3617 (20081117) Information __________
           
          This message was checked by NOD32 antivirus system.
           
           
        • Noel Jones
          ... Policy servers and access maps are a postfix creation. Postfix defines what is valid and what isn t. ... The milter protocol is not a postfix creation.
          Message 4 of 12 , Nov 17, 2008
            sosogh wrote:
            > Hi all
            >
            > I am using postfix 2.5.5 and MIMEDefang 2.57
            >
            > I know that the policy server can reply to Postfix with any action that
            > is allowed in a Postfix SMTPD access(5) table in Postfix SMTP Access
            > Policy Delegation ,such as:
            > *BCC* /user@domain <mailto:user@domain> ; /
            > *DISCARD* /optional text.../
            > *FILTER* /transport:destination/
            > *HOLD* /optional text.../
            > ..............
            >
            > http://www.postfix.org/access.5.html
            > http://www.postfix.org/SMTPD_POLICY_README.html#protocol

            Policy servers and access maps are a postfix creation.
            Postfix defines what is valid and what isn't.

            > Is FILTER transport:destination can be sent back to postfix as a milter
            > result action?

            The milter protocol is not a postfix creation. Postfix does
            not define what is a valid milter action.

            So no, FILTER (a postfix-specific action) isn't valid in a
            milter (a non-postfix protocol).

            --
            Noel Jones
          • Christian Rößner
            Hi, I am currently trying to develop a milter for Postfix. I need all headers from a mail. Unfortunately I found out that always the very first header of an
            Message 5 of 12 , Jul 7, 2014
              Hi,

              I am currently trying to develop a milter for Postfix. I need all headers from a mail. Unfortunately I found out that always the very first header of an earlier milter is not visible in my milter.

              I run:

              amavis, opendkim, …, my_milter

              I am interested in header fields created by amavis.

              I show yout the mail that arrives:

              Return-Path: <cr@...>
              Delivered-To: <de10000@...>
              Received: from mx0.roessner-net.de
              by mail.roessner-net.de (Dovecot) with LMTP id ikj+LYDculN2fwAALLcv9g
              for <de10000@...>; Mon, 07 Jul 2014 19:44:34 +0200
              X-Spam-Flag: NO
              DMARC-Filter: OpenDMARC Filter v1.2.0 mx0.roessner-net.de 3h6Z0c5VYWzGp10
              Authentication-Results: mx0.roessner-net.de; dmarc=none header.from=sys4.de
              DKIM-Filter: OpenDKIM Filter v2.9.2 mx0.roessner-net.de 3h6Z0c5VYWzGp10
              Authentication-Results: mx0.roessner-net.de;
              dkim=pass (2048-bit key; secure) header.d=sys4.de header.i=@... header.b=Yb+if1UH;
              dkim-adsp=pass; dkim-atps=neutral
              Authentication-Results: mx0.roessner-net.de; spf=pass smtp.mailfrom=<cr@...> smtp.helo=mail.sys4.de
              X-Spam-Score: -1.223
              X-Spam-Status: No, score=-1.223 required=3.3
              tests=[AM.IP_BAD_194.126.158.139=0.6, BAYES_00=-0.2, DKIM_VALID=-0.1,
              DKIM_VALID_AU=-0.1, DKIM_VERIFIED=-0.1, RCVD_IN_DNSWL_LOW=-0.7,
              RP_MATCHES_RCVD=-0.652, SPF_PASS=-0.001]
              autolearn=ham autolearn_force=no
              Received: from mail.sys4.de (mail.sys4.de [194.126.158.139])
              (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
              (No client certificate requested)
              by mx0.roessner-net.de (Postfix) with ESMTPS id 3h6Z0c5VYWzGp10
              for <c@...>; Mon, 7 Jul 2014 19:44:32 +0200 (CEST)
              DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sys4.de; h=
              x-mailer:mime-version:date:date:message-id:subject:subject
              :content-type:content-type:from:from; s=mail201310; t=
              1404755072; x=1406569473; bh=aXXTaRyGbf/yRD3RqrZybK4MdbChiXlDWAl
              iAOUOOjI=; b=Yb+if1UHG+UZwQVQGcDZ+P+SJTr6GyW9TmBieOg4h3vJvmpeKXc
              sh6HFvZuoM6PTAlvN1LFoVDYHj9ngAxQKnUL3b6x/L/Mmilr2Ag2cIHiWkxzzQe3
              uzLSqmIdZENh5ELU42g9cIA6++i33e4WOchbvF9YU8Z0ghLZM1ejTDvVqfu6JfrB
              5OQbKj9Wydo8dxqq/vbJipK0y4waElsdxGA7+Ui3Ds9PbX5iWMoy1e7JCz5xFx5T
              rBfboR57KUC8/JsFb5XIvg2552lN27B4HxBePbIuM52subUj8HwHVFTNKWprJNse
              cgcvVDT22zc1JXr04wZCa/CZxQ3dbxBh9ow==
              Received: from [172.16.2.200] (static-201-106.deltasurf.de [193.239.106.201])
              (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits))
              (No client certificate requested)
              by mail.sys4.de (Postfix) with ESMTPSA id 3h6Z0c1vSrz7T
              for <c@...>; Mon, 7 Jul 2014 19:44:32 +0200 (CEST)
              From: =?iso-8859-1?Q?Christian_R=F6=DFner?= <cr@...>
              Content-Type: multipart/signed; boundary="Apple-Mail=_79457A13-BF4A-44E5-9ABD-440AB0964CA0"; protocol="application/pgp-signature"; micalg=pgp-sha1
              Subject: Test
              Message-Id: <16199F64-B646-4310-8B17-92E6D2E3C1A9@...>
              Date: Mon, 7 Jul 2014 19:44:31 +0200
              To: =?iso-8859-1?Q?Christian_R=F6=DFner?= <c@...>
              Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\))
              X-Mailer: Apple Mail (2.1878.6)
              ...

              As you can see the mail has a header X-Spam-Flag. But this header is not sent to the milter. I have used tshark to see what is going on. Have a qucik view:

              0000 00 00 00 14 44 4c 69 00 33 68 36 5a 30 63 35 56 ....DLi.3h6Z0c5V
              0010 59 57 7a 47 70 31 30 00 00 00 00 4a 4c 44 4d 41 YWzGp10....JLDMA
              0020 52 43 2d 46 69 6c 74 65 72 00 4f 70 65 6e 44 4d RC-Filter.OpenDM
              0030 41 52 43 20 46 69 6c 74 65 72 20 76 31 2e 32 2e ARC Filter v1.2.
              0040 30 20 6d 78 30 2e 72 6f 65 73 73 6e 65 72 2d 6e 0 mx0.roessner-n
              0050 65 74 2e 64 65 20 33 68 36 5a 30 63 35 56 59 57 et.de 3h6Z0c5VYW
              0060 7a 47 70 31 30 00 00 00 00 14 44 4c 69 00 33 68 zGp10.....DLi.3h
              0070 36 5a 30 63 35 56 59 57 7a 47 70 31 30 00 00 00 6Z0c5VYWzGp10...
              0080 00 4c 4c 41 75 74 68 65 6e 74 69 63 61 74 69 6f .LLAuthenticatio
              0090 6e 2d 52 65 73 75 6c 74 73 00 6d 78 30 2e 72 6f n-Results.mx0.ro
              00a0 65 73 73 6e 65 72 2d 6e 65 74 2e 64 65 3b 20 64 essner-net.de; d
              00b0 6d 61 72 63 3d 6e 6f 6e 65 20 68 65 61 64 65 72 marc=none header
              00c0 2e 66 72 6f 6d 3d 73 79 73 34 2e 64 65 00 00 00 .from=sys4.de...
              00d0 00 14 44 4c 69 00 33 68 36 5a 30 63 35 56 59 57 ..DLi.3h6Z0c5VYW
              00e0 7a 47 70 31 30 00 00 00 00 48 4c 44 4b 49 4d 2d zGp10....HLDKIM-
              00f0 46 69 6c 74 65 72 00 4f 70 65 6e 44 4b 49 4d 20 Filter.OpenDKIM
              0100 46 69 6c 74 65 72 20 76 32 2e 39 2e 32 20 6d 78 Filter v2.9.2 mx
              0110 30 2e 72 6f 65 73 73 6e 65 72 2d 6e 65 74 2e 64 0.roessner-net.d
              0120 65 20 33 68 36 5a 30 63 35 56 59 57 7a 47 70 31 e 3h6Z0c5VYWzGp1
              0130 30 00 00 00 00 14 44 4c 69 00 33 68 36 5a 30 63 0.....DLi.3h6Z0c
              0140 35 56 59 57 7a 47 70 31 30 00 00 00 00 a8 4c 41 5VYWzGp10.....LA
              0150 75 74 68 65 6e 74 69 63 61 74 69 6f 6e 2d 52 65 uthentication-Re
              0160 73 75 6c 74 73 00 6d 78 30 2e 72 6f 65 73 73 6e sults.mx0.roessn
              0170 65 72 2d 6e 65 74 2e 64 65 3b 0a 09 64 6b 69 6d er-net.de;..dkim
              0180 3d 70 61 73 73 20 28 32 30 34 38 2d 62 69 74 20 =pass (2048-bit
              0190 6b 65 79 3b 20 73 65 63 75 72 65 29 20 68 65 61 key; secure) hea
              01a0 64 65 72 2e 64 3d 73 79 73 34 2e 64 65 20 68 65 der.d=sys4.de he
              01b0 61 64 65 72 2e 69 3d 40 73 79 73 34 2e 64 65 20 ader.i=@...
              01c0 68 65 61 64 65 72 2e 62 3d 59 62 2b 69 66 31 55 header.b=Yb+if1U
              01d0 48 3b 0a 09 64 6b 69 6d 2d 61 64 73 70 3d 70 61 H;..dkim-adsp=pa
              01e0 73 73 3b 20 64 6b 69 6d 2d 61 74 70 73 3d 6e 65 ss; dkim-atps=ne
              01f0 75 74 72 61 6c 00 00 00 00 14 44 4c 69 00 33 68 utral.....DLi.3h
              0200 36 5a 30 63 35 56 59 57 7a 47 70 31 30 00 00 00 6Z0c5VYWzGp10...
              0210 00 68 4c 41 75 74 68 65 6e 74 69 63 61 74 69 6f .hLAuthenticatio
              0220 6e 2d 52 65 73 75 6c 74 73 00 6d 78 30 2e 72 6f n-Results.mx0.ro
              0230 65 73 73 6e 65 72 2d 6e 65 74 2e 64 65 3b 20 73 essner-net.de; s
              0240 70 66 3d 70 61 73 73 20 73 6d 74 70 2e 6d 61 69 pf=pass smtp.mai
              0250 6c 66 72 6f 6d 3d 3c 63 72 40 73 79 73 34 2e 64 lfrom=<cr@sys4.d
              0260 65 3e 20 73 6d 74 70 2e 68 65 6c 6f 3d 6d 61 69 e> smtp.helo=mai
              0270 6c 2e 73 79 73 34 2e 64 65 00 00 00 00 14 44 4c l.sys4.de.....DL
              0280 69 00 33 68 36 5a 30 63 35 56 59 57 7a 47 70 31 i.3h6Z0c5VYWzGp1

              X-Spam-Score: -1.223

              0290 30 00 00 00 00 15 4c 58 2d 53 70 61 6d 2d 53 63 0.....LX-Spam-Sc
              02a0 6f 72 65 00 2d 31 2e 32 32 33 00 00 00 00 14 44 ore.-1.223.....D
              02b0 4c 69 00 33 68 36 5a 30 63 35 56 59 57 7a 47 70 Li.3h6Z0c5VYWzGp

              X-Spam-Status: No, score=-1.223 required=3.3
              tests=[AM.IP_BAD_194.126.158.139=0.6, BAYES_00=-0.2, DKIM_VALID=-0.1,
              DKIM_VALID_AU=-0.1, DKIM_VERIFIED=-0.1, RCVD_IN_DNSWL_LOW=-0.7,
              RP_MATCHES_RCVD=-0.652, SPF_PASS=-0.001]
              autolearn=ham autolearn_force=no

              02c0 31 30 00 00 00 01 01 4c 58 2d 53 70 61 6d 2d 53 10.....LX-Spam-S
              02d0 74 61 74 75 73 00 4e 6f 2c 20 73 63 6f 72 65 3d tatus.No, score=
              02e0 2d 31 2e 32 32 33 20 72 65 71 75 69 72 65 64 3d -1.223 required=
              02f0 33 2e 33 0a 09 74 65 73 74 73 3d 5b 41 4d 2e 49 3.3..tests=[AM.I
              0300 50 5f 42 41 44 5f 31 39 34 2e 31 32 36 2e 31 35 P_BAD_194.126.15
              0310 38 2e 31 33 39 3d 30 2e 36 2c 20 42 41 59 45 53 8.139=0.6, BAYES
              0320 5f 30 30 3d 2d 30 2e 32 2c 20 44 4b 49 4d 5f 56 _00=-0.2, DKIM_V
              0330 41 4c 49 44 3d 2d 30 2e 31 2c 0a 09 44 4b 49 4d ALID=-0.1,..DKIM
              0340 5f 56 41 4c 49 44 5f 41 55 3d 2d 30 2e 31 2c 20 _VALID_AU=-0.1,
              0350 44 4b 49 4d 5f 56 45 52 49 46 49 45 44 3d 2d 30 DKIM_VERIFIED=-0
              0360 2e 31 2c 20 52 43 56 44 5f 49 4e 5f 44 4e 53 57 .1, RCVD_IN_DNSW
              0370 4c 5f 4c 4f 57 3d 2d 30 2e 37 2c 0a 09 52 50 5f L_LOW=-0.7,..RP_
              0380 4d 41 54 43 48 45 53 5f 52 43 56 44 3d 2d 30 2e MATCHES_RCVD=-0.
              0390 36 35 32 2c 20 53 50 46 5f 50 41 53 53 3d 2d 30 652, SPF_PASS=-0
              03a0 2e 30 30 31 5d 0a 09 61 75 74 6f 6c 65 61 72 6e .001]..autolearn
              03b0 3d 68 61 6d 20 61 75 74 6f 6c 65 61 72 6e 5f 66 =ham autolearn_f
              03c0 6f 72 63 65 3d 6e 6f 00 00 00 00 14 44 4c 69 00 orce=no.....DLi.
              03d0 33 68 36 5a 30 63 35 56 59 57 7a 47 70 31 30 00 3h6Z0c5VYWzGp10.
              03e0 00 00 01 30 4c 52 65 63 65 69 76 65 64 00 66 72 ...0LReceived.fr
              03f0 6f 6d 20 6d 61 69 6c 2e 73 79 73 34 2e 64 65 20 om mail.sys4.de
              0400 28 6d 61 69 6c 2e 73 79 73 34 2e 64 65 20 5b 31 (mail.sys4.de [1
              0410 39 34 2e 31 32 36 2e 31 35 38 2e 31 33 39 5d 29 94.126.158.139])
              0420 0a 09 28 75 73 69 6e 67 20 54 4c 53 76 31 20 77 ..(using TLSv1 w
              0430 69 74 68 20 63 69 70 68 65 72 20 45 43 44 48 45 ith cipher ECDHE
              0440 2d 52 53 41 2d 41 45 53 32 35 36 2d 53 48 41 20 -RSA-AES256-SHA
              0450 28 32 35 36 2f 32 35 36 20 62 69 74 73 29 29 0a (256/256 bits)).
              0460 09 28 4e 6f 20 63 6c 69 65 6e 74 20 63 65 72 74 .(No client cert
              0470 69 66 69 63 61 74 65 20 72 65 71 75 65 73 74 65 ificate requeste
              0480 64 29 0a 09 62 79 20 6d 78 30 2e 72 6f 65 73 73 d)..by mx0.roess
              0490 6e 65 72 2d 6e 65 74 2e 64 65 20 28 50 6f 73 74 ner-net.de (Post
              04a0 66 69 78 29 20 77 69 74 68 20 45 53 4d 54 50 53 fix) with ESMTPS
              04b0 20 69 64 20 33 68 36 5a 30 63 35 56 59 57 7a 47 id 3h6Z0c5VYWzG
              04c0 70 31 30 0a 09 66 6f 72 20 3c 63 40 72 6f 65 73 p10..for <c@roes
              04d0 73 6e 65 72 2d 6e 65 74 77 6f 72 6b 2d 73 6f 6c sner-network-sol
              04e0 75 74 69 6f 6e 73 2e 63 6f 6d 3e 3b 20 4d 6f 6e utions.com>; Mon
              04f0 2c 20 20 37 20 4a 75 6c 20 32 30 31 34 20 31 39 , 7 Jul 2014 19
              0500 3a 34 34 3a 33 32 20 2b 30 32 30 30 20 28 43 45 :44:32 +0200 (CE
              0510 53 54 29 00 00 00 00 14 44 4c 69 00 33 68 36 5a ST).....DLi.3h6Z
              0520 30 63 35 56 59 57 7a 47 70 31 30 00 00 00 02 6a 0c5VYWzGp10....j
              0530 4c 44 4b 49 4d 2d 53 69 67 6e 61 74 75 72 65 00 LDKIM-Signature.
              0540 76 3d 31 3b 20 61 3d 72 73 61 2d 73 68 61 32 35 v=1; a=rsa-sha25
              0550 36 3b 20 63 3d 72 65 6c 61 78 65 64 2f 73 69 6d 6; c=relaxed/sim
              0560 70 6c 65 3b 20 64 3d 73 79 73 34 2e 64 65 3b 20 ple; d=sys4.de;
              0570 68 3d 0a 09 78 2d 6d 61 69 6c 65 72 3a 6d 69 6d h=..x-mailer:mim
              0580 65 2d 76 65 72 73 69 6f 6e 3a 64 61 74 65 3a 64 e-version:date:d
              0590 61 74 65 3a 6d 65 73 73 61 67 65 2d 69 64 3a 73 ate:message-id:s
              05a0 75 62 6a 65 63 74 3a 73 75 62 6a 65 63 74 0a 09 ubject:subject..
              05b0 3a 63 6f 6e 74 65 6e 74 2d 74 79 70 65 3a 63 6f :content-type:co
              05c0 6e 74 65 6e 74 2d 74 79 70 65 3a 66 72 6f 6d 3a ntent-type:from:
              05d0 66 72 6f 6d 3b 20 73 3d 6d 61 69 6c 32 30 31 33 from; s=mail2013
              05e0 31 30 3b 20 74 3d 0a 09 31 34 30 34 37 35 35 30 10; t=..14047550
              05f0 37 32 3b 20 78 3d 31 34 30 36 35 36 39 34 37 33 72; x=1406569473
              0600 3b 20 62 68 3d 61 58 58 54 61 52 79 47 62 66 2f ; bh=aXXTaRyGbf/
              0610 79 52 44 33 52 71 72 5a 79 62 4b 34 4d 64 62 43 yRD3RqrZybK4MdbC
              0620 68 69 58 6c 44 57 41 6c 0a 09 69 41 4f 55 4f 4f hiXlDWAl..iAOUOO
              0630 6a 49 3d 3b 20 62 3d 59 62 2b 69 66 31 55 48 47 jI=; b=Yb+if1UHG
              0640 2b 55 5a 77 51 56 51 47 63 44 5a 2b 50 2b 53 4a +UZwQVQGcDZ+P+SJ
              0650 54 72 36 47 79 57 39 54 6d 42 69 65 4f 67 34 68 Tr6GyW9TmBieOg4h
              0660 33 76 4a 76 6d 70 65 4b 58 63 0a 09 73 68 36 48 3vJvmpeKXc..sh6H
              0670 46 76 5a 75 6f 4d 36 50 54 41 6c 76 4e 31 4c 46 FvZuoM6PTAlvN1LF
              0680 6f 56 44 59 48 6a 39 6e 67 41 78 51 4b 6e 55 4c oVDYHj9ngAxQKnUL
              0690 33 62 36 78 2f 4c 2f 4d 6d 69 6c 72 32 41 67 32 3b6x/L/Mmilr2Ag2
              06a0 63 49 48 69 57 6b 78 7a 7a 51 65 33 0a 09 75 7a cIHiWkxzzQe3..uz
              06b0 4c 53 71 6d 49 64 5a 45 4e 68 35 45 4c 55 34 32 LSqmIdZENh5ELU42
              06c0 67 39 63 49 41 36 2b 2b 69 33 33 65 34 57 4f 63 g9cIA6++i33e4WOc
              06d0 68 62 76 46 39 59 55 38 5a 30 67 68 4c 5a 4d 31 hbvF9YU8Z0ghLZM1
              06e0 65 6a 54 44 76 56 71 66 75 36 4a 66 72 42 0a 09 ejTDvVqfu6JfrB..
              06f0 35 4f 51 62 4b 6a 39 57 79 64 6f 38 64 78 71 71 5OQbKj9Wydo8dxqq
              0700 2f 76 62 4a 69 70 4b 30 79 34 77 61 45 6c 73 64 /vbJipK0y4waElsd
              0710 78 47 41 37 2b 55 69 33 44 73 39 50 62 58 35 69 xGA7+Ui3Ds9PbX5i
              0720 57 4d 6f 79 31 65 37 4a 43 7a 35 78 46 78 35 54 WMoy1e7JCz5xFx5T
              0730 0a 09 72 42 66 62 6f 52 35 37 4b 55 43 38 2f 4a ..rBfboR57KUC8/J
              0740 73 46 62 35 58 49 76 67 32 35 35 32 6c 4e 32 37 sFb5XIvg2552lN27
              0750 42 34 48 78 42 65 50 62 49 75 4d 35 32 73 75 62 B4HxBePbIuM52sub
              0760 55 6a 38 48 77 48 56 46 54 4e 4b 57 70 72 4a 4e Uj8HwHVFTNKWprJN
              0770 73 65 0a 09 63 67 63 76 56 44 54 32 32 7a 63 31 se..cgcvVDT22zc1
              0780 4a 58 72 30 34 77 5a 43 61 2f 43 5a 78 51 33 64 JXr04wZCa/CZxQ3d
              0790 62 78 42 68 39 6f 77 3d 3d 00 00 00 00 14 44 4c bxBh9ow==.....DL
              07a0 69 00 33 68 36 5a 30 63 35 56 59 57 7a 47 70 31 i.3h6Z0c5VYWzGp1
              07b0 30 00 00 00 01 39 4c 52 65 63 65 69 76 65 64 00 0....9LReceived.
              07c0 66 72 6f 6d 20 5b 31 37 32 2e 31 36 2e 32 2e 32 from [172.16.2.2
              07d0 30 30 5d 20 28 73 74 61 74 69 63 2d 32 30 31 2d 00] (static-201-
              07e0 31 30 36 2e 64 65 6c 74 61 73 75 72 66 2e 64 65 106.deltasurf.de
              07f0 20 5b 31 39 33 2e 32 33 39 2e 31 30 36 2e 32 30 [193.239.106.20
              0800 31 5d 29 0a 09 28 75 73 69 6e 67 20 54 4c 53 76 1])..(using TLSv
              0810 31 20 77 69 74 68 20 63 69 70 68 65 72 20 45 43 1 with cipher EC
              0820 44 48 45 2d 52 53 41 2d 41 45 53 32 35 36 2d 53 DHE-RSA-AES256-S
              0830 48 41 20 28 32 35 36 2f 32 35 36 20 62 69 74 73 HA (256/256 bits
              0840 29 29 0a 09 28 4e 6f 20 63 6c 69 65 6e 74 20 63 ))..(No client c
              0850 65 72 74 69 66 69 63 61 74 65 20 72 65 71 75 65 ertificate reque
              0860 73 74 65 64 29 0a 09 62 79 20 6d 61 69 6c 2e 73 sted)..by mail.s
              0870 79 73 34 2e 64 65 20 28 50 6f 73 74 66 69 78 29 ys4.de (Postfix)
              0880 20 77 69 74 68 20 45 53 4d 54 50 53 41 20 69 64 with ESMTPSA id
              0890 20 33 68 36 5a 30 63 31 76 53 72 7a 37 54 0a 09 3h6Z0c1vSrz7T..
              08a0 66 6f 72 20 3c 63 40 72 6f 65 73 73 6e 65 72 2d for <c@roessner-
              08b0 6e 65 74 77 6f 72 6b 2d 73 6f 6c 75 74 69 6f 6e network-solution
              08c0 73 2e 63 6f 6d 3e 3b 20 4d 6f 6e 2c 20 20 37 20 s.com>; Mon, 7
              08d0 4a 75 6c 20 32 30 31 34 20 31 39 3a 34 34 3a 33 Jul 2014 19:44:3
              08e0 32 20 2b 30 32 30 30 20 28 43 45 53 54 29 00 00 2 +0200 (CEST)..
              08f0 00 00 14 44 4c 69 00 33 68 36 5a 30 63 35 56 59 ...DLi.3h6Z0c5VY
              0900 57 7a 47 70 31 30 00 00 00 00 39 4c 46 72 6f 6d WzGp10....9LFrom
              0910 00 3d 3f 69 73 6f 2d 38 38 35 39 2d 31 3f 51 3f .=?iso-8859-1?Q?
              0920 43 68 72 69 73 74 69 61 6e 5f 52 3d 46 36 3d 44 Christian_R=F6=D
              0930 46 6e 65 72 3f 3d 20 3c 63 72 40 73 79 73 34 2e Fner?= <cr@sys4.
              0940 64 65 3e 00 00 00 00 14 44 4c 69 00 33 68 36 5a de>.....DLi.3h6Z
              0950 30 63 35 56 59 57 7a 47 70 31 30 00 00 00 00 93 0c5VYWzGp10.....
              0960 4c 43 6f 6e 74 65 6e 74 2d 54 79 70 65 00 6d 75 LContent-Type.mu
              0970 6c 74 69 70 61 72 74 2f 73 69 67 6e 65 64 3b 20 ltipart/signed;
              0980 62 6f 75 6e 64 61 72 79 3d 22 41 70 70 6c 65 2d boundary="Apple-
              0990 4d 61 69 6c 3d 5f 37 39 34 35 37 41 31 33 2d 42 Mail=_79457A13-B
              09a0 46 34 41 2d 34 34 45 35 2d 39 41 42 44 2d 34 34 F4A-44E5-9ABD-44
              09b0 30 41 42 30 39 36 34 43 41 30 22 3b 20 70 72 6f 0AB0964CA0"; pro
              09c0 74 6f 63 6f 6c 3d 22 61 70 70 6c 69 63 61 74 69 tocol="applicati
              09d0 6f 6e 2f 70 67 70 2d 73 69 67 6e 61 74 75 72 65 on/pgp-signature
              09e0 22 3b 20 6d 69 63 61 6c 67 3d 70 67 70 2d 73 68 "; micalg=pgp-sh
              09f0 61 31 00 00 00 00 14 44 4c 69 00 33 68 36 5a 30 a1.....DLi.3h6Z0
              0a00 63 35 56 59 57 7a 47 70 31 30 00 00 00 00 0e 4c c5VYWzGp10.....L
              0a10 53 75 62 6a 65 63 74 00 54 65 73 74 00 00 00 00 Subject.Test....
              0a20 14 44 4c 69 00 33 68 36 5a 30 63 35 56 59 57 7a .DLi.3h6Z0c5VYWz
              0a30 47 70 31 30 00 00 00 00 3b 4c 4d 65 73 73 61 67 Gp10....;LMessag
              0a40 65 2d 49 64 00 3c 31 36 31 39 39 46 36 34 2d 42 e-Id.<16199F64-B
              0a50 36 34 36 2d 34 33 31 30 2d 38 42 31 37 2d 39 32 646-4310-8B17-92
              0a60 45 36 44 32 45 33 43 31 41 39 40 73 79 73 34 2e E6D2E3C1A9@sys4.
              0a70 64 65 3e 00 00 00 00 14 44 4c 69 00 33 68 36 5a de>.....DLi.3h6Z
              0a80 30 63 35 56 59 57 7a 47 70 31 30 00 00 00 00 25 0c5VYWzGp10....%
              0a90 4c 44 61 74 65 00 4d 6f 6e 2c 20 37 20 4a 75 6c LDate.Mon, 7 Jul
              0aa0 20 32 30 31 34 20 31 39 3a 34 34 3a 33 31 20 2b 2014 19:44:31 +
              0ab0 30 32 30 30 00 00 00 00 14 44 4c 69 00 33 68 36 0200.....DLi.3h6
              0ac0 5a 30 63 35 56 59 57 7a 47 70 31 30 00 00 00 00 Z0c5VYWzGp10....
              0ad0 4d 4c 54 6f 00 3d 3f 69 73 6f 2d 38 38 35 39 2d MLTo.=?iso-8859-
              0ae0 31 3f 51 3f 43 68 72 69 73 74 69 61 6e 5f 52 3d 1?Q?Christian_R=
              0af0 46 36 3d 44 46 6e 65 72 3f 3d 20 3c 63 40 72 6f F6=DFner?= <c@ro
              0b00 65 73 73 6e 65 72 2d 6e 65 74 77 6f 72 6b 2d 73 essner-network-s
              0b10 6f 6c 75 74 69 6f 6e 73 2e 63 6f 6d 3e 00 00 00 olutions.com>...
              0b20 00 14 44 4c 69 00 33 68 36 5a 30 63 35 56 59 57 ..DLi.3h6Z0c5VYW
              0b30 7a 47 70 31 30 00 00 00 00 31 4c 4d 69 6d 65 2d zGp10....1LMime-
              0b40 56 65 72 73 69 6f 6e 00 31 2e 30 20 28 4d 61 63 Version.1.0 (Mac
              0b50 20 4f 53 20 58 20 4d 61 69 6c 20 37 2e 33 20 5c OS X Mail 7.3 \
              0b60 28 31 38 37 38 2e 36 5c 29 29 00 00 00 00 14 44 (1878.6\)).....D
              0b70 4c 69 00 33 68 36 5a 30 63 35 56 59 57 7a 47 70 Li.3h6Z0c5VYWzGp
              0b80 31 30 00 00 00 00 20 4c 58 2d 4d 61 69 6c 65 72 10.... LX-Mailer
              0b90 00 41 70 70 6c 65 20 4d 61 69 6c 20 28 32 2e 31 .Apple Mail (2.1
              0ba0 38 37 38 2e 36 29 00 00 00 00 14 44 4e 69 00 33 878.6).....DNi.3
              0bb0 68 36 5a 30 63 35 56 59 57 7a 47 70 31 30 00 00 h6Z0c5VYWzGp10..
              0bc0 00 00 01 4e

              I know, it is a little bit hard so read, but I can not find the header inside this block. If I am disabling other amavis headers, to just have the X-Spam-Status for example, not even this is sent. So something happens that the very first header is never sent to the milter. Could this be a configuration error in my main.cf?

              grep milter main.cf:

              milter_default_action = accept
              smtpd_milters = inet:[::1]:10024,inet:[::1]:8892
              milter_connect_macros = j {daemon_name} {client_ptr} v
              milter_mail_macros = i {auth_type} {auth_authen} {auth_author} {mail_addr} {mail_host} {mail_mailer} {client_name}

              My milter is written in Python and is based on libmilter-1.0.2

              I am running Postfix 2.11.1

              The logs show that the header itself is seen with milter_header_checks:

              Jul 7 19:44:32 mx0 postfix/smtpd[32576]: connect from mail.sys4.de[194.126.158.139]:58220

              Jul 7 19:44:32 mx0 mymilter[31942]: id=11 connect from mail.sys4.de[194.126.158.139]:58220

              Jul 7 19:44:32 mx0 postfix/smtpd[32576]: Anonymous TLS connection established from mail.sys4.de[194.126.158.139]:58220: TLSv1 wit
              h cipher ECDHE-RSA-AES256-SHA (256/256 bits)
              Jul 7 19:44:32 mx0 smf-spf[4830]: SPF pass: ip=194.126.158.139, fqdn=mail.sys4.de, helo=mail.sys4.de, from=<cr@...>
              Jul 7 19:44:32 mx0 postfix/smtpd[32576]: 3h6Z0c5VYWzGp10: client=mail.sys4.de[194.126.158.139]:58220
              Jul 7 19:44:32 mx0 postfix/cleanup[32588]: 3h6Z0c5VYWzGp10: message-id=<16199F64-B646-4310-8B17-92E6D2E3C1A9@...>
              Jul 7 19:44:34 mx0 amavis[31336]: (31336-04) Passed CLEAN {AcceptedInbound}, AM.PDP-SOCK [194.126.158.139] [193.239.106.201] <cr@
              sys4.de> -> <c@...>, Queue-ID: 3h6Z0c5VYWzGp10, Message-ID: <16199F64-B646-4310-8B17-92E6D2E3C1A9@sys4.
              de>, mail_id: ci1MBoS78woE, Hits: -1.223, size: 2942, Tests: [AM.IP_BAD_194.126.158.139=0.6,BAYES_00=-0.2,DKIM_VALID=-0.1,DKIM_VALID_AU=-0.1,DKIM_VERIFIED=-0.1,RCVD_IN_DNSWL_LOW=-0.7,RP_MATCHES_RCVD=-0.652,SPF_PASS=-0.001], 1602 ms
              Jul 7 19:44:34 mx0 amavis[31336]: (31336-04) Passed CLEAN, <cr@...> -> <c@...>, Hits: -1.223, tag=0, tag2=3.3, kill=3.3, L/Y/0/0
              Jul 7 19:44:34 mx0 amavisd-milter[3978]: 3h6Z0c5VYWzGp10: log_id=31336-04
              Jul 7 19:44:34 mx0 amavisd-milter[3978]: 3h6Z0c5VYWzGp10: return_value=continue

              Jul 7 19:44:34 mx0 postfix/cleanup[32588]: 3h6Z0c5VYWzGp10: milter-header-warning: header X-Spam-Status: No, score=-1.223 required=3.3??tests=[AM.IP_B from mail.sys4.de[194.126.158.139]; from=<cr@...> to=<c@...> proto=ESMTP helo=<mail.sys4.de>: X-Spam-Status

              Jul 7 19:44:34 mx0 opendkim[15848]: 3h6Z0c5VYWzGp10: mail.sys4.de [194.126.158.139] not internal
              Jul 7 19:44:34 mx0 opendkim[15848]: 3h6Z0c5VYWzGp10: not authenticated
              Jul 7 19:44:34 mx0 opendkim[15848]: 3h6Z0c5VYWzGp10: not POP authenticated
              Jul 7 19:44:34 mx0 opendkim[15848]: 3h6Z0c5VYWzGp10: DKIM verification successful
              Jul 7 19:44:34 mx0 opendkim[15848]: 3h6Z0c5VYWzGp10: s=mail201310 d=sys4.de SSL

              Jul 7 19:44:34 mx0 mymilter[31942]: id=11 3h6Z0c5VYWzGp10 result=CONTINUE

              If you have any idea, what I am doing wrong, I really would be happy :)

              Kind regards

              -Christian Rößner

              --
              [*] sys4 AG

              http://sys4.de, +49 (89) 30 90 46 64
              Franziskanerstraße 15, 81669 München

              Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
              Vorstand: Patrick Ben Koetter, Marc Schiffbauer
              Aufsichtsratsvorsitzender: Florian Kirstein
            • Wietse Venema
              ... For Sendmail compatibility, Postfix does not show the first header line. I suggest that you put new content further down in the message. Wietse
              Message 6 of 12 , Jul 7, 2014
                Christian R??ner:
                >
                > I am currently trying to develop a milter for Postfix. I need all
                > headers from a mail. Unfortunately I found out that always the
                > very first header of an earlier milter is not visible in my milter.

                For Sendmail compatibility, Postfix does not show the first header
                line. I suggest that you put new content further down in the message.

                Wietse
              • Christian Rößner
                Hello, ... thank you for your answer. That helped a lot. ItÆs probably because I have sit for too long at the screen, I could not find this information in the
                Message 7 of 12 , Jul 7, 2014
                  Hello,

                  >> I am currently trying to develop a milter for Postfix. I need all
                  >> headers from a mail. Unfortunately I found out that always the
                  >> very first header of an earlier milter is not visible in my milter.
                  >
                  > For Sendmail compatibility, Postfix does not show the first header
                  > line. I suggest that you put new content further down in the message.

                  thank you for your answer. That helped a lot.

                  It’s probably because I have sit for too long at the screen, I could not find this information in the Postfix documentation.

                  As I have seen there are minor other compatibility things like {ip_addr}<->{client_addr}; I have a wish list feature, if that is not too complicated: can you please add an option that gives milters all headers? Think about milters that only have one header and that one is not sent to the milter. That was my problem with amavis today, as I only set the X-Spam-Status header. It took me around 8 hours of debugging until I asked on the list :-)

                  This is just a question. If that can not be included, never mind. I ask with lots of respect.

                  Kind regards

                  -Christian Rößner

                  --
                  [*] sys4 AG

                  http://sys4.de, +49 (89) 30 90 46 64
                  Franziskanerstraße 15, 81669 München

                  Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
                  Vorstand: Patrick Ben Koetter, Marc Schiffbauer
                  Aufsichtsratsvorsitzender: Florian Kirstein
                • Claus Assmann
                  ... Does the first header line refer to the (locally added) Received: header? If so, sendmail doesn t provide that to a milter as it is not sent by the
                  Message 8 of 12 , Jul 7, 2014
                    > For Sendmail compatibility, Postfix does not show the first header
                    > line. I suggest that you put new content further down in the message.

                    Does "the first header line" refer to the (locally added) Received:
                    header? If so, sendmail doesn't provide that to a milter as it is
                    not sent by the client. However, sendmail is supposed to follow
                    this description:

                    * For smfi_chgheader, filter order is important. Later filters
                    will see the header changes made by earlier ones.
                  • A. Schulze
                    ... christian, The milter API knows two ways to add header: 1) https://www.milter.org/developers/api/smfi_addheader 2)
                    Message 9 of 12 , Jul 7, 2014
                      Christian Rößner:

                      > Unfortunately I found out that always the very first header of an
                      > earlier milter is not visible in my milter.

                      christian,

                      The milter API knows two ways to add header:
                      1) https://www.milter.org/developers/api/smfi_addheader
                      2) https://www.milter.org/developers/api/smfi_insheader

                      insheader allow to specify a position. Position 0 is special: "Topmost".
                      I found that many milter use position 1, other use 0.

                      With milters calling insheader and hdridx=1 I never saw the problem
                      you described.

                      Andreas
                    • Wietse Venema
                      ... Hi Claus. Yes, Postfix does not send its own Received: header to the Milter (or whatever the first line is after Milters have modified the message). ... I
                      Message 10 of 12 , Jul 7, 2014
                        Claus Assmann:
                        > > For Sendmail compatibility, Postfix does not show the first header
                        > > line. I suggest that you put new content further down in the message.
                        >
                        > Does "the first header line" refer to the (locally added) Received:
                        > header?

                        Hi Claus. Yes, Postfix does not send its own Received: header to
                        the Milter (or whatever the first line is after Milters have modified
                        the message).

                        > If so, sendmail doesn't provide that to a milter as it is
                        > not sent by the client. However, sendmail is supposed to follow
                        > this description:
                        >
                        > * For smfi_chgheader, filter order is important. Later filters
                        > will see the header changes made by earlier ones.

                        I made an attempt to make "insert at the top" compatible with
                        Sendmail, and gave up 9 years ago.

                        * XXX Sendmail compatibility. Don't expose our first (received) header
                        * to mail filter applications. See also cleanup_milter.c for code to
                        * ensure that header replace requests are relative to the message
                        * content as received, that is, without our own first (received) header,
                        * while header insert requests are relative to the message as delivered,
                        * that is, including our own first (received) header.

                        I wonder if anything would break (other than Postfix backwards
                        compatibility) if I were to provide an option to make "Milter "header
                        insert" requests relative to the header that follows Postfix's own
                        Received: header.

                        Wietse
                      • Claus Assmann
                        Hello Wietse! ... So the second part is the problem here; thanks for the clarification. For MeTA1 I added a flag to the pmilter API so a milter can decide
                        Message 11 of 12 , Jul 7, 2014
                          Hello Wietse!

                          > Hi Claus. Yes, Postfix does not send its own Received: header to
                          > the Milter (or whatever the first line is after Milters have modified
                          > the message).

                          So the second part is the problem here; thanks for the clarification.
                          For MeTA1 I added a flag to the pmilter API so a milter can decide
                          whether it wants the internally generated Received: header -- I
                          learned a lot from the problems with the milter API :-)

                          > I wonder if anything would break (other than Postfix backwards
                          > compatibility) if I were to provide an option to make "Milter "header
                          > insert" requests relative to the header that follows Postfix's own
                          > Received: header.

                          That seems like a good approach to match what sendmail does.
                          However, I don't know the internals of postfix, so I have no idea
                          how complicated it is.
                        • Christian Rößner
                          Hi Andreas, ... the problem came up with amavis, because I have this in the config: $allowed_added_header_fields{lc( Received )} = 0;
                          Message 12 of 12 , Jul 8, 2014
                            Hi Andreas,

                            > The milter API knows two ways to add header:
                            > 1) https://www.milter.org/developers/api/smfi_addheader
                            > 2) https://www.milter.org/developers/api/smfi_insheader
                            >
                            > insheader allow to specify a position. Position 0 is special: "Topmost".
                            > I found that many milter use position 1, other use 0.
                            >
                            > With milters calling insheader and hdridx=1 I never saw the problem you described.

                            the problem came up with amavis, because I have this in the config:

                            $allowed_added_header_fields{lc('Received')} = 0;
                            $allowed_added_header_fields{lc('X-Virus-Scanned')} = 0;
                            $allowed_added_header_fields{lc('X-Spam-Flag')} = 0;
                            $allowed_added_header_fields{lc('X-Spam-Score')} = 0;
                            $allowed_added_header_fields{lc('X-DSPAM-Result')} = 1;
                            $allowed_added_header_fields{lc('X-DSPAM-Confidence')} = 1;
                            $allowed_added_header_fields{lc('X-DSPAM-Probability')} = 1;

                            $remove_existing_x_scanned_headers = 1;
                            $remove_existing_spam_headers = 1;
                            $allow_fixing_improper_header_folding = 1;
                            $allow_fixing_long_header_lines = 1;

                            With these flags, amavis only inserts the X-Spam-Status after it finishes. If a milter does not show the first header, amavis gets lost… That was the reason I came here :-)

                            As a workaround, I have enabled X-Spam-Flag and X-Spam-Score. The first gets lost again, but I don’t care (at the moment).

                            PM @Andreas: Feel free to call me. Milter has to do with OpenDKIM ;-)

                            Kind regards

                            -Christian Rößner

                            --
                            [*] sys4 AG

                            http://sys4.de, +49 (89) 30 90 46 64
                            Franziskanerstraße 15, 81669 München

                            Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
                            Vorstand: Patrick Ben Koetter, Marc Schiffbauer
                            Aufsichtsratsvorsitzender: Florian Kirstein
                          Your message has been successfully submitted and would be delivered to recipients shortly.