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

Postfix Content Filter

Expand Messages
  • Prasad R
    Hi, I am new to postfix and want to develop a content filter/milter that will need to perform the following activities. - get the full email content including
    Message 1 of 8 , Jun 19, 2013
    • 0 Attachment
      Hi,

      I am new to postfix and want to develop a content filter/milter that will need to perform the following activities.
      - get the full email content including headers, body
      - be able to adjust the email content before it goes to user, this could mean reject the message going to user.

      I checked in to the SendMail Milter APIs but postfix documentation said, its only used in Before Queue Content Filter and doesn't have access to the full content of the email. And I didn't find the SendMail Milter API support in the After Queue Content Filter of Postfix either and it recommends to use SMTP instead.

      Can you please suggest what is the best approach and if there are any open source projects that I can start with? Java option is better suited for me, if not python is also ok.

      Thanks,
      Prasad
    • Wietse Venema
      ... Your reading is incorrect. The Milter has access to the full content when it is NOT used before an smtpd_proxy_filter. Wietse
      Message 2 of 8 , Jun 19, 2013
      • 0 Attachment
        Prasad R:
        > I checked in to the SendMail Milter APIs but postfix documentation said,
        > its only used in Before Queue Content Filter and doesn't have access to the
        > full content of the email. And I didn't find the SendMail Milter API

        Your reading is incorrect. The Milter has access to the full content
        when it is NOT used before an smtpd_proxy_filter.

        Wietse
      • Prasad R
        Thank you Wietse. This is the link I was reading: http://www.postfix.org/MILTER_README.html and forth bullet from the bottom of the page. How can I configure
        Message 3 of 8 , Jun 19, 2013
        • 0 Attachment
          Thank you Wietse. This is the link I was reading: http://www.postfix.org/MILTER_README.html and forth bullet from the bottom of the page.
          How can I configure the milter to get access to full content and use it after smtpd_proxy_filter? Any pointers on the documentation?


          On Wed, Jun 19, 2013 at 5:41 PM, Wietse Venema <wietse@...> wrote:
          Prasad R:
          > I checked in to the SendMail Milter APIs but postfix documentation said,
          > its only used in Before Queue Content Filter and doesn't have access to the
          > full content of the email. And I didn't find the SendMail Milter API

          Your reading is incorrect. The Milter has access to the full content
          when it is NOT used before an smtpd_proxy_filter.

                  Wietse

        • Wietse Venema
          ... Documentation: man 5 master man 8 smtpd Example: /etc/postfix/master.cf # Before the smtpd-proxy-filter smtp ... ... ... ... smtpd -o
          Message 4 of 8 , Jun 19, 2013
          • 0 Attachment
            Prasad R:
            > Thank you Wietse. This is the link I was reading:
            > http://www.postfix.org/MILTER_README.html and forth bullet from the bottom
            > of the page.
            > How can I configure the milter to get access to full content and use it
            > after smtpd_proxy_filter? Any pointers on the documentation?

            Documentation:

            man 5 master
            man 8 smtpd

            Example:

            /etc/postfix/master.cf
            # Before the smtpd-proxy-filter
            smtp ... ... ... ... smtpd
            -o smtpd_proxy_filter=xxx
            # After the smtpd-proxy-filter
            127.0.0.1:10025 ... ... ... ... smtpd
            -o smtpd_milters=yyy

            Wietse
          • Venkat R
            Thank you Wieste. Sorry for the repetition but the python or the Java version of the jitler a good option? My use case is very basic so Java is much preferred
            Message 5 of 8 , Jun 19, 2013
            • 0 Attachment
              Thank you Wieste. Sorry for the repetition but the python or the Java version of the jitler a good option? My use case is very basic so Java is much preferred for milter development if jitler framework work with the postfix.

              Anyone tried Java version of the milter to get full email content with postfox?

              From: Wietse Venema
              Sent: ‎6/‎19/‎2013 6:03 PM
              To: Postfix users
              Subject: Re: Postfix Content Filter

              Prasad R:
              > Thank you Wietse. This is the link I was reading:
              > http://www.postfix.org/MILTER_README.html and forth bullet from the bottom
              > of the page.
              > How can I configure the milter to get access to full content and use it
              > after smtpd_proxy_filter? Any pointers on the documentation?

              Documentation:

                  man 5 master
                  man 8 smtpd

              Example:

              /etc/postfix/master.cf
                  # Before the smtpd-proxy-filter
                  smtp     ... ... ... ... smtpd
              -o smtpd_proxy_filter=xxx
                  # After the smtpd-proxy-filter
                  127.0.0.1:10025 ... ... ... ... smtpd
              -o smtpd_milters=yyy

              Wietse
            • Wietse Venema
              ... I wrote Postfix, and don t use every milter in the universe. Wietse
              Message 6 of 8 , Jun 19, 2013
              • 0 Attachment
                Venkat R:
                > Thank you Wieste. Sorry for the repetition but the python or the Java vers
                >-ion of the jitler a good option? My use case is very basic so Java is much p
                >-referred for milter development if jitler framework work with the postfix.

                I wrote Postfix, and don't use every milter in the universe.

                Wietse
              • Sharma, Ashish
                Prasad, After going through the mail thread, following are my advices for you: 1. sendmail-jilter (http://sendmail-jilter.sourceforge.net/) works on mail
                Message 7 of 8 , Jun 20, 2013
                • 0 Attachment
                  Prasad,

                  After going through the mail thread, following are my advices for you:

                  1. sendmail-jilter (http://sendmail-jilter.sourceforge.net/) works on mail filter protocol, since Postfix also supports mail filter protocol, so it works with Postfix.

                  Use following settings in your postfix 'main.cf' for sendmail-jilter to work properly with your Postfix setup:

                  #Milter support for smtpd mail
                  smtpd_milters =
                  inet:localhost:10028

                  milter_default_action = reject

                  milter_protocol = 2


                  You need to launch your mail filter (using sendmail -jilter) to be running on local machine port 10028 (any number you please).

                  2. You can use subethasmtp (http://code.google.com/p/subethasmtp/), if you want to use a content filter for the tasks that you have mentioned.

                  Use following settings in your postfix 'main.cf':

                  content_filter = scan:localhost:10030


                  Keep in mind that if you want to re-inject the emails back to postfix, you need to do appropriate settings in your 'master.cf' (refer postfix documentation).

                  As a general rule I put relatively less time consuming / lightweight tasks for mail filter while other tasks I put in the content filter.

                  Thanks
                  Ashish

                  -----Original Message-----
                  From: owner-postfix-users@... [mailto:owner-postfix-users@...] On Behalf Of Wietse Venema
                  Sent: Thursday, June 20, 2013 4:28 AM
                  To: Postfix users
                  Subject: Re: Postfix Content Filter

                  Venkat R:
                  > Thank you Wieste. Sorry for the repetition but the python or the Java
                  >vers -ion of the jitler a good option? My use case is very basic so
                  >Java is much p -referred for milter development if jitler framework work with the postfix.

                  I wrote Postfix, and don't use every milter in the universe.

                  Wietse
                • Venkat R
                  Thank you Ashish. ... From: Sharma, Ashish Sent: ‎6/‎20/‎2013 7:01 AM To: Postfix users Subject:
                  Message 8 of 8 , Jun 20, 2013
                  • 0 Attachment
                    Thank you Ashish.

                    From: Sharma, Ashish
                    Sent: ‎6/‎20/‎2013 7:01 AM
                    To: Postfix users
                    Subject: RE: Postfix Content Filter

                    Prasad,

                    After going through the mail thread, following are my advices for you:

                    1. sendmail-jilter (http://sendmail-jilter.sourceforge.net/) works on mail filter protocol, since Postfix also supports mail filter protocol, so it works with Postfix.

                    Use following settings in your postfix 'main.cf' for sendmail-jilter to work properly with your Postfix setup:

                    #Milter support for smtpd mail
                    smtpd_milters =
                      inet:localhost:10028

                    milter_default_action = reject

                    milter_protocol = 2


                    You need to launch your mail filter (using sendmail -jilter) to be running on local machine port 10028 (any number you please).

                    2. You can use subethasmtp (http://code.google.com/p/subethasmtp/), if you want to use a content filter for the tasks that you have mentioned.

                    Use following settings in your postfix 'main.cf':

                    content_filter = scan:localhost:10030


                    Keep in mind that if you want to re-inject the emails back to postfix, you need to do appropriate settings in your 'master.cf' (refer postfix documentation).

                    As a general rule I put relatively less time consuming / lightweight tasks for mail filter while other tasks I put in the content filter.

                    Thanks
                    Ashish

                    -----Original Message-----
                    From: owner-postfix-users@... [mailto:owner-postfix-users@...] On Behalf Of Wietse Venema
                    Sent: Thursday, June 20, 2013 4:28 AM
                    To: Postfix users
                    Subject: Re: Postfix Content Filter

                    Venkat R:
                    > Thank you Wieste. Sorry for the repetition but the python or the Java
                    >vers -ion of the jitler a good option? My use case is very basic so
                    >Java is much p -referred for milter development if jitler framework work with the postfix.

                    I wrote Postfix, and don't use every milter in the universe.

                    Wietse
                  Your message has been successfully submitted and would be delivered to recipients shortly.