Postfix seconday MX

Discussion in 'Server Operation' started by nerdman, Mar 22, 2007.

  1. nerdman

    nerdman New Member

    Hi all !

    I'm search how to configure a secondary postfix mail server. My primary server works fine, my secondary too but never deliver to primary.

    When the secondary receive mail, it put it in /var/mail/$USER, that's all.

    Code:
    # Security
    smtpd_banner = mysecondary.mailserver.com - Microsoft Exchange (5.5)
    biff = no
    disable_vrfy_command = yes
    smtpd_helo_required = yes
    
    # Reject unknow domain
    reject_unknown_recipient_domain = yes
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    myhostname = mysecondary.mailserver.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = domain1, domain2....
    relayhost = domain1
    disable_dns_lookups = yes
    mynetworks = 127.0.0.0/8, 192.168.0.0/24, 10.8.0.0
    home_mailbox = Maildir/
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    
    mailbox_command = procmail -a "$EXTENSION"
    transport_maps = hash:/etc/postfix/transport
    
    # Protection against Open Relay
    smtpd_client_restrictions = reject_rbl_client relays.ordb.org
    smtpd_recipient_restrictions =  permit_sasl_authenticated,
                                    permit_mx_backup,
                                    permit_mynetworks,
                                    reject_unauth_destination,
                                    reject_invalid_hostname,
                                    reject_non_fqdn_sender,
                                    reject_unknown_sender_domain,
                                    reject_non_fqdn_recipient,
                                    reject_unknown_recipient_domain,
                                    reject_rhsbl_client blackhole.securitysage.com,
                                    reject_rhsbl_sender blackhole.securitysage.com,
                                    reject_rbl_client relays.ordb.org,
                                    reject_rbl_client opm.blitzed.org,
                                    reject_rbl_client list.dsbl.org,
                                    reject_rbl_client cbl.abuseat.org,
                                    reject_rbl_client dul.dnsbl.sorbs.net,
                                    check_relay_domains,
                                    permit
    smtpd_data_restrictions = reject_unauth_pipelining
    
    # SASL
    smtpd_sasl_auth_enable = yes
    # Pour corriger le bug de certains client (Outlook...)
    broken_sasl_auth_clients = yes
    smtpd_sasl_application_name= smtpd
    smtpd_sasl_security_options = noanonymous
    smtpd_sasl_local_domain = $myhostname
    # Obligatoire meme si on ne l'utilise pas
    smtp_sasl_password_maps = hash:/etc/sasldb2
    smtp_sasl_auth_enable = no
    
    # TLS/SSL
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_loglevel = 1
    smtpd_tls_loglevel = 1
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/mykey.key
    smtpd_tls_cert_file = /etc/postfix/mykey.crt
    
    # Use Amavis
    content_filter = amavis:[127.0.0.1]:10024
    receive_override_options = no_address_mappings
    
    I've searched for a long time, and I didn't find. The 2 MX are good DNS configured. Can someone help me please ?

    Thanks
     
  2. falko

    falko Super Moderator Howtoforge Staff

    Do the priorities of the MX records differ?
     
  3. nerdman

    nerdman New Member

    Hello,

    Thanks for the answer. Yes the 2 MX priority differs. My primary has a 5 priority and secondary has a 10 priority.

    Any ideas ?
     
  4. falko

    falko Super Moderator Howtoforge Staff

  5. nerdman

    nerdman New Member

    Thanks for the URL but unfortunalty it doesn't work. Uninstalled and reinstall postfix. Here is my configuration :

    Code:
    # See /usr/share/postfix/main.cf.dist for a commented, more complete version
    
    
    # Debian specific:  Specifying a file name will cause the first
    # line of that file to be used as the name.  The Debian default
    # is /etc/mailname.
    #myorigin = /etc/mailname
    
    smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
    biff = no
    
    # appending .domain is the MUA's job.
    append_dot_mydomain = no
    
    # Uncomment the next line to generate "delayed mail" warnings
    #delay_warning_time = 4h
    
    # TLS parameters
    smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
    smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.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
    
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    
    myhostname = fqdn.my.domain.name
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = fqdn.my.domain.name, my.domain.name, , localhost
    relayhost = nerdman.org
    mynetworks = 127.0.0.0/8, 10.8.0.0/24
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    smtpd_recipient_restrictions =  permit_mx_backup,
                                    reject_unauth_destination,
                                    reject_invalid_hostname,
                                    reject_non_fqdn_sender,
                                    reject_unknown_sender_domain,
                                    reject_non_fqdn_recipient,
                                    reject_unknown_recipient_domain,
                                    reject_rhsbl_client blackhole.securitysage.com,
                                    reject_rhsbl_sender blackhole.securitysage.com,
                                    reject_rbl_client opm.blitzed.org,
                                    reject_rbl_client list.dsbl.org,
                                    reject_rbl_client cbl.abuseat.org,
                                    reject_rbl_client dul.dnsbl.sorbs.net,
                                    reject_rbl_client zen.spamhaus.org,
                                    permit
    
    And it still deliver to /var/mail and don't forward to my primary mail server. I really don't kno why.

    Do you have any idea ?

    Thanks
     
  6. falko

    falko Super Moderator Howtoforge Staff

  7. nerdman

    nerdman New Member

    Hello !

    Thanks ! Now it's works better ! The mails on secondary stay in mail queue until the primary server goes up.

    I forgot the postmap command on my transport file ! Thanks again !

    Now I encounter another problem. Like I said, the mails on the secondary go on the primary. I can see it in the logs and in the mail queue. But when they arrive to the primary, they are deleted and I don't know why.

    So the mail come but aren't delivred to mailbox. Someone have again a good answer to give to me ?

    Thanks
     
  8. falko

    falko Super Moderator Howtoforge Staff

    What's in the mail log on the primary when this happens? Do you maybe use Maildir, but the mails are delivered to mbox (or vice versa)?
     
  9. nerdman

    nerdman New Member

    Hello,

    I have this kind of problem log :
    Code:
    Apr  8 19:16:53 nerdman amavis[10879]: (10879-02) Passed CLEAN, [88.191.31.89] <[email protected]> -> <[email protected]>, Message-ID: <[email protected]>, mail_id: sf6m7uSvqGG6, Hits: -, queued_as: 0CDC14C06B, 153 ms
    Apr  8 19:16:53 nerdman postfix/smtp[7691]: BAD214C067: to=<[email protected]>, relay=127.0.0.1[127.0.0.1]:10024, delay=10, delays=10/0/0/0.15, dsn=2.6.0, status=sent (250 2.6.0 Ok, id=10879-02, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 0CDC14C06B)
    Apr  8 19:16:53 nerdman postfix/qmgr[7626]: BAD214C067: removed
    I have not mbox dir. So I don't really know where my email goes !

    Any ideas ? Thanks
     
  10. falko

    falko Super Moderator Howtoforge Staff

    What's in /etc/postfix/main.cf on the primary (please strip out the comments)? What's the output of
    Code:
    netstat -tap
    ?
     

Share This Page