Getting started with Postfix

Discussion in 'Server Operation' started by bradhawk, Dec 6, 2007.

  1. bradhawk

    bradhawk New Member

    Can someone point me in the right direction to get me started using Postfix? I set up my server using "The Perfect Server - Ubuntu Gusty Gibbon 7.10" and after resolving some inital issues I'm now turning my focus to email. I just need a manual or something to get me started.

    Thanks.
     
  2. falko

    falko Super Moderator Howtoforge Staff

  3. bradhawk

    bradhawk New Member

    Thanks for the tutorial.

    I followed all the steps except for :

    Code:
    useradd -d /home/sample_user -g users sample_user
    passwd sample_user
    because I assumed I could use the already existing user account that I use when I log onto the server machine.

    I didn't receive any error when completing the other steps. So I assume things are working correctly.

    How do I test this? I want to set up Microsoft Outlook 2003 to send and receive mail using the mail account that is listed in /etc/postfix/virtusertable. How do I go about doing this?

    i have the incoming mail server listed as : mail.cougforlife.com
    i have the outgoing mail server listed as : smtp.cougforlife.com

    i put my username and password in their respective boxes (same info as logging onto server machine) but when I test the account settings it completes:
    - establishing network connection
    - find outgoing mail server (SMTP)
    - find incoming mail server (POP3)

    fails:
    - send test e-mail message

    log onto incoming mail server doesn't fail or complete

    any tips ideas? thanks
     
  4. wpwood3

    wpwood3 New Member

    I would have used an A record in DNS for your SMTP & POP and an MX record for your mail server. Generally, I avoid CNAME but, that may not be your problem.

    This is what dig shows:
    Code:
    ; <<>> DiG 9.3.3rc2 <<>> mail.cougforlife.com
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4642
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 2
    
    ;; QUESTION SECTION:
    ;mail.cougforlife.com.          IN      A
    
    ;; ANSWER SECTION:
    mail.cougforlife.com.   3600    IN      [COLOR="red"]CNAME[/COLOR]   pop.secureserver.net.
    pop.secureserver.net.   1777    IN      A       64.202.165.92
    
    ;; AUTHORITY SECTION:
    secureserver.net.       1498    IN      NS      cns1.secureserver.net.
    secureserver.net.       1498    IN      NS      cns2.secureserver.net.
    
    ;; ADDITIONAL SECTION:
    cns1.secureserver.net.  134845  IN      A       64.202.167.31
    cns2.secureserver.net.  126947  IN      A       216.69.185.100
    Code:
    ; <<>> DiG 9.3.3rc2 <<>> mx cougforlife.com
    ;; global options:  printcmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 53232
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 2, ADDITIONAL: 3
    
    ;; QUESTION SECTION:
    ;cougforlife.com.               IN      MX
    
    ;; ANSWER SECTION:
    cougforlife.com.        3285    IN      MX      10 mailstore1.secureserver.net.
    cougforlife.com.        3285    IN      MX      0 [COLOR="Red"]smtp.secureserver.net.[/COLOR]
    
    ;; AUTHORITY SECTION:
    cougforlife.com.        3258    IN      NS      ns15.domaincontrol.com.
    cougforlife.com.        3258    IN      NS      ns16.domaincontrol.com.
    
    ;; ADDITIONAL SECTION:
    mailstore1.secureserver.net. 1288 IN    A       64.202.166.11
    ns15.domaincontrol.com. 76419   IN      A       64.202.165.118
    ns16.domaincontrol.com. 76419   IN      A       208.109.255.8
    Try making A records for:
    pop.cougforlife.com
    smtp.cougforlife.com
    mail.cougforlife.com

    and an MX record for:
    mail.cougforlife.com

    remove the cname
     
    Last edited: Dec 10, 2007
  5. bradhawk

    bradhawk New Member

    So here's my setup:

    A records (all point at my router's IP):
    smtp.cougforlife.com
    mail.cougforlife.com
    pop.cougforlife.com

    CNAMES:
    none that have to do with mail

    MX (both point at my router's IP):
    mail.cougforlife.com
    smtp.cougforlife.com

    When I try to set up outlook I receive the following errors:

    -Send test e-mail message: The specified server was found, but there was no response from the server. Please verify that the port and SSL information is correct. To access these settings close this dialog, then click More Settings and click on the Advanced tab.

    -Log onto incoming mail server (POP3): The specified server was found, but there was no response from the server. Please verify that the port and SSL information is correct. To access these settings close this dialog, then click More Settings and click on the Advanced tab.

    Any solutions?
     
  6. wpwood3

    wpwood3 New Member

    Need more info

    Ok it sounds like you are operating behind a router.
    Some questions...

    1) Is your router's IP address fixed or does it change each time you connect?

    2) Is your router setup to forward ports to your server? (25 & 110)

    3) What happens when you telnet into your server from another computer on your lan? For example, if the other computer is a Windows box do this:

    C:\telnet <server ip address> 25
    type "quit" to exit

    C:\telnet <server ip address> 110
    type "quit" to exit

    4) Post the contents of the following WITHOUT comments:
    /etc/postfix/main.cf
     
  7. bradhawk

    bradhawk New Member

    1) the router's IP address is dynamic if the router is unplugged, but it's never unpluged so the router always has the same IP address.

    2) yes ports 25 and 110 are port forwarded to my server's local IP address

    3) neither of them are able to connect to my server's IP address

    4) /etc/postfix/main.cf
    Code:
    smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
    biff = no
    
    append_dot_mydomain = no
    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
    
    myhostname = cougforlife.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
    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
    smtp_use_tls = yes
    smtp_tls_note_starttls_offer = yes
    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
    
    virtual_maps = hash:/etc/postfix/virtusertable
    mydestination = /etc/postfix/local-host-names
    home_mailbox = Maildir/
    
    I also must note that I can get my server set up with a static IP such that it will access the internet. I can get it set up to where I could connect to it through my browser and ftp and ssh, but couldn't get on the internet through the server box.

    See post http://www.howtoforge.com/forums/showthread.php?t=18288

    Please help get my static IP working then I can worry about mail.
     
  8. wpwood3

    wpwood3 New Member

    Ok, your main.cf looks ok but, if you cannot telnet into the server then there's a connectivity issue. When you say "neither of them are able to connect to my server's IP address" do you mean External IP address, Local IP address or both?

    Here's what I would do.
    Divide the problem into 2 pieces

    1) Fix the connectivity issue so you can telnet into your server as I described above. At the least you should be able to telnet to the server using the local IP of the server from another PC on the LAN.

    2) Install something like SquirrelMail on your server so you can verify Postfix is working without having to worry about the external issues. You can remove it later if you don't want it.

    Once you have done these things then you can focus on connecting via Outlook and making sure there are no DNS issues.
     
  9. bradhawk

    bradhawk New Member

    I was able to get my internet problem resolved through the other posts and now my email server works!! Thanks for everyones input!! It is greatly appreciated!!!
     
  10. bradhawk

    bradhawk New Member

    Virtual Users

    I have a question. I followed the setup as we've discussed previously on this thread and things work fine. I am curious however if it is possible to setup virtual users that will only be used with postfix and not the system. Is this possible?

    I know that it is possible to create virtual users that will only work with ftp, I am curious if I can do the same for email??

    Thanks for responses in advance.
     
  11. falko

    falko Super Moderator Howtoforge Staff

  12. bradhawk

    bradhawk New Member

    Still Problems

    I actually ended up stubbling upon that tutorial through searches and followed everything step by step and it seemed as though everything installed correctly, but when I try to access the account that I set up through Microsoft Outlook, I gives errors that it can't connect to the receiving server.

    My incoming server is listed as mail.cougforlife.com
    My outgoing server is listed as smtp.cougforlife.com

    And both A records are pointed at my server's address.


    Any solutions?
     
  13. falko

    falko Super Moderator Howtoforge Staff

    Have you tried your server's IP address in Outlook instead?
    What's the output of
    Code:
    netstat -tap
    and
    Code:
    iptables -L
    ?
     

Share This Page