Second server cannot send email to own domain (hosted on first server)

Discussion in 'Installation/Configuration' started by benbalbo, Mar 1, 2006.

  1. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    I have installed ISPConfig on a second server and am unable to send email to anything@main-domain.com.

    The issue lies in the fact that both servers use the same domain: server1.main-domain.com and server2.main-domain.com.

    Both servers have main-domain.com in the local-host-names file, so server2 thinks it manages email for that domain, when in fact it's server1.

    I've had a look at /root/ispconfig/scripts/lib/classes/ispconfig_postfix.lib.php to work out where this main domain is being added to find a way of not adding it to the list, but have come unstuck.

    Any advice would be greatly appreciated!

    A note to Till - I'm sorry I still haven't gotten round to doing the translation tool. I've been slack! Life has been quite busy lately, and I've not been getting enough sleep. I understand if you get someone else to do this job, but if not, I will get round to it just as soon as I get my life back :)

    Thanks!
    Ben
     
    Last edited: Mar 1, 2006
  2. falko

    falko Super Moderator ISPConfig Developer

    Did you create a web site for main-domain.com on server 2? Then go to that web site in ISPConfig and select "External Mailserver" for that domain.
     
  3. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Thanks Falko - worked perfectly. Don't know why I didn't think of it myself...
     
  4. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Well I'm not sure why, but this domain is still marked as using an external mail server, but it keeps getting added to the local-host-names file. I'm starting to look into why, but if anyone has any ideas, I'd appreciate them.

    Will post back if I find out the answer.
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Do you have more the one web (subdomains) of this domain? Then please check all of these wbstes if they cotain this domain as co-domain and set these co-domaibs to external too.
     
  6. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Thanks for the tip Till. It helped me debug the problem.

    I checked the isp_isp_web table and found that the optionen_local_mailserver was linked to the main web name, not the co-domains.

    If I edit the main web for www.main-domain.com and remove www from the hostname (leave it blank) and save, then it works - main-domain.com disappears from the local-host-names file. I need to be careful though, because when I edit this web agian, the blank hostname box defaults to www.

    So in effect what I'm experiencing is the inability to specify an external mail server for any FQDN other than the main domain for the site (co-domains don't affect local-host-names) and that setting hostname to blank in the ispconfig admin console leads it to default to www upon next save.

    Is this intended? Is this fixed in the latest verion? (I haven't upgraded to the version of ISPConfig that came out a few weeks ago yet).

    Thanks!
    Ben
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    In the ISPConfig interface, every co-domain has an options tab where you can set mailserver to external for this co-domain. This is independant from the "external mailserver" setting of the domain of the main website. Have you set mailserver to external on the option tab of all co-domains of the website?
     
  8. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Thanks again Till, I wasn't aware of that tab :)

    Now I have another problem though - having made that change.

    I have 10 clients who use theirname.main-domain.com and I've set up the site to have theirname as the host and main-domain.com as the domain name.

    There are now many entries in isp_isp_domain with host NULL and domain main-domain.com. I've also noticed that if these clients wish to create an email address for themselves, it's set as @main-domain.com, not @theirname.main-domain.com

    I presume that I have to put theirname.main-domain.com as the domain, and leave the hostname blank?

    I'll try it and see what happens, but would like to know what the 'official' way os to set these up.

    Thanks,
    Ben
     
  9. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Okay - putting the full names in as the domain name seems to have fixed it.

    BB
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer


    If you create a new website like user.domain.com, please check if ISPConfig created a new co-domain with empty host automatically. You must delete these automatically created co-domains. This is fixed in ISPConfig 2.2.0.
     
  11. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    I'm responding to this thread as it's related.

    When I email a user on my second server this shows up in the logs:

    Code:
    Apr  4 22:00:24 server2 postfix/cleanup[427]: 60D9320CE04D: message-id=<4433236D.60100@benbalbo.com>
    Apr  4 22:00:24 server2 postfix/qmgr[31863]: 60D9320CE04D: from=<ben@benbalbo.com>, size=2322, nrcpt=1 (queue active)
    Apr  4 22:00:26 server2 postfix/smtp[31865]: setting up TLS connection to mail.main-domain.com
    Apr  4 22:00:26 server2 postfix/smtp[31865]: verify error:num=18:self signed certificate
    Apr  4 22:00:26 server2 postfix/smtp[31865]: Peer verification: CommonName in certificate does not match:  != mail.main-domain.com
    Apr  4 22:00:27 server2 postfix/smtp[31865]: Peer certificate could not be verified
    Apr  4 22:00:27 server2 postfix/smtp[31865]: 60D9320CE04D: to=<web5_user@main-domain.com>, orig_to=<user@client-domain.com>, relay=mail.main-domain.com[***.**.**.**], delay=3, status=bounced (host mail.main-domain.com[***.**.**.**] said: 550 <web5_user@main-domain.com>: Recipient address rejected: User unknown in local recipient table (in reply to RCPT TO command))
    Apr  4 22:00:27 server2 postfix/cleanup[427]: F3C2D20CE078: message-id=<20060405020027.F3C2D20CE078@server2.main-domain.com>
    Apr  4 22:00:28 server2 postfix/qmgr[31863]: F3C2D20CE078: from=<>, size=4391, nrcpt=1 (queue active)
    Apr  4 22:00:28 server2 postfix/qmgr[31863]: 60D9320CE04D: removed
    Apr  4 22:00:29 server2 postfix/smtp[31865]: setting up TLS connection to main-domain.com
    Apr  4 22:00:29 server2 postfix/smtp[31865]: verify error:num=18:self signed certificate
    Apr  4 22:00:29 server2 postfix/smtp[31865]: Peer verification: CommonName in certificate does not match:  != main-domain.com
    Apr  4 22:00:30 server2 postfix/smtp[31865]: Peer certificate could not be verified
    Apr  4 22:00:31 server2 postfix/smtp[31865]: F3C2D20CE078: to=<ben@benbalbo.com>, relay=main-domain.com[***.**.**.**], delay=4, status=sent (250 Ok: queued as 079B9529C03B)
    Apr  4 22:00:31 server2 postfix/qmgr[31863]: F3C2D20CE078: removed
    English translation:

    I send an email to my client, they are hosted on server2. Server2 receives the request and rewrites to web5_user@main-domain.com, which is server1, so relays it. I get a undeliverable telling me the email address doesn't exist on the server1.

    I'm presuming there's a way to change the ispconfig setup to treat the server as server2.main-domain.com, and hence rewrite the email address to web5_user@server2.main-domain.com?

    I was going to try changing (in Management > Server > Settings > Server Tab) from:
    Hostname: server2
    Domain: main-domain.com

    to:
    Hostname:
    Domain: server2.main-domain.com

    I just want to see what the preferred method of making this server deliver mail locally is, rather than changing these settings and potentially bringing the server down horribly.

    Thanks in advance!

    Ben
     
  12. falko

    falko Super Moderator ISPConfig Developer

    If you want the server to deliver mails for main-domain.com locally, then main-domain.com must be listed in /etc/postfix/local-host-names.
     
  13. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

  14. falko

    falko Super Moderator ISPConfig Developer

    Please post /etc/postfix/main.cf here.
    Is main-domain.com listed in /etc/postfix/local-host-names?
     
  15. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Code:
    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
    
    myhostname = server2.main-domain.com
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    relayhost =
    mynetworks = 127.0.0.0/8
    mailbox_command =
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    smtpd_sasl_local_domain =
    smtpd_sasl_auth_enable = yes
    smtpd_sasl_security_options = noanonymous
    broken_sasl_auth_clients = yes
    smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
    smtpd_tls_auth_only = no
    smtp_use_tls = yes
    smtpd_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
    smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
    smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
    smtpd_tls_loglevel = 1
    smtpd_tls_received_header = yes
    smtpd_tls_session_cache_timeout = 3600s
    tls_random_source = dev:/dev/urandom
    home_mailbox = Maildir/
    
    virtual_maps = hash:/etc/postfix/virtusertable
    
    mydestination = /etc/postfix/local-host-names
    No, only server2.main-domain.com, localhost.server2.main-domain.com and localhost.main-domain.com.

    Thanks!

    BB
     
  16. falko

    falko Super Moderator ISPConfig Developer

    Please try this:
    Code:
    postconf -e 'mydomain = $myhostname'
    Then restart Postfix.
     
  17. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Unfortunately it's still rewriting to web1_bob@main-domain.com :-(

    Would my original suggestion of changing the hostname to "" and domain name to "sever2.main-domain.com" in the ispconfig Management > Server > Settings > Server Tab work? Would it break anything?

    Reason I ask is because I noticed I need to move the hostname to the domain name box when creating new webs using the same domain name, otherwise the entry in local-host-names is incorrect, but that may be a totally different issue.

    Thanks for your continued help and support!

    BB
     
  18. falko

    falko Super Moderator ISPConfig Developer

    What's the output of
    Code:
    hostname
    and
    Code:
    hostname -f
    ? What's in /etc/hosts?

    It wouldn't change anything so don't do it.
     
  19. benbalbo

    benbalbo ISPConfig Developer ISPConfig Developer

    Code:
    # hostname
    server2.main-domain.com
    # hostname -f
    server2.main-domain.com
    # cat /etc/hosts
    127.0.0.1  server2.main-domain.com server2 localhost localhost.localdomain
     
  20. falko

    falko Super Moderator ISPConfig Developer

    What's the output of
    Code:
    postconf -n
    ?
     

Share This Page