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

Re: Postfix and archiving

Expand Messages
  • Mark Martinec
    Ritesh, ... One possibility is to use amavisd-new in a normal content filtering setup, enabling archive quarantine to SQL, and disabling all checks which are
    Message 1 of 10 , Jun 1, 2007
      Ritesh,

      > We have a postfix server running without any problem. Now for an
      > internal application we need to store (backup) all the incoming and
      > outgoing mails to a MySQL database.

      One possibility is to use amavisd-new in a normal content filtering
      setup, enabling archive quarantine to SQL, and disabling all checks
      which are not needed. It stores unmodified mail to a table 'quarantine',
      (chopped to $sql_quarantine_chunksize_max sizes if desired, enabling
      storage of arbitrary size mail regardless of SQL limitations), and
      it stores envelope data (sender, recipients, etc) to table 'msgs' and
      associates. See README_FILES/README.sql* for details.

      The following is a complete amavisd.conf file needed for such a setup.
      It assumes SQL database is PostgreSQL (but can also work with MySQL),
      and assumes the version of amavisd-new is the most recent (2.5.1) :

      =================
      use strict;

      # disable all checks if they are not needed
      $bypass_decode_parts = 1;
      @bypass_virus_checks_maps = (1);
      @bypass_spam_checks_maps = (1);
      @bypass_header_checks_maps = (1);
      @bypass_banned_checks_maps = (1);
      @banned_filename_maps = ();

      $max_servers = 10;

      $log_level = 0; # verbosity 0..5
      $log_recip_templ = undef; # disable by-recipient level-0 log entries
      $syslog_facility = 'mail'; # Syslog facility as a string
      $syslog_priority = 'debug'; # Syslog base (minimal) priority as a string
      $DO_SYSLOG = 1; # log via syslogd (preferred)

      @local_domains_maps = ([ '.example.com' ]); # list of all local domains

      $inet_socket_port = 10024; # listen on this local TCP port(s)
      $forward_method = 'smtp:[127.0.0.1]:10025'; # forward to MTA

      $daemon_user = 'vscan';
      $daemon_group = 'vscan';

      @storage_sql_dsn =
      ([ 'DBI:Pg:database=mail_log', 'vscan', 'hj9hXXXaa' ]);

      $archive_quarantine_method = 'sql:';

      =================


      It would also be posible to disable mail forwarding from amavisd
      back to MTA:
      $forward_method = undef;
      but in this case Postfix needs to be configured to feed a COPY of
      each mail to amavisd, as it would not be comming back.

      Mark
    • Gerard Seibert
      ... Procmail is a resource hound, not to mention it has a nasty rule fall through habit. I would recommend staying as far away from that beast as possible.
      Message 2 of 10 , Jun 1, 2007
        On Thursday May 31, 2007 at 10:38:51 (PM) Evan Platt wrote:


        > >We have a postfix server running without any problem. Now for an
        > >internal application we need to store (backup) all the incoming and
        > >outgoing mails to a MySQL database.
        > >
        > >A similar solution is given at
        > >http://www.dbmail.org/dokuwiki/doku.php?id=archiving-howto but this
        > >only works if all the mails are stored in the MySQL database.
        > >
        > >What I want is that all the emails are stored in normal mailboxes but
        > >after storing them, postfix calls one of our application with the
        > >actual email that we can parse and insert it to the database.
        > >
        > >Thus what we basically want is that after sending/receiving mail
        > >Postfix calls another process with the email passed as parameter that
        > >we can use for further purposes.
        > >
        > >Any pointers on the same would be appreciated?
        >
        > Couldn't you use a procmail recipe, or am I missing something?

        Procmail is a resource hound, not to mention it has a nasty rule 'fall
        through' habit. I would recommend staying as far away from that beast as
        possible.

        --
        Gerard
      • Wietse Venema
        ... ~user/.forward: username, |/command/of/database See man 8 local section SYSTEM-WIDE AND USER-LEVEL ALIASING . Wietse
        Message 3 of 10 , Jun 1, 2007
          > >> >What I want is that all the emails are stored in normal mailboxes but
          > >> >after storing them, postfix calls one of our application with the
          > >> >actual email that we can parse and insert it to the database.
          > >> >
          > >> >Thus what we basically want is that after sending/receiving mail
          > >> >Postfix calls another process with the email passed as parameter that
          > >> >we can use for further purposes.

          ~user/.forward:
          username, "|/command/of/database"

          See "man 8 local" section "SYSTEM-WIDE AND USER-LEVEL ALIASING".

          Wietse
        • Ritesh Nadhani
          Thank you for all the replied. I will use this weekend to look up all the solutions provided by all. ... -- Ritesh http://www.riteshn.com
          Message 4 of 10 , Jun 1, 2007
            Thank you for all the replied. I will use this weekend to look up all
            the solutions provided by all.

            On 6/1/07, Wietse Venema <wietse@...> wrote:
            > > >> >What I want is that all the emails are stored in normal mailboxes but
            > > >> >after storing them, postfix calls one of our application with the
            > > >> >actual email that we can parse and insert it to the database.
            > > >> >
            > > >> >Thus what we basically want is that after sending/receiving mail
            > > >> >Postfix calls another process with the email passed as parameter that
            > > >> >we can use for further purposes.
            >
            > ~user/.forward:
            > username, "|/command/of/database"
            >
            > See "man 8 local" section "SYSTEM-WIDE AND USER-LEVEL ALIASING".
            >
            > Wietse
            >


            --
            Ritesh
            http://www.riteshn.com
          Your message has been successfully submitted and would be delivered to recipients shortly.