DoK – Where Dreams Come From

C'è chi vede il bicchiere mezzo pieno e chi lo vede mezzo vuoto… Per me, l'acqua che manca, è traboccata fuori ;)

Qmailtoaster & Dovecot IMAP

Posted on | agosto 14, 2008 | 8 Comments

Hi tech guys :)
After dome days of big bugs from my previous IMAP server (Courier 4.2.x – AUthlib 0.59.2), I decided to upgrade to last version available (Courier IMAP 4.4.1 – Authlib 0.61.0). I always installed package from qmail toaster, so I build a new .rpm and .srpm version for courier and authlib mantaining upstream qmailtoaster version.

After installation, I noticed something wrong :(
I got this strange error: “libauthvchkpw.so: cannot open shared object file: No such file or directory”.
Why ?!?!?!? Simply because vpopmail support is’nt available with authlib 0.61.0 (from 0.60.4) !!!!!
But all my installation support vpopmail !!!!! ARGHHHHHHHHHHHHHHHHHHHHHHHHHHHH !!!

Don’t worry Salvatore, don’t worry :) The only file you need is libauthvchpw.so :)
I copied it from previous installation and all was OK :)

But…. bugs are still present… GRRRRR… I need another IMAP server… DOVECOT !!!!!

Installation is very very simple (yum installer help a lot :) ). But now it’s time to configure and migrate.

First, simple step 😉 Migration is immediate. All you need is to add this commands on /etc/dovecot.conf:

mail_location = maildir:~/Maildir
mail_uid = 89
mail_gid = 89
first_valid_uid = 89
last_valid_uid = 89
first_valid_gid = 89
last_valid_gid = 89

so you can access previous receveid mail 😉 Remeber, on qmail-toaster vpopmail uid/gid is 89. If you want to known which userid/groupid is assigned to your user, you need to issue from shell:

id vpopmail

Ok, now the hard work. Now you need to integrate your vpopmail installation (auth module) with DOVECOT. First of all, you can’t use SQL access. With qmail-toaster all domains have a separate table. This is’nt a problem… Real problem is domain translation !!! You can’t use %d (DOVECOT variable) because domain is translated. For example, my domain ansani.it is stored like ansani_it.

And now ?!?!?!? Don’t worry, you can use vchkpw and checkpassword :)

Yes yes yes yes, on your auth default section, you need to write something like that:

auth default {
mechanisms = plain
 
passdb checkpassword {
args = /home/vpopmail/bin/vchkpw
}
 
userdb prefetch  {
args = uid=89 gid=89 home=/home/vpopmail/domains/%d/%u
}
 
count = 1
}

Remember again, I’ve installed qmail-toaster and my mails are on /home/vpopmail/domains/MY_EMAIL_DOMAINS/MY_USERNAME_/Maildir.

After this mod, all works ok :)

Enjoyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy :)

Regards,
Salvatore

Comments

8 Responses to “Qmailtoaster & Dovecot IMAP”

  1. patrick
    ottobre 8th, 2008 @ 22:59

    hi!

    i am trying to setup dovecot with vpopmail on debian. everything seems to work ok, but:

    telnet localhost 143
    Trying 127.0.0.1…
    Connected to localhost.
    Escape character is ‘^]’.
    * OK Dovecot ready.
    a login [email protected] xxx
    a NO Authentication failed.

    dovecot: Oct 08 16:36:10 Info: Dovecot v1.1.4 starting up
    dovecot: Oct 08 16:36:10 Info: Generating Diffie-Hellman parameters for the first time. This may take a while..
    dovecot: Oct 08 16:43:17 Error: auth(default): tcprules: fatal: unable to create /etc/tcp.smtp.tmp.20161: access denied
    dovecot: Oct 08 16:43:17 Error: user postmaster: Logins with UID 0 not permitted
    dovecot: Oct 08 16:43:17 Info: imap-login: Internal login failure (auth failed, 1 attempts): user=, method=PLAIN, rip=127.0.0.1, lip=127.0.0.1, secured

    here’s the content of vpopmail database:

    select * from vpopmail;
    +————+————+————————————+——–+——–+————+————————————————-+———-+—————–+
    | pw_name | pw_domain | pw_passwd | pw_uid | pw_gid | pw_gecos | pw_dir | pw_shell | pw_clear_passwd |
    +————+————+————————————+——–+——–+————+————————————————-+———-+—————–+
    | postmaster | test.bogus | $1$8TUMu/ | 0 | 0 | Postmaster | /var/lib/vpopmail/domains/test.bogus/postmaster | NOQUOTA | xxx |

    do you have 2 minutes to help me?
    pat (canada / montreal)

  2. Salvatore Ansani
    ottobre 9th, 2008 @ 11:59

    Hi Pat,
    it seems you have a security issues creating /etc/tcp.smtp temp file.

    Which user do you use to launch dovecot ??

    Salvatore

  3. alex
    giugno 26th, 2009 @ 11:08

    To be compatible with Courier-imap You should additionaly write in dovecot.conf:
    namespace private {
    separator = .
    prefix = INBOX.
    inbox = yes
    }

    Without it will be the problem to access old emails.
    Regards,
    Aleksander Podsiadły

  4. alex
    luglio 31st, 2009 @ 14:05

    A little change from version 1.2.x, in userdb prefetch there is no args.
    From now proper configuration for qmailtoaster:
    auth default {
    passdb checkpassword {
    args = /home/vpopmail/bin/vchkpw
    }
    userdb prefetch {
    }
    userdb checkpassword {
    args = /home/vpopmail/bin/vchkpw
    }
    userdb static {
    args = uid=89 gid=89 home=/home/vpopmail/domains/%d/%u
    }
    count = 1
    }

  5. mvg
    agosto 18th, 2009 @ 18:44

    Qmailtoaster & Dovecot IMAP | DoK – Where Dreams Come From great article thank you.

  6. Parantido Julius De Rica
    agosto 27th, 2009 @ 14:04

    Mmmm,

    looks like a nice tutorial but … what happens when you get over 100 domains?!

    Dovecot authentication stops working!

  7. Parantido Julius De Rica
    agosto 27th, 2009 @ 14:10

    Ops,

    sorry for double post. I would to exply my previous reply.

    Vpopmail, above 100 domains, create a new directory called 0 inside of which it stores next 100 domains!

    Then you should to have something like that

    /home/vpopmail/domains/0/OTHER_DOMAINS

    Obviously following statement

    args = uid=89 gid=89 home=/home/vpopmail/domains/%d/%u

    Stops to work!

  8. Bryan
    febbraio 11th, 2011 @ 14:14

    If anyone is using this setup and Dovecot broke when upgrading from Debian Lenny -> Squeeze this is due to the migration to Dovecot 1.2. Alex’s update in the comments should fix the problem.

    auth default {
    passdb checkpassword {
    args = /home/vpopmail/bin/vchkpw
    }
    userdb prefetch {
    }
    userdb checkpassword {
    args = /home/vpopmail/bin/vchkpw
    }
    userdb static {
    args = uid=89 gid=89 home=/home/vpopmail/domains/%d/%u
    }
    count = 1
    }

Leave a Reply