relaying mail server changes mail recipient domain?

Discussion in 'Server Operation' started by ralic, Jul 17, 2008.

  1. ralic

    ralic New Member

    Hi all

    I'm having a problem with a mail destination domain name getting changed while in transit between sender server and my receiving server. I think the problem may lie in the DNS, but I'm not 100% sure and would appreciate some input from more experienced admins.

    I have a basic setup which is mail destination for itself and also hosting virtual domains.

    My DNS config for the base host is:
    Code:
    host.my.dom.            A      1.2.3.4
    host.my dom.            MX  20  host.my.dom.
    4.3.2.1.in-addr.arpa.   PTR     host.my.dom.
    DNS config for the virtual domains are:
    Code:
    my.dom           MX  10   host.my.dom.        # virtual email - catch and deliver [email protected] addresses
    email.my.dom     CNAME    host.my.dom.        # for convenient access to webmail software
    another.my.dom   CNAME    host.my.dom.        # for convenient access to web  pages of "virtual host"
    another.my.dom   MX  10   host.my.dom.        # virtual email - catch and delivery [email protected] addresses
    The problem lies in emails that are addressed to [email protected]

    Sometimes they are handed over to postfix exactly as they should be. i.e. as [email protected].
    When this happens all is smooth, because that domain is handled virtually.

    But sometimes they get handed over to postfix as user@[B]host[/B].my.dom and then delivery fails because host.my.dom is not virtual and therefore user must exist in /etc/aliases, which it doesn't.

    At first I thought I had my virtual setups wrong and have done a fair bit of research on virtual domains and postfix and eventually resorted to turning on debugging in postfix. Through that I have determined that the problem starts when the relaying mail server issues the RCPT TO command to postfix. Already at that stage the email domain name has been changed, so instead of:
    Code:
    RCPT TO:<[email protected]>
    I see:
    Code:
    RCPT TO:<[email protected]>
    And yes, I'm sure I'm typing the recipient address properly. :)

    The only scenario that I can think of is that the relaying domain (I'm sending from a webmail client on another system) is doing some wacky antispam check. Something like:
    Code:
    RECEIVED ADDRESS: <[email protected]>
    GET IP: another.my.dom -> 1.2.3.4
    RDNS CHECK: 4.3.2.1.in-addr.arpa. -> host.my.dom
    RELAYED ADDRESS: <[email protected]>
    Is something like that feasible? possible? allowed? a bug?

    Appreciate any insights.

    Thanks
     
  2. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/main.cf?
     
  3. ralic

    ralic New Member

    Code:
    user@host:~$ cat /etc/postfix/main.cf | grep -v ^#
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    append_dot_mydomain = no
    readme_directory = /usr/share/doc/postfix
    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:${data_directory}/smtpd_scache
    smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
    myhostname = host.my.dom
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = $myhostname, localhost.$mydomain, localhost, localhost.localdomain
    relayhost = 
    mynetworks = 127.0.0.0/8
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    html_directory = /usr/share/doc/postfix/html
    virtual_alias_domains = 
    virtual_alias_maps = proxy:mysql:/etc/postfix/mysql-virtual_forwardings.cf, mysql:/etc/postfix/mysql-virtual_email2email.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_sasl_authenticated_header = yes
    smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_policy_service inet:127.0.0.1:60000
    transport_maps = proxy:mysql:/etc/postfix/mysql-virtual_transports.cf
    virtual_create_maildirsize = yes
    virtual_maildir_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
    content_filter = amavis:[127.0.0.1]:10024
    receive_override_options = no_address_mappings
    mailman_destination_recipient_limit = 1
    Nothing too out of the ordinary there. It should look quite familiar. :)
    I'm pretty sure that my postfix is not the culprit because the change is taking place even before the email arrives at my system.

    I've tried from various webmail clients (gmail, hotmail etc.) and so far, the problem only happens with one of them. I have opened a support ticket with the system concerned, but only got what looks like a junior level response so far.
     
  4. falko

    falko Super Moderator Howtoforge Staff

    It seems to be so from what I see... But I have no idea why. :(
     

Share This Page