#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Norfolk, UK
    Posts
    3
    Rep Power
    0

    Dovecot & Postfix Email Collection


    Hello all!

    Hope you're all well and I hope you've all had a better day than myself!

    For the past 4 days I have been attempting to configure Dovecot and Postfix on a new VPS running Linux & CentOS.

    With the system setup as it is right now I can:

    1) Send emails successfully to an external recipient.
    2) Receive emails sent from an external address and the mail is stored under what I deem to be the correct directory based upon the configuration that I have set up.
    3) Connect successfully to the server via a POP3 connection using telnet or Outlook successfully.

    However the issue is:

    Via a POP3 connection the inbox shows as being empty, even though I am able to see the mails stored within the 'new' directory within the /home/%u/mail/ directory.

    I presume that this is a directory issue and the POP3 connection is, to put it simply, looking in the wrong place for the unread mail. I have been working on this issue for a number of days, tweaking and changing all directory and user configurations to try and come to a resolution but so far I have been unsuccessful.

    I have not seen any reference to this issue online so I am hoping that this is something painfully obvious that I have overlooked.

    The setup I am currently working with:

    The output of doveconf -n

    Code:
    # 2.0.9: /etc/dovecot/dovecot.conf
    # OS: Linux 2.6.32-279.14.1.el6.x86_64 x86_64 CentOS release 6.3 (Final)
    auth_verbose = yes
    disable_plaintext_auth = no
    info_log_path = /var/log/dovecot-lda-info.log
    log_path = /var/log/dovecot-lda.log
    mail_location = maildir:~/mail
    mbox_write_locks = fcntl
    passdb {
      args = username_format=%n /etc/dovecot/passwd
      driver = passwd-file
    }
    passdb {
      driver = pam
    }
    protocols = imap pop3
    service auth {
      unix_listener /var/spool/postfix/private/auth {
        group = postfix
        mode = 0660
        user = postfix
      }
      user = $default_internal_user
    }
    service imap-login {
      inet_listener imap {
        port = 143
      }
      service_count = 1
    }
    ssl = no
    ssl_cert = </etc/pki/dovecot/certs/dovecot.pem
    ssl_key = </etc/pki/dovecot/private/dovecot.pem
    userdb {
      args = username_format=%n uid=vmail gid=vmail home=/home/vmail/%u/
      driver = static
    }
    userdb {
      driver = passwd
    }
    protocol pop3 {
      pop3_uidl_format = %08Xu%08Xv
    }
    And here is the output of postconf -n

    Code:
    alias_database = hash:/etc/aliases
    alias_maps = hash:/etc/aliases
    command_directory = /usr/sbin
    config_directory = /etc/postfix
    daemon_directory = /usr/libexec/postfix
    data_directory = /var/lib/postfix
    debug_peer_level = 2
    home_mailbox = mail/
    html_directory = no
    inet_interfaces = all
    inet_protocols = all
    local_recipient_maps =
    mail_owner = postfix
    mailbox_command = /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT"
    mailq_path = /usr/bin/mailq.postfix
    manpage_directory = /usr/share/man
    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
    mydomain = storejam.com
    myhostname = mail.storejam.com
    newaliases_path = /usr/bin/newaliases.postfix
    queue_directory = /var/spool/postfix
    readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
    relay_domains =
    sample_directory = /usr/share/doc/postfix-2.6.6/samples
    sendmail_path = /usr/sbin/sendmail.postfix
    setgid_group = postdrop
    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
    unknown_local_recipient_reject_code = 550
    virtual_transport = dovecot
    Also of interest is the output of
    Code:
    set | grep -1 mail
    Code:
    MACHTYPE=x86_64-redhat-linux-gnu
    MAIL=/var/spool/mail/root
    MAILCHECK=60
    Here is the output to the maillog for receiving an email:

    Code:
    Nov 26 20:16:22 544668 postfix/qmgr[27094]: A4B5D2C0F10: from=<myemailaddress@gmail.com>, size=2878, nrcpt=1 (queue active)
    Nov 26 20:16:22 544668 postfix/local[27233]: A4B5D2C0F10: to=<user@mydomain.com>, relay=local, delay=2845, delays=2845/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to command: /usr/libexec/dovecot/dovecot-lda -f "$SENDER" -a "$RECIPIENT")
    Nov 26 20:16:22 544668 postfix/qmgr[27094]: A4B5D2C0F10: removed
    To my relatively novice eyes this suggests that postfix has passed the mail to Dovecot's LDA the the mail command correctly. Dovecot appears to be storing the email in the correct directory on the server but not serving them for download via the POP3 connection.

    Here is the output of /var/log/dovecot-lda-info.log when checking mail via the POP3 connection.

    Code:
    Nov 26 23:32:43 pop3-login: Info: Login: user=<user>, method=PLAIN, rip=81.158.192.41, lip=217.199.161.208, mpid=28836
    Nov 26 23:32:47 pop3(user): Info: Disconnected: Logged out top=0/0, retr=0/0, del=0/0, size=0
    I have a feeling that this is due to the configuration of the user accounts. Initially I set up Dovecot to use virtual users using a /etc/dovecot/passwd file. I then ran into issues receiving mail and I found through trial and error that the solution was to have a 'real' user account setup also.

    If you need the output of any other logs in any conditions, let me know.

    Many many many thanks in advance for any help you may be able to give on this one.

    Anything at all is so greatly appreciated - At my wits end!

    Many thanks again!

    Sam Middleton [w34ver]
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Location
    Norfolk, UK
    Posts
    3
    Rep Power
    0
    Turns out that this configuration was too far gone. It wasn't authenticating users correctly due to the mismatch of authentication techniques.

    To resolve my issues, I started from fresh, removing dovecot and postfix completely and then clearing out all logs and mail directories.

    I then reinstalled dovecot and postfix and used my days of tinkering experience to configure the system correctly.

    Many thanks to all those who have read this thread with the hope to help!

    Thanks again!

    Sam Middleton
    [W34VER]

IMN logo majestic logo threadwatch logo seochat tools logo