Help needed with Fetchmail and Dovecot

Discussion in 'Server Operation' started by Lord Wodan, Sep 7, 2007.

  1. Lord Wodan

    Lord Wodan New Member

    Hi,

    I have asked this question on many fora but no one seems to be able to put me on my way.

    Ik think this should be easy but really dont know where to look any more.

    My system user is Sander.
    Fetchmails succeeds in putting my email from mail.blablah.com into /var/mail/Sander

    (I cannot find the conf file for Fetchmail, if you tell me i'll post it)

    If I open /var/mail/sander i can see the mail has arrived

    After this,

    I installed Dovecot and uses some examples from the internet en the wiki.dovecot.

    What I want to accomplish is that I can use Imap to read my email from any computer in my network (both Linux/Windows)

    Dovecot.conf:
    Code:
    # Remove pop3 things if you don't want them
    protocols = imap imaps
    
    # It's nice to have separate log files for Dovecot. You could do this
    # by changing syslog configuration also, but this is easier.
    log_path = /var/log/dovecot.log
    info_log_path = /var/log/dovecot-info.log
    
    # Disable SSL for now.
    ssl_disable = yes
    disable_plaintext_auth = no
    
    # We're using Maildir format(NOT)
    mail_location = mbox:~/mail:INBOX=/var/mail/%u
    
    
    # Optimizations:
    # dotlock_use_excl=yes
    maildir_copy_with_hardlinks=yes
    
    # Authentication configuration:
    auth_verbose = yes
    
    auth default {
      mechanisms = plain
      passdb passwd-file {
        args = /etc/passwd.dovecot
      }
    userdb passwd {
      }
    }
    
    my passwd.dovecot:

    Code:
    sander:{PLAIN}123456
    
    When I try to log in by telnet

    telnet 192.168.1.110 I get Dovecot ready (WOW!)
    login sander 123456

    ERROR!

    Can anyone help?
     
  2. Lord Wodan

    Lord Wodan New Member

    also tried locally:

    Code:
    Butler:/home/sander# telnet localhost 143
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    * OK Dovecot ready.
    login sander 123456
    login BAD Error in IMAP command received by server.
    
     
  3. falko

    falko Super Moderator Howtoforge Staff

    Dovecot uses Maildir format, while you're curreently using mbox (/var/mail/sander). That's why Dovecot can't find your emails.

    If you're using Postfix, do this:

    Code:
    postconf -e 'home_mailbox = Maildir/'
    postconf -e 'mailbox_command ='
    /etc/init.d/postfix restart
     
  4. Lord Wodan

    Lord Wodan New Member

    I am not using postfix but fetchmail. Fetchmail fetches my email from my internetprovider and puts it in var/mail/sander

    I only want dovecot to read my mail from/sander
     
  5. Lord Wodan

    Lord Wodan New Member

    so /var/mail/<user> is MBOX?

    ok, how to setup Dovecot to do that?
     
  6. Lord Wodan

    Lord Wodan New Member

    I got it working (pretty unsafe)

    I'll try to strip my dovecot.conf so I can post it.

    pff what a file!!! grrr
     
    Last edited: Sep 8, 2007
  7. Lord Wodan

    Lord Wodan New Member

    When i strip it of all the commented Items it wont work any more.

    Then the most important items:

    Code:
    protocols = imap imaps
    
    disable_plaintext_auth = no
    
    ssl_disable = yes
    
    mail_location = mbox:~/mail:INBOX=/var/mail/%u
    
    mail_extra_groups = mail
    
    protocol imap {
      # Login executable location.
      #login_executable = /usr/lib/dovecot/imap-login
    
      # IMAP executable location. Changing this allows you to execute other
      # binaries before the imap process is executed.
      #
      # This would write rawlogs into ~/dovecot.rawlog/ directory:
      #   mail_executable = /usr/lib/dovecot/rawlog /usr/lib/dovecot/imap
      #
      # This would attach gdb into the imap process and write backtraces into
      # /tmp/gdbhelper.* files:
      #   mail_executable = /usr/libexec/dovecot/gdbhelper /usr/libexec/dovecot/imap
      #
      #mail_executable = /usr/lib/dovecot/imap
    
      # Maximum IMAP command line length in bytes. Some clients generate very long
      # command lines with huge mailboxes, so you may need to raise this if you get
      # "Too long argument" or "IMAP command line too large" errors often.
      #imap_max_line_length = 65536
    
      # Support for dynamically loadable plugins. mail_plugins is a space separated
      # list of plugins to load.
      #mail_plugins = 
      #mail_plugin_dir = /usr/lib/dovecot/modules/imap
    
      # Send IMAP capabilities in greeting message. This makes it unnecessary for
      # clients to request it with CAPABILITY command, so it saves one round-trip.
      # Many clients however don't understand it and ask the CAPABILITY anyway.
      #login_greeting_capability = no
    
      # Override the IMAP CAPABILITY response.
      #imap_capability = 
    
      # Workarounds for various client bugs:
      #   delay-newmail:
      #     Send EXISTS/RECENT new mail notifications only when replying to NOOP
      #     and CHECK commands. Some clients ignore them otherwise, for example
      #     OSX Mail. Outlook Express breaks more badly though, without this it
      #     may show user "Message no longer in server" errors. Note that OE6 still
      #     breaks even with this workaround if synchronization is set to
      #     "Headers Only".
      #   outlook-idle:
      #     Outlook and Outlook Express never abort IDLE command, so if no mail
      #     arrives in half a hour, Dovecot closes the connection. This is still
      #     fine, except Outlook doesn't connect back so you don't see if new mail
      #     arrives.
      #   netscape-eoh:
      #     Netscape 4.x breaks if message headers don't end with the empty "end of
      #     headers" line. Normally all messages have this, but setting this
      #     workaround makes sure that Netscape never breaks by adding the line if
      #     it doesn't exist. This is done only for FETCH BODY[HEADER.FIELDS..]
      #     commands. Note that RFC says this shouldn't be done.
      #   tb-extra-mailbox-sep:
      #     With mbox storage a mailbox can contain either mails or submailboxes,
      #     but not both. Thunderbird separates these two by forcing server to
      #     accept '/' suffix in mailbox names in subscriptions list.
      # The list is space-separated.
      #imap_client_workarounds = outlook-idle
    }
      
    
    auth default {
    
      mechanisms = plain
    }
    
    
    I think thats it but with only this it wont run

    What are te differences? And why does it work now? The only thing I can see is that the passwd.dovecot is left out.
     
  8. falko

    falko Super Moderator Howtoforge Staff

    What's the output of
    Code:
    netstat -tap
    and
    Code:
    telnet localhost 25
    ?
     
  9. Lord Wodan

    Lord Wodan New Member

    I'll Check.

    ISPConfig in NOT running on this machine, only Samba and fetchmail.

    netstat -tap
    Code:
    sander@Butler:~$ netstat -tap
    (Not all processes could be identified, non-owned process info
     will not be shown, you would have to be root to see it all.)
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 192.168.1.110:mysql     *:*                     LISTEN     -
    tcp        0      0 *:netbios-ssn           *:*                     LISTEN     -
    tcp        0      0 *:imap2                 *:*                     LISTEN     -
    tcp        0      0 *:39311                 *:*                     LISTEN     -
    tcp        0      0 *:sunrpc                *:*                     LISTEN     -
    tcp        0      0 *:webmin                *:*                     LISTEN     -
    tcp        0      0 *:auth                  *:*                     LISTEN     -
    tcp        0      0 localhost:ipp           *:*                     LISTEN     -
    tcp        0      0 localhost:smtp          *:*                     LISTEN     -
    tcp        0      0 *:microsoft-ds          *:*                     LISTEN     -
    tcp        0      0 192.168.1.110:imap2     192.168.1.100:1305      ESTABLISHED-
    tcp        0      0 192.168.1.110:59092     digg.com:www            ESTABLISHED4442/firefox-bin
    tcp        0      0 192.168.1.110:36584     stat.onestat.com:www    ESTABLISHED4442/firefox-bin
    tcp        0      0 192.168.1.110:imap2     sanders-pit.nl:4381     ESTABLISHED-
    tcp        0      0 192.168.1.110:imap2     sanders-pit.nl:4380     ESTABLISHED-
    tcp        0      0 192.168.1.110:imap2     sanders-pit.nl:4379     ESTABLISHED-
    tcp        0      0 192.168.1.110:imap2     sanders-pit.nl:4378     ESTABLISHED-
    tcp        0      0 192.168.1.110:imap2     sanders-pit.nl:4377     ESTABLISHED-
    tcp        0      0 192.168.1.110:38350     kr-in-f164.google.c:www ESTABLISHED4442/firefox-bin
    tcp        0      0 192.168.1.110:38352     kr-in-f164.google.c:www ESTABLISHED4442/firefox-bin
    tcp        0      0 192.168.1.110:58072     ro-in-f99.google.co:www ESTABLISHED4442/firefox-bin
    tcp        0      0 192.168.1.110:49014     webmail.versatel.n:pop3 TIME_WAIT  -
    tcp6       0      0 *:www                   *:*                     LISTEN     -
    tcp6       0      0 *:ssh                   *:*                     LISTEN     -
    tcp6       0      0 *:https                 *:*                     LISTEN     -
    
    Telnet

    Code:
    sander@Butler:~$ telnet localhost 25
    Trying 127.0.0.1...
    Connected to localhost.
    Escape character is '^]'.
    220 Butler.MSHOME ESMTP Exim 4.63 Mon, 10 Sep 2007 14:54:35 +0200
    
    Oh yes, I am browsing with te pc at this moment

    The Dovecot works at this moment but in my eyes unsafe. (no ssl, no passwd.dovecot, just using system users)

    Later on ISP config is to be installed here as well.
     
  10. falko

    falko Super Moderator Howtoforge Staff

    You have Exim installed. If you'd like to install ISPConfig, you must replace Exim with Postfix. Whic distribution do you use?
     
  11. Lord Wodan

    Lord Wodan New Member

    Exim? I never installed it on purpose.

    I use Debian 4.0r1.
     
  12. falko

    falko Super Moderator Howtoforge Staff

  13. Lord Wodan

    Lord Wodan New Member

    I know and also did that on another computer which serves ISPconfig now. The point was that I want to merge these 2 pcs. I'll start another tread with more info. ok?
     

Share This Page