Full Email support in ISPConfig server

Discussion in 'General' started by heymrdj, Jan 2, 2008.

  1. heymrdj

    heymrdj Member

    Looking to get the mail server part working in my setups. The server's host name is serverhost (it is a main server for many virtual ones) on the domain eatest.homelinux.org. The entire access to the server is http://serverhost.eatest.homelinux.org Bellsouth DSL blocks port 25, so I know this is the place to start. My domain uses DynDNS to use auto IP update for my dynamic IP. The server is in DMZ by my router, and I've successfully outsourced MySQL, web, and FTP to my brother in Wisconsin. (I'm in Georgia, so i know that's a good distance DNS test.) Now how do I get email to work right where the server can both send and receive email (such as to user heymrdj on serverhost.eatest.homelinux.org). Is fixing this port problem the only issue? What about MX records, I know I don't have any? I don't think anyways. Please enlighten me. thank you :)
     
  2. falko

    falko Super Moderator Howtoforge Staff

    You can use the ports 465 or 587 if 25 is blocked. If you search the forum ,you should find some threads about this. Then you should relay your emails through another mail server because most dynamic IP addresses are blacklisted nowadays: http://www.howtoforge.com/postfix_relaying_through_another_mailserver

    To check your MX records, run
    Code:
    dig mx yourdomain.com
    To find out about the authoritative nameservers for your domain, run
    Code:
    dig ns yourdomain.com
     
  3. heymrdj

    heymrdj Member

    Well i'm still kind of out of it. I am trying to route email from ISPConfig server to my SMTP server on my linux box. I ran the port change with somting like
    Code:
    465 initd - - - - smptd
    or somehting similar...got it off another post on this forum. Then I ran your guide on relays using my everythinganime.org server. I ended up tring to send email and got this:
    Code:
    Sat Jan 5 12:46:49 	[email protected] 	[email protected] 	764 bytes 	connect to linuxsrv01.usdcservers.net[208.78.40.25]: Connection timed out
    The first thing I don't undestand is that example.com, this is through ISPConfig squirrelmail logged in as [email protected] and yet it's showing that example.com in the message ques in Webmin.

    When i dig my MX I get:
    Code:
    ; <<>> DiG 9.2.4 <<>> -t MX www.eatest.homelinux.org
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 21142
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 5, ADDITIONAL: 5
    
    ;; QUESTION SECTION:
    ;www.eatest.homelinux.org. IN MX
    
    ;; ANSWER SECTION:
    www.eatest.homelinux.org. 60 IN CNAME eatest.homelinux.org.
    eatest.homelinux.org. 60 IN MX 10 linuxsrv01.usdcservers.net.
    
    ;; AUTHORITY SECTION:
    homelinux.org. 39801 IN NS ns5.dyndns.org.
    homelinux.org. 39801 IN NS ns3.dyndns.org.
    homelinux.org. 39801 IN NS ns2.dyndns.org.
    homelinux.org. 39801 IN NS ns4.dyndns.org.
    homelinux.org. 39801 IN NS ns1.dyndns.org.
    
    ;; ADDITIONAL SECTION:
    ns1.dyndns.org. 62898 IN A 63.208.196.90
    ns3.dyndns.org. 84281 IN A 208.78.69.75
    ns4.dyndns.org. 4010 IN A 91.198.22.75
    ns2.dyndns.org. 23419 IN A 204.13.249.75
    ns5.dyndns.org. 51062 IN A 203.62.195.75
    
    ;; Query time: 114 msec
    ;; SERVER: 70.84.160.11#53(70.84.160.11)
    ;; WHEN: Sat Jan 5 11:17:50 2008
    ;; MSG SIZE rcvd: 275

    When I dig my NS I get
    Code:
    ; <<>> DiG 9.2.4 <<>> -t NS www.serverhost.eatest.homelinux.org
    ;; global options: printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25046
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0
    
    ;; QUESTION SECTION:
    ;www.serverhost.eatest.homelinux.org. IN NS
    
    ;; ANSWER SECTION:
    www.serverhost.eatest.homelinux.org. 48 IN CNAME eatest.homelinux.org.
    
    ;; AUTHORITY SECTION:
    homelinux.org. 1800 IN SOA ns1.dyndns.org. hostmaster.dyndns.org. 2049969684 10800 1800 604800 1800
    
    ;; Query time: 27 msec
    ;; SERVER: 70.84.160.11#53(70.84.160.11)
    ;; WHEN: Sat Jan 5 11:18:59 2008
    ;; MSG SIZE rcvd: 125
    In ISPConfig, do i need to make my primary and secondary nameservers ns1/ns2.dyndns.org instead of the serverhost.eatest.homelinux.org they are now?
     
  4. falko

    falko Super Moderator Howtoforge Staff

    An MX record must never point to a CNAME record - it must point to an A record instead.

    You don't need ISPConfig's DNS Manager at all because the records for homelinux.org are managed by the company that owns homelinux.org.
     
  5. heymrdj

    heymrdj Member

    I found out how you can use GMAIL SMTP server as a relay host in Postfix.

    Code:
    relayhost = [smtp.gmail.com]:587
    
    #auth
    smtp_sasl_auth_enable=yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    
    #tls
    smtp_use_tls = yes
    smtp_sasl_security_options = noanonymous
    smtp_sasl_tls_security_options = noanonymous
    smtp_tks_note_starttls_offer = yes
    tls_random_source = dev:/dev/urandom
    smtp_tls_scert_verifydepth = 5
    smtp_tls_key_file=/etc/postfix/certs/itchy.key
    smtp_tls_cert_file=/etc/postfix/certs/itchy.pem
    smtpd_tls_ask_ccert = yes
    smtpd_tls_req_ccert =no
    smtp_tls_enforce_peername = no
    
    Create “/etc/postfix/sasl_passwd” with the following format:
    gmail-smtp.l.google.com [email protected]:password
    smtp.gmail.com [email protected]:password
    
    postmap /etc/posfix/sasl_passwd
    
    /etc/init.d/postfix reload
    I just have one question. When relaying like this, do the receivers of the email see my servers email (egw[REMOVE]eatest.homelinux.org) or do they see the account i relay through (heymrdjCW[REMOVE]@gmail.com) on the from line. I want the server to send emails in the form of the first, rather than the latter.
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    The receivers should see the email address that you used in your mail client. But you should simply test it as it is possible that google rewrites the email address.
     
  7. heymrdj

    heymrdj Member

    I found out Google does indeed rewrite, but with a simple change in settings in the gmail account you can have it not rewrite accounts. Thanks alot :). I'm ready to start some more tests for my home EGroupWare install in ISPConfig :).
     
  8. heymrdj

    heymrdj Member

    I've made a lot of progress and eventually got it where i could receive mail, but couldn't send. After following a gmail guide, I got it so i could send it, but now i can't remember how i got it to receive mail :confused:

    This is what I get when i send an email from my gmail or Bellsouth address from Outlook or the gmail interface to one of my servers emails, [email protected]:

    Code:
    This is an automatically generated Delivery Status Notification
    
    Delivery to the following recipient failed permanently:
    
         [email protected]
    
    Technical details of permanent failure: 
    PERM_FAILURE: SMTP Error (state 12): 530 5.7.0 Must issue a STARTTLS command first
    
       ----- Original message -----
    
    Received: by 10.100.33.19 with SMTP id g19mr15853285ang.117.1201644385525;
            Tue, 29 Jan 2008 14:06:25 -0800 (PST)
    Return-Path: <[B]*blanked out my email here*[/B]>
    Received: from Heymrdjlaptop ( [70.144.224.161])
            by mx.google.com with ESMTPS id 3sm6457699hsw.12.2008.01.29.14.06.24
            (version=TLSv1/SSLv3 cipher=OTHER);
            Tue, 29 Jan 2008 14:06:24 -0800 (PST)
    To: <[email protected]>
    Subject: test
    Date: Tue, 29 Jan 2008 17:06:09 -0500
    Message-ID: <002d01c862c3$28161620$78424260$@com>
    MIME-Version: 1.0
    Content-Type: multipart/alternative;
    	boundary="----=_NextPart_000_002E_01C86299.3F400E20"
    X-Mailer: Microsoft Office Outlook 12.0
    thread-index: Achiwycx1ZqEuG3/QwScNF5LU7O1OQ==
    Content-Language: en-us
    From: Casey Weaver <[B]Blanked out my email here[/B]>
    
    This is a multipart message in MIME format.
    
    ------=_NextPart_000_002E_01C86299.3F400E20
    Content-Type: text/plain;
    	charset="us-ascii"
    Content-Transfer-Encoding: 7bit
    
    Bounce test
    
     
    
       ----- Message truncated -----
    
    /etc/postfix/main.cf
    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/postfix/ssl/smtpd.crt
    smtpd_tls_key_file = /etc/postfix/ssl/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
    smtp_use_tls = yes
    smtp_sasl_security_options = 
    smtp_sasl_tls_security_options = noanonymous
    smtp_tls_note_starttls_offer = yes
    smtp_tls_scert_verifydepth = 5
    smtp_tls_key_file=/etc/postfix/ssl/smtpd.key
    smtp_tls_cert_file=/etc/postfix/ssl/smtpd.crt
    smtpd_tls_ask_ccert = yes
    smtpd_tls_req_ccert =no
    smtp_tls_enforce_peername = no
    #auth
    smtp_sasl_auth_enable=yes
    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
    
    # See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
    # information on enabling SSL in the smtp client.
    
    myhostname = weavers.homelinux.org
    alias_maps = hash:/etc/aliases
    alias_database = hash:/etc/aliases
    myorigin = /etc/mailname
    mydestination = weavers.homelinux.org, localhost.weavers.homelinux.org, localhost.localdomain, localhost
    relayhost = [smtp.gmail.com]:587
    mynetworks = 127.0.0.0/8
    mailbox_command = procmail -a "$EXTENSION"
    mailbox_size_limit = 0
    recipient_delimiter = +
    inet_interfaces = all
    inet_protocols = 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
    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
    /etc/postfix/master.cf
    Code:
    #
    # Postfix master process configuration file.  For details on the format
    # of the file, see the master(5) manual page (command: "man 5 master").
    #
    # ==========================================================================
    # service type  private unpriv  chroot  wakeup  maxproc command + args
    #               (yes)   (yes)   (yes)   (never) (100)
    # ==========================================================================
    smtp      inet  n       -       -       -       -       smtpd
    #submission inet n       -       -       -       -       smtpd
      -o smtpd_enforce_tls=yes
    #  -o smtpd_sasl_auth_enable=yes
    #  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    smtps     inet  n       -       -       -       -       smtpd
    #  -o smtpd_tls_wrappermode=yes
    #  -o smtpd_sasl_auth_enable=yes
    #  -o smtpd_client_restrictions=permit_sasl_authenticated,reject
    #628      inet  n       -       -       -       -       qmqpd
    pickup    fifo  n       -       -       60      1       pickup
    cleanup   unix  n       -       -       -       0       cleanup
    qmgr      fifo  n       -       n       300     1       qmgr
    #qmgr     fifo  n       -       -       300     1       oqmgr
    tlsmgr    unix  -       -       -       1000?   1       tlsmgr
    rewrite   unix  -       -       -       -       -       trivial-rewrite
    bounce    unix  -       -       -       -       0       bounce
    defer     unix  -       -       -       -       0       bounce
    trace     unix  -       -       -       -       0       bounce
    verify    unix  -       -       -       -       1       verify
    flush     unix  n       -       -       1000?   0       flush
    proxymap  unix  -       -       n       -       -       proxymap
    smtp      unix  -       -       -       -       -       smtp
    # When relaying mail as backup MX, disable fallback_relay to avoid MX loops
    relay     unix  -       -       -       -       -       smtp
    	-o fallback_relay=
    #       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
    showq     unix  n       -       -       -       -       showq
    error     unix  -       -       -       -       -       error
    discard   unix  -       -       -       -       -       discard
    local     unix  -       n       n       -       -       local
    virtual   unix  -       n       n       -       -       virtual
    lmtp      unix  -       -       -       -       -       lmtp
    anvil     unix  -       -       -       -       1       anvil
    scache	  unix	-	-	-	-	1	scache
    #
    # ====================================================================
    # Interfaces to non-Postfix software. Be sure to examine the manual
    # pages of the non-Postfix software to find out what options it wants.
    #
    # Many of the following services use the Postfix pipe(8) delivery
    # agent.  See the pipe(8) man page for information about ${recipient}
    # and other message envelope options.
    # ====================================================================
    #
    # maildrop. See the Postfix MAILDROP_README file for details.
    # Also specify in main.cf: maildrop_destination_recipient_limit=1
    #
    maildrop  unix  -       n       n       -       -       pipe
      flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${recipient}
    #
    # See the Postfix UUCP_README file for configuration details.
    #
    uucp      unix  -       n       n       -       -       pipe
      flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)
    #
    # Other external delivery methods.
    #
    ifmail    unix  -       n       n       -       -       pipe
      flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
    bsmtp     unix  -       n       n       -       -       pipe
      flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
    scalemail-backend unix	-	n	n	-	2	pipe
      flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
    mailman   unix  -       n       n       -       -       pipe
      flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
      ${nexthop} ${user}
    
    /etc/postfix/sasl_passwd (has been postamapped to /etc/postfix/sasl_passwd.db) Where Username:pass is are my actual gmail credentials.

    Code:
    gmail-smtp.l.google.com username:pass
    smtp.gmail.com username:pass
    I'm doing my best to combine the Perfect Debian Etch server guide, the Postfix for Relaying emails guide, and this Gmail Postfix relay guide. Any help on what's causing the STARTTLS error?
     
    Last edited: Jan 29, 2008
  9. heymrdj

    heymrdj Member

    And one other question, what do you tell programs your smtp server is when they want it send email? mail.yourdomain.com? Then a username and password of an account in that domain you own? (such as the logins to [email protected])?
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Is this a server with ISPConfig installed? Your main.cf does not look like you have ISPConfig installed. Did you follow exactly the perfect setzp guide to install your server?

    You may use any domain that points to your server as smtp and pop3 server in the mail client.
     
  11. heymrdj

    heymrdj Member

    No it doesn't follow the perfect setup exactly. As I said, the perfect setup guide does not work perfectly with a gmail setup, you need much more authentication to use gmail than the perfect setup guide gives. All the lines from the perfect setup guide are there however.

    I apologize for taking so long. I got ill on the first..took a trip to the hospital.
     
  12. heymrdj

    heymrdj Member

    OKay got it to get email receive support. just had to add 465 inet n - - - smtpd to my master.cf


    Now i just need to know why only my main domain gets email, but all the other created accounts don't. I think a new install maby be needed to figure it out. All email to [email protected] works, all other emails gimme this error:

    Code:
    This is the mail system at host weavers.homelinux.org.
    
    I'm sorry to have to inform you that your message could not be delivered to one or more recipients. It's attached below.
    
    For further assistance, please send mail to postmaster.
    
    If you do so, please include this problem report. You can delete your own text from the attached returned message.
    
                       The mail system
    
    <[email protected]>: host smtp.gmail.com[64.233.185.109] said: 554
        5.6.0 Mail loop detected.  Not accepted. 45sm16988535wri.25 (in reply to
        end of DATA command)
    My /etc/postfix/virtualusers is as follows:

    Code:
    ###################################
    #
    # ISPConfig virtusertable Configuration File
    #         Version 1.0
    #
    ###################################
    [email protected]    web1_egw
    [email protected]    web1_egw
    [email protected]    web1_egw
    [email protected]    web1_egw
    [email protected]    web2_heymrdj
    [email protected]    web2_heymrdj
    [email protected]    web2_heymrdj
    [email protected]    web2_heymrdj
    [email protected]    web1_egwmailer
    [email protected]    web1_egwmailer
    [email protected]    web1_egwmailer
    [email protected]    web1_egwmailer
    #### MAKE MANUAL ENTRIES BELOW THIS LINE! ####
    All my other postfix files are the same. Any idea what's generating that 560. It doesn't seem to be a problem with gmail. Seems it's my own server rejecting it.
     
  13. till

    till Super Moderator Staff Member ISPConfig Developer

    The above error message is from gmail and not from your server. the mail is rejected fby gmail and not by the postfix instance on your server.

    Maybe you did some kind of forwarding loop, so that a email is forwarded from your account to gmail and from gmail back to your account.
     
  14. heymrdj

    heymrdj Member

    Well I'm going to work with a reinstall, a final test copy and see if the problem exits. Cause somewhere I screwed up a config :p. I'll let ya guys know what I get. Thanks for the help.
     

Share This Page