Postfix: Generic mapping not working

Discussion in 'Server Operation' started by DanielB, Jan 28, 2008.

  1. DanielB

    DanielB New Member


    It seems that my generic map does not work.

    I have followed the guide "Howto: ISP-style Email Server with Debian-Etch and Postfix 2.3" ( (postfix, mysql, dovecot, amavisd-new, clamav, spamassasin). I am using the latest postix 2.4.5 on a Ubuntu 7.10 amd64 server and everything works fine except for one thing -- the generic mapping.

    I have, let say, a which is my name of my local network and an external domain called

    The problem is that when I am sending an email, the recived mail get the headings:

    X-Virus-Scanned: Debian amavisd-new at
    Received: from ([])
    by localhost (mail.mydomain []) (amavisd-new, port 10024)


    Received: from [] ( [])
    by (Postfix)

    So my question is, why is shown? And also, why is my local IP shown ( How can I rewrite this with generic maps (or should I do something else?)

    This is the output from postconf -n:

    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    append_dot_mydomain = no
    biff = no
    config_directory = /etc/postfix
    content_filter = smtp-amavis:[]:10024
    inet_interfaces = all
    local_recipient_maps =
    mailbox_size_limit = 0
    masquerade_domains =
    mydestination = localhost
    mydomain =
    myhostname =
    mynetworks =,
    myorigin = /etc/mailname
    proxy_interfaces = xxx.yyy.zzz.www (my ip of
    receive_override_options = no_address_mappings
    recipient_delimiter = +
    relayhost =
    smtp_generic_maps = hash:/etc/postfix/generic
    smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_unauth_destination
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_path = private/auth
    smtpd_sasl_type = dovecot
    smtpd_tls_CAfile = /etc/ssl/rootca.pem
    smtpd_tls_auth_only = yes
    smtpd_tls_cert_file = /etc/ssl/cert/
    smtpd_tls_key_file = /etc/ssl/key/
    smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
    smtpd_use_tls = yes
    virtual_alias_maps = mysql:/etc/postfix/,mysql:/etc/postfix/
    virtual_gid_maps = static:5000
    virtual_mailbox_domains = mysql:/etc/postfix/
    virtual_mailbox_maps = mysql:/etc/postfix/
    virtual_transport = dovecot
    virtual_uid_maps = static:5000

    Note that I have the line: smtp_generic_maps = hash:/etc/postfix/generic. In this "generic"-file I have tried many different mappings without success. It seems that this file is not read, I am not sure. Note also "receive_override_options = no_address_mappings" but this only effects the received mails and not when you send, or?

    I have added the following to my

    # DOVECOT:
    dovecot unix - n n - - pipe
    flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -d ${recipient}
    # AMAVIS:
    smtp-amavis unix - - n - 2 smtp
    -o smtp_data_done_timeout=1200
    -o smtp_send_xforward_command=yes
    -o disable_dns_lookups=yes
    -o max_use=20
    -o smtp_generic_maps=
    -o disable_mime_output_conversion=yes
    # inet n - - - - smtpd
    -o content_filter=
    -o local_recipient_maps=
    -o relay_recipient_maps=
    -o smtpd_restriction_classes=
    -o smtpd_delay_reject=no
    -o smtpd_client_restrictions=permit_mynetworks,reject
    -o smtpd_helo_restrictions=
    -o smtpd_sender_restrictions=
    -o smtpd_recipient_restrictions=permit_mynetworks,reject
    -o smtpd_data_restrictions=reject_unauth_pipelining
    -o smtpd_end_of_data_restrictions=
    -o mynetworks=
    -o smtpd_error_sleep_time=0
    -o smtpd_soft_error_limit=1001
    -o smtpd_hard_error_limit=1000
    -o smtpd_client_connection_count_limit=0
    -o smtpd_client_connection_rate_limit=0
    -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks
    -o local_header_rewrite_clients=
    -o smtpd_authorized_xforward_hosts=

    As far as I under stand is that when I am sending an email it goes first to Amavis on port 10024. Since the transport map for Amavis includes "smtp_generic_maps= ", the "generic"-file is not used at this stage. The email is then sent to port 10025 where Postfix take over to finally send the email. Since the transpost map for "" does NOT contain "smtp_generic_maps= " the generic map should be used, but it doesn't. Or?

    I have one more question. Let say that some of you solve my problem and the generic mapping works! How can I do the following: #(case 1) #(case 2)

    I don't know if you understand what I am trying to say. Let say I host two domains on my server (my work mail and private mail). If I am the user on a local machine and want to send a mail using "" I want the generic map to use "case 1" but if I instead use "", the "case 2" should be mapped.

    I guess I don't really understand the generic mapping because I can not see how this can be done. So how do you do something like this?


Share This Page