Virtual Domains With Postfix and MailScanner - forwardings "eaten"

Discussion in 'HOWTO-Related Questions' started by Ravenium, Jun 10, 2008.

  1. Ravenium

    Ravenium New Member

    Ok, this one has me stumped. I recently upgraded my mail server according to the CentOS/MailScanner/Postfix tutorial (with some side steps to disable amavis and all the older cruft). Everything works well EXCEPT:

    1. If I send an email to [email protected], it is received.

    2. If I send an email to [email protected] (which is a shorthand forwarding to [email protected], much as bob@domain would be a forwarding for bob.smith@domain), it gets "eaten".

    Ok, I should define eaten a little better. It clears MailScanner just fine, but for some reason postfix/qmgr lists "bounced" with the reason of "unknown user". It almost looks as if it's trying to deliver it locally instead of checking the virtual recipient tables in mysql...

    But, why would this happen only for forwards/aliases and not mailboxes? It's the same set of mysql tables/access...
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Can you post the exact error message from the mail log?
    What's in /etc/postfix/main.cf?
     
  3. Ravenium

    Ravenium New Member

    Weirdly, it now works. I'm still getting the occasional spam message (I need to read how to train mailscanner for false negatives, whereas false positives seems to be easy enough).

    Below is an example of a message that bounced, then one that did not with no more than a simple restart (I didn't make any config changes). The only difference other than the bounce that I see is that MailScanner apparently did not report success logging the message.

    Here's one that bounced:

    Code:
    Jun  9 22:19:47 l6 postfix/smtpd[18492]: 55396D180C1: client=cmp3.originhost[x.x.x.x]
    Jun  9 22:19:47 l6 postfix/cleanup[18735]: 55396D180C1: hold: header Received: from cmp3.originhost (cmp3.originhost [x.x.x.x])??by mailserver.mydomain.com (Postfix) with ESMTP id 55396D180C1??for <virtualalias@mydomain>; Mon,  9 Jun 2008 22:19:47 -0500 (CDT) from cmp3.originhost[167.219.4.36]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp3.originhost>
    Jun  9 22:19:47 l6 postfix/cleanup[18735]: 55396D180C1: hold: header Received: from bna6.originhost (bna6.originhost [y.y.y.y]) by cmp3.originhost with ESMTP id BT-MMP-88815 for virtualalias@mydomain; Tue, 10 Jun 2008 03:19:47 Z from cmp3.originhost[167.219.4.36]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp3.originhost>
    Jun  9 22:19:47 l6 postfix/cleanup[18735]: 55396D180C1: hold: header Received: from uscnt0483.us.originhost ([y.y.y.y] [y.y.y.y]) by bna6.originhost with ESMTP id BT-MMP-118278 for virtualalias@mydomain; Tue, 10 Jun 2008 03:19:47 Z from cmp3.originhost[167.219.4.36]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp3.originhost>
    Jun  9 22:19:47 l6 postfix/cleanup[18735]: 55396D180C1: hold: header Received: from uscnt0406.us.originhost ([y.y.y.y]) by uscnt0483.us.originhost with Microsoft SMTPSVC(6.0.3790.2499);?? Mon, 9 Jun 2008 22:19:47 -0500 from cmp3.originhost[167.219.4.36]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp3.originhost>
    Jun  9 22:19:47 l6 postfix/cleanup[18735]: 55396D180C1: message-id=<[email protected]>
    Jun  9 22:19:50 l6 MailScanner[14967]: Requeue: 55396D180C1.C9869 to 485BFD180C
    Jun  9 22:19:50 l6 MailScanner[14967]: Logging message 55396D180C1.C9869 to SQL
    Jun  9 22:19:50 l6 postfix/qmgr[14762]: 485BFD180CC: from=<sender@originhost>, size=5277, nrcpt=1 (queue active)
    Jun  9 22:19:50 l6 postfix/virtual[20075]: 485BFD180CC: to=<virtualalias@mydomain>, relay=virtual, delay=3, status=bounced (unknown user: "virtualalias@mydomain")
    Jun  9 22:19:50 l6 postfix/qmgr[14762]: 485BFD180CC: removed
    And less than a day later, it decided to start working:

    Code:
    Jun 11 13:32:24 l6 postfix/smtpd[17935]: 0A72610F203D: client=cmp1.originhost[x.x.x.x]
    Jun 11 13:32:24 l6 postfix/cleanup[21053]: 0A72610F203D: hold: header Received: from cmp1.originhost (cmp1.originhost [x.x.x.x])??by mailserver.mydomain.com (Postfix) with ESMTP id 0A72610F203D??for <virtualalias@mydomain>; Wed, 11 Jun 2008 13:32:24 -0500 (CDT) from cmp1.originhost[167.219.4.34]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp1.originhost>
    Jun 11 13:32:24 l6 postfix/cleanup[21053]: 0A72610F203D: hold: header Received: from bna5.originhost (bna5.originhost [y.y.y.y]) by cmp1.originhost with ESMTP id BT-MMP-194990 for virtualalias@mydomain; Wed, 11 Jun 2008 18:29:56 Z from cmp1.originhost[167.219.4.34]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp1.originhost>
    Jun 11 13:32:24 l6 postfix/cleanup[21053]: 0A72610F203D: hold: header Received: from uscnt0483.us.originhost ([y.y.y.y] [10.26.30.83]) by bna5.originhost with ESMTP id BT-MMP-171483 for virtualalias@mydomain; Wed, 11 Jun 2008 18:29:56 Z from cmp1.originhost[167.219.4.34]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp1.originhost>
    Jun 11 13:32:24 l6 postfix/cleanup[21053]: 0A72610F203D: hold: header Received: from uscnt0406.us.originhost ([y.y.y.y]) by uscnt0483.us.originhost with Microsoft SMTPSVC(6.0.3790.2499);?? Wed, 11 Jun 2008 13:29:56 -0500 from cmp1.originhost[167.219.4.34]; from=<sender@originhost> to=<virtualalias@mydomain> proto=ESMTP helo=<cmp1.originhost>
    Jun 11 13:32:24 l6 postfix/cleanup[21053]: 0A72610F203D: message-id=<[email protected]>
    Jun 11 13:32:27 l6 MailScanner[17119]: Requeue: 0A72610F203D.67B64 to 0C20110F2041
    Jun 11 13:32:27 l6 MailScanner[17119]: Logging message 0A72610F203D.67B64 to SQL
    Jun 11 13:32:27 l6 MailScanner[17379]: 0A72610F203D.67B64: Logged to MailWatch SQL
    Jun 11 13:32:27 l6 postfix/qmgr[12392]: 0C20110F2041: from=<sender@originhost>, size=5346, nrcpt=1 (queue active)
    Jun 11 13:32:27 l6 postfix/virtual[21659]: 0C20110F2041: to=<real.user.mailbox@mydomain>, orig_to=<virtualalias@mydomain>, relay=virtual, delay=3, status=sent (delivered to maildir)
    Jun 11 13:32:27 l6 postfix/qmgr[12392]: 0C20110F2041: removed
    My main.cf:

    Code:
    myhostname = mailserver.mydomain.com
    mydestination = mailserver.mydomain.com, localhost, localhost.localdomain
    mynetworks = 127.0.0.0/8, my.network.subdomain/24
    virtual_alias_domains =
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.cf, hash:/etc/mailman/virtual-mailman
    virtual_mailbox_domains = proxy:mysql:/etc/postfix/mysql-virtual_domains.cf
    virtual_mailbox_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailboxes.cf
    virtual_mailbox_base = /home/vmail
    virtual_uid_maps = static:5000
    virtual_gid_maps = static:5000
    smtpd_sasl_auth_enable = yes
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    smtpd_use_tls = yes
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_delay_reject = yes
    smtpd_helo_required = yes
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    virtual_create_maildirsize = yes
    virtual_mailbox_extended = yes
    virtual_mailbox_limit_maps = proxy:mysql:/etc/postfix/mysql-virtual_mailbox_limit_maps.cf
    virtual_mailbox_limit_override = yes
    virtual_maildir_limit_message = "The user you are trying to reach is over quota."
    virtual_overquota_bounce = yes
    proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $virtual_mailbox_limit_maps
    
    #receive_override_options = no_address_mappings
    #default_process_limit = 150
    #smtpd_recipient_limit = 10000
    #qmgr_message_active_limit = 40000
    #qmgr_message_recipient_limit = 40000
    #message_size_limit = 40960000
    
    Now the only other comment I have is that those last few options appeared to be added by another admin and I am not sure why. I commented them out during my upgrade, but I didn't think any of them seemed to be at fault for what was happening.

    Edit: Ok, I take that back - no_address_mappings seems to be a legacy setting from mailman and/or amavis. According to the postfix site:

    Code:
    no_address_mappings
        Disable canonical address mapping, virtual alias map expansion, address masquerading, and automatic BCC (blind carbon-copy) recipients. This is typically specified BEFORE an external content filter.
    Could this be what was causing it? Since MailScanner isn't an "external" content filter persay (not sure where it inserts itself into the process, to be honest), this option seems to be what would fubar it. I just want to make sure as there's talk of upgrading the hardware and I might have to do this all again!

    Thanks!
     

Share This Page