Virtual Users/Virtual Domains forwarding issues.

Discussion in 'HOWTO-Related Questions' started by superczar, May 9, 2008.

  1. superczar

    superczar New Member

    I have a personal email server configured on Hardy, and it works fine for real users both sending and receiving email.

    But I have several addresses that I intend to use as forwards to other emails and forwarding is completely broken.

    I have configured my system according to this guide (with small modifications):
    http://www.howtoforge.com/virtual-users-and-domains-with-postfix-ubuntu-7.10

    Here is my /etc/postfix/main.cf
    Code:
    myorigin = /etc/mailname
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    append_dot_mydomain = no
    smtpd_tls_cert_file = /etc/postfix/smtpd.cert
    smtpd_tls_key_file = /etc/postfix/smtpd.key
    smtpd_use_tls = yes
    smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
    myhostname = mail.thirdrate.info
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = localhost, localhost.localdomain
    relayhost = 
    mynetworks = 127.0.0.0/8
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf
    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_helo_restrictions = permit_mynetworks, permit_sasl_authenticated
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
    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_mailboxes_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
    readme_directory = /usr/share/doc/postfix
    html_directory = /usr/share/doc/postfix/html
    
    and here is the mysql-virtual_forwardings.cf that is referred to:
    Code:
    user = [mail_admin]
    password = [password]
    dbname = mail
    query = SELECT destination FROM forwardings WHERE source='%s'
    hosts = 127.0.0.1
    
    The sql username and password are correct in the file, and the table is populated correctly but when I send an email to the address I get the following error:
    Code:
    postfix/virtual[4816]: F132150078: to=<admin@[example.com]>, relay=virtual, delay=0.12, delays=0.1/0/0/0.02, dsn=5.1.1, status=undeliverable (unknown user: "admin@[example.com]")
    
    Any suggestions?

    Note: items in square brackets [] have been intentionally changed for posting.
     
  2. falko

    falko Super Moderator

    Are there any other errors in your mail log?
    Did you switch off AppArmor?
     
  3. superczar

    superczar New Member

    AppArmor is not even installed, much less disabled.

    Here is the full mail.log transaction for an email sent to a forwarding address from an outside email account.
    Code:
    May 10 14:25:31 thirdrate postfix/smtpd[18094]: connect from [outside].com
    May 10 14:25:32 thirdrate postfix/smtpd[18094]: 543A95007D: client=[outside].com
    May 10 14:25:32 thirdrate postfix/cleanup[18098]: 543A95007D: message-id=<BAC34850-67BC-412B-BF08-6F9DADA916F1@[outside].com>
    May 10 14:25:32 thirdrate postfix/qmgr[17674]: 543A95007D: from=<me@[outside].com>, size=1548, nrcpt=1 (queue active)
    May 10 14:25:32 thirdrate postfix/smtpd[18094]: disconnect from [outside].com
    May 10 14:25:32 thirdrate postfix/pipe[18099]: 543A95007D: to=<[me@inside.com]>, relay=spamassassin, delay=0.55, delays=0.08/0.01/0/0.46, dsn=2.0.0, status=sent (delivered via spamassassin service)
    May 10 14:25:32 thirdrate postfix/qmgr[17674]: 543A95007D: removed
    May 10 14:25:32 thirdrate postfix/pickup[18039]: D7DB350081: uid=5001 from=<me@[outside].com>
    May 10 14:25:32 thirdrate postfix/cleanup[18098]: D7DB350081: message-id=<BAC34850-67BC-412B-BF08-6F9DADA916F1@[outside].com>
    May 10 14:25:32 thirdrate postfix/qmgr[17674]: D7DB350081: from=<me@[outside].com>, size=1873, nrcpt=1 (queue active)
    May 10 14:25:33 thirdrate postfix/virtual[18103]: D7DB350081: to=<abuse@thirdrate.info>, relay=virtual, delay=0.2, delays=0.15/0.01/0/0.04, dsn=5.1.1, status=bounced (unknown user: "[me@inside.com]")
    May 10 14:25:33 thirdrate postfix/cleanup[18098]: 029AB5007E: message-id=<20080510142533.029AB5007E@mail.[inside.com]>
    May 10 14:25:33 thirdrate postfix/bounce[18104]: D7DB350081: sender non-delivery notification: 029AB5007E
    
     
  4. falko

    falko Super Moderator

    Hm... I'm not sure why this is happening... :(
     
  5. superczar

    superczar New Member

    Well that is unfortunate, are there any other logs or config files that might be helpful in diagnosing an issue?
     
  6. superczar

    superczar New Member

    Bump, problem still exists...

    Is there any other information that I could provide?
     
  7. falko

    falko Super Moderator

    Does the address from which you forward to another address exist in the users table? If so, remove it from there.
     
  8. superczar

    superczar New Member

    No, the user does not exist in the users table.

    On a whim I tried changing the source and destination email addresses to see if I was misinterpreting the meaning of "source" and "destination".

    I got different errors.

    When I have the email address I am sending the email to in the "source" column, and the email address I want the message forwarded to in the "destination" column, I get the following bounce message:
    Code:
    <abuse@thirdrate.info>: unknown user: "abuse@thirdrate.info"
    Reporting-MTA: dns; thirdrate.info
    and the following error in mail.log:
    Code:
    May 28 20:47:28 thirdrate postfix/virtual[19188]: 0D081500CE: to=<abuse@thirdrate.info>, relay=virtual, delay=0.39, delays=0.18/0.01/0/0.2, dsn=5.1.1, status=bounced (unknown user: "abuse@thirdrate.info")
    When I have them reversed I get the following bounce message:
    Code:
    <abuse@thirdrate.info>: host mail.thirdrate.info[208.75.84.164] said: 550 5.1.1
       <abuse@thirdrate.info>: Recipient address rejected: User unknown in virtual
       mailbox table (in reply to RCPT TO command)
    and the following error in mail.log:
    Code:
    May 28 20:46:30 thirdrate postfix/smtpd[19177]: NOQUEUE: reject: RCPT from [external smtp server]: 550 5.1.1 <abuse@thirdrate.info>: Recipient address rejected: User unknown in virtual mailbox table; from=<[external email address]> to=<abuse@thirdrate.info> proto=ESMTP helo=<[external smtp server]>
    Does this information help?
     
  9. falko

    falko Super Moderator

    I still have no idea... Did you compare your setup with the one from the tutorial?
     
  10. superczar

    superczar New Member

    I just went though and checked it again, there are differences... But none of them seem to be related to forwardings. The only real differences are my decision to not use Amavisd and just run spamassassin as a standalone daemon (spamd).

    I enabled query logging in mysql and saw the following in an email transaction from a real email (admin@thirdrate.info) to a forward (abuse@thirdrate.info), connection 11 seems to be the relevant search for forwardings.
    Code:
                         11 Connect     mail_admin@localhost on mail
                         11 Query       SELECT destination FROM forwardings WHERE source='abuse@thirdrate.info'
    080529 17:33:58      11 Query       SELECT destination FROM forwardings WHERE source='admin@thirdrate.info'
    080529 17:34:58      11 Quit
    
    When I run the first query it returns 'admin@thirdrate.info'. 'admin@thirdrate.info' is a real email address in `users` that can accept and send email successfully.
    When I run the second query it returns an empty set.

    So it is searching for a forward. Correct?
     
  11. superczar

    superczar New Member

    The problem was simple.

    In /etc/postfix/main.cf I had the following line:
    Code:
    receive_override_options = no_address_mappings
    I commented that out, and all is now well. I'm not certain how that line got in there, if it was part of the default install, or if I made a mistake and added it based on other tutorials that I reviewed as well.

    Falko, thanks for your help.
     
  12. aloyict

    aloyict New Member

    Virtual Mail Alias/Forwarding Problem in Postfix

    Hi Everybody,

    If you faced the following problem mail Alias/Forwarding in Postfix than you will just remove or comment out this line in main.cf file. I hope problem must be solve.

    Comment out by #
    " #receive_override_options = no_address_mappings"


    Thanks

    Aloy Kumar Das
    Sr. System Admin
    Broad Band Telecom Services Ltd.
    Bangladesh
    06/11/2009
     

Share This Page