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

Need a nudge in the right direction (trivial-rewrite/cleanup)

Expand Messages
  • Thomas Polliard
    Good Day all, I am trying to get the virtual_alias_map working with my setup. I have an address home@example.com that will go to two other address, because
    Message 1 of 3 , May 24, 2013
    • 0 Attachment
      Good Day all,

      I am trying to get the virtual_alias_map working with my setup.  I have an address home@... that will go to two other address, because after all the wife has to know everything I know ;).  

      My pgsql query line is: 

      select array_to_string(array_agg(destination),',') from postfix.alias_destination where alias = (select alias_id from postfix.alias_map where alias = 'home@...');

      This returns a comma separated list of destinations.
             destination             
      -----------------------------------------
      thomas@...,olivia@...

      postman works perfectly.

      I send mail home@... < /etc/group and I see the following in the logs:

      May 24 10:01:03 helios postfix/pickup[25429]: D1DDF807AA: uid=0 from=<root>
      May 24 10:01:03 helios postfix/cleanup[25472]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "thomas@..." -- ignored
      May 24 10:01:03 helios postfix/cleanup[25472]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "@example.com" -- ignored
      May 24 10:01:03 helios postfix/cleanup[25472]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "olivia@..." -- ignored
      May 24 10:01:03 helios postfix/cleanup[25472]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "@example.com" -- ignored
      May 24 10:01:03 helios postfix/cleanup[25472]: D1DDF807AA: message-id=<20130524100103.D1DDF807AA@...>
      May 24 10:01:03 helios postfix/qmgr[25430]: D1DDF807AA: from=<root@...>, size=1052, nrcpt=2 (queue active)
      May 24 10:01:04 helios postfix/smtpd[25477]: connect from localhost[127.0.0.1]
      May 24 10:01:04 helios postfix/trivial-rewrite[25473]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "helios.example.com" -- ignored
      May 24 10:01:04 helios postfix/trivial-rewrite[25473]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "example.com" -- ignored
      May 24 10:01:04 helios postfix/smtpd[25477]: 3D1DF80779: client=localhost[127.0.0.1]
      May 24 10:01:04 helios postfix/trivial-rewrite[25473]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "example.com" -- ignored
      May 24 10:01:04 helios postfix/cleanup[25472]: 3D1DF80779: message-id=<20130524100103.D1DDF807AA@...>
      May 24 10:01:04 helios postfix/qmgr[25430]: 3D1DF80779: from=<root@...>, size=1645, nrcpt=2 (queue active)
      May 24 10:01:04 helios postfix/smtpd[25477]: disconnect from localhost[127.0.0.1]
      May 24 10:01:04 helios postfix/trivial-rewrite[25473]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "example.com" -- ignored
      May 24 10:01:04 helios postfix/trivial-rewrite[25473]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "example.com" -- ignored
      May 24 10:01:04 helios amavis[24990]: (24990-03) Passed CLEAN {RelayedInbound}, <root@...> -> <olivia@...>,<thomas@...>, Message-ID: <20130524100103.D1DDF807AA@...>, mail_id: gx_E_LOedP5f, Hits: 1.767, size: 1052, queued_as: 3D1DF80779, 368 ms
      May 24 10:01:04 helios postfix/lmtp[25474]: D1DDF807AA: to=<olivia@...>, orig_to=<home@...>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.44, delays=0.05/0.01/0/0.38, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 3D1DF80779)
      May 24 10:01:04 helios postfix/lmtp[25474]: D1DDF807AA: to=<thomas@...>, orig_to=<home@...>, relay=127.0.0.1[127.0.0.1]:10024, delay=0.44, delays=0.05/0.01/0/0.38, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[127.0.0.1]:10025): 250 2.0.0 Ok: queued as 3D1DF80779)
      May 24 10:01:04 helios postfix/qmgr[25430]: D1DDF807AA: removed
      May 24 10:01:04 helios postfix/virtual[25478]: 3D1DF80779: to=<olivia@...>, relay=virtual, delay=0.06, delays=0.01/0.03/0/0.02, dsn=2.0.0, status=sent (delivered to maildir)
      May 24 10:01:04 helios postfix/virtual[25478]: 3D1DF80779: to=<thomas@...>, relay=virtual, delay=0.07, delays=0.01/0.03/0/0.03, dsn=2.0.0, status=sent (delivered to maildir)
      May 24 10:01:04 helios postfix/qmgr[25430]: 3D1DF80779: removed



      my postconf -n is: 

      broken_sasl_auth_clients = yes
      command_directory = /usr/sbin
      config_directory = /etc/postfix
      content_filter = amavisfeed:[127.0.0.1]:10024
      daemon_directory = /usr/libexec/postfix
      data_directory = /var/lib/postfix
      debug_peer_level = 2
      home_mailbox = Maildir/
      html_directory = no
      inet_interfaces = $myhostname, localhost
      inet_protocols = ipv4
      local_recipient_maps = 
      mail_owner = postfix
      mail_spool_directory = /var/spool/mail
      mailq_path = /usr/bin/mailq.postfix
      manpage_directory = /usr/share/man
      mydestination = $myhostname, localhost.$mydomain, localhost
      myhostname = helios.example.com
      mynetworks = 1.1.1.19/32, 2.2.2.22/32, 127.0.0.0/8
      mynetworks_style = subnet
      myorigin = $myhostname
      newaliases_path = /usr/bin/newaliases.postfix
      queue_directory = /var/spool/postfix
      sendmail_path = /usr/sbin/sendmail.postfix
      setgid_group = postdrop
      smtpd_recipient_restrictions = permit_mynetworks,    permit_sasl_authenticated,    reject_unauth_destination,    reject_invalid_hostname,    reject_unauth_pipelining,    reject_non_fqdn_sender,    reject_unknown_sender_domain, reject_non_fqdn_recipient,    reject_unknown_recipient_domain,    reject_rbl_client relays.ordb.org,    reject_rbl_client blackholes.easynet.nl,    reject_rbl_client cbl.abuseat.org,    reject_rbl_client proxies.blackholes.wirehub.net,    reject_rbl_client bl.spamcop.net,    reject_rbl_client sbl.spamhaus.org,    permit
      smtpd_sasl_auth_enable = yes
      smtpd_sasl_local_domain = $myhostname
      smtpd_sasl_path = private/auth
      smtpd_sasl_security_options = noanonymous
      smtpd_sasl_type = dovecot
      unknown_local_recipient_reject_code = 550
      virtual_alias_maps = pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf
      virtual_gid_maps = static:2000
      virtual_mailbox_base = /prod/mail
      virtual_mailbox_domains = pgsql:/etc/postfix/pgsql/virtual_mailbox_domains.cf
      virtual_mailbox_maps = pgsql:/etc/postfix/pgsql/virtual_mailbox_maps.cf
      virtual_minimum_uid = 2000
      virtual_transport = virtual
      virtual_uid_maps = static:2000

      So.. I must not understand what is happening during the cleanup and trivial-rewrite. The examples I have seen for doing this always seem to return a single address but if I were to use a hash:/etc/postfix/aliases.db it would "work" returning multiple addresses.  Knowing that means I don't know enough about the actual process :(

      I have read the man pages but have not cracked the code open.  I am missing something fundamental.

      Any help or sections in docs that could point me in the right direction would be appreciated…..

      I am guessing that my fundamental question is.. Why when the mail is destined for home@... and the database spits back thomas@...olivia@... does it attempted to do all possible iterations.  I know its a config problem, just not sure where else to look after 4 hours of configuring this thing (from scratch).  It could be that 24 hours no sleep makes me miss the obvious

      Thanks for your time and help in advance,

      Thomas 


    • Viktor Dukhovni
      ... You re working too hard, Postfix automatically handles multiple result rows, no need to do aggregation. ... Test with postmap -q ... . This should return
      Message 2 of 3 , May 24, 2013
      • 0 Attachment
        On Fri, May 24, 2013 at 04:37:25PM -0400, Thomas Polliard wrote:

        > select array_to_string(array_agg(destination),',')
        > from postfix.alias_destination
        > where alias = (select alias_id
        > from postfix.alias_map
        > where alias = 'home@...');

        You're working too hard, Postfix automatically handles multiple
        result rows, no need to do aggregation.

        > This returns a comma separated list of destinations.
        > destination
        > -----------------------------------------
        > thomas@...,olivia@...

        Test with "postmap -q ...". This should return multiple output lines
        one per recipient.

        > May 24 10:01:03 helios postfix/pickup[25429]: D1DDF807AA: uid=0 from=<root>
        > May 24 10:01:03 helios postfix/cleanup[25472]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "thomas@..." -- ignored

        Perhaps a side-effect of the aggregation returning an empty string rather
        than 0 rows.

        For further help post the postgres table definition .cf file and the
        output of postmap -f -q "home@..." pgsql:/path/to/table.cf

        --
        Viktor.
      • Thomas Polliard
        VIKTOR!!!!! You are the best!!!! Thank you SOO much, I seemed to miss the part of the doc that stated it could handle multiple rows!!!!! Thank you, thank you,
        Message 3 of 3 , May 24, 2013
        • 0 Attachment
          VIKTOR!!!!!

          You are the best!!!!


          Thank you SOO much, I seemed to miss the part of the doc that stated it could handle multiple rows!!!!!

          Thank you, thank you, thank you!

          Thomas
          On May 24, 2013, at 4:57 PM, Viktor Dukhovni <postfix-users@...> wrote:

          > On Fri, May 24, 2013 at 04:37:25PM -0400, Thomas Polliard wrote:
          >
          >> select array_to_string(array_agg(destination),',')
          >> from postfix.alias_destination
          >> where alias = (select alias_id
          >> from postfix.alias_map
          >> where alias = 'home@...');
          >
          > You're working too hard, Postfix automatically handles multiple
          > result rows, no need to do aggregation.
          >
          >> This returns a comma separated list of destinations.
          >> destination
          >> -----------------------------------------
          >> thomas@...,olivia@...
          >
          > Test with "postmap -q ...". This should return multiple output lines
          > one per recipient.
          >
          >> May 24 10:01:03 helios postfix/pickup[25429]: D1DDF807AA: uid=0 from=<root>
          >> May 24 10:01:03 helios postfix/cleanup[25472]: warning: table "pgsql:/etc/postfix/pgsql/virtual_alias_maps.cf": empty lookup result for: "thomas@..." -- ignored
          >
          > Perhaps a side-effect of the aggregation returning an empty string rather
          > than 0 rows.
          >
          > For further help post the postgres table definition .cf file and the
          > output of postmap -f -q "home@..." pgsql:/path/to/table.cf
          >
          > --
          > Viktor.
        Your message has been successfully submitted and would be delivered to recipients shortly.