Author Topic: [howto] replace courier with dovecot  (Read 7056 times)

corona

  • Zen Apprentice
  • *
  • Posts: 44
  • Karma: +0/-0
    • View Profile
[howto] replace courier with dovecot
« on: October 07, 2008, 02:33:21 am »
So courier was giving neverending ssl problem, and I replaced it with dovecot. It was quite easy.
First you need to install dovecot.
Code: [Select]
sudo apt-get install dovecot-common dovecot-imapd dovecot-pop3d This will remove courier (whoo-hoo) and ebox-mail (still trying to fix that bit) and install dovecot. Then just copy the attached dovecot conf files to /etc/dovecot (backup the existing files if you like).

These are set up for imap(+ssl) and pop(+ssl) where the certificates are stored in /etc/dovecot/ssl.
You will need to sort these yourself, either self-signed or real. If real you need your crt file + all the chain/trusted root files concatenated into /etc/dovecot/ssl/dovecot.pem and the key file stored as /etc/dovecot/ssl/dovecot_key.pem
Make sure they're...
Code: [Select]
chown root:root /etc/dovecot/ssl/*
chmod 0400 /etc/dovecot/ssl/*


The mail login takes the info straight from the ldap where login user is the full email address and the password is as set by ebox. Cleartext passwords have been enabled (disabled by default) you can disable these again in dovecot.conf if these are undesired.

Dovecot accesses the mailboxes as the ebox user, with the ebox user uid and gid have been set in dovecot.conf. You will need to look these up in /etc/passwd and /etc/groups and update the id numbers in dovecot.conf at 'first_valid_uid' (line 338) and userdb static -> args (line 940). AFAIK the numbers can just be replaced by the word ebox, but this may slow the daemon down slightly, I went the safe route.

If your users use pop for their mailboxes, and leave messages on the server, they will probably get them downloaded again as duplicates. I was too lazy to figure out the pop3_uidl_format that the courier in ebox uses, I set it to the standard courier one, and still got duplicated emails, but the dupes aren't that big a problem, and most default settings in mail clients do not leave messages on the server anyway, so it's only relatively power users who will see the problem, and it's a once off problem.

Enjoy,
Andrew

javi

  • Zen Hero
  • *****
  • Posts: 1042
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #1 on: October 07, 2008, 03:32:04 pm »
Hey Andrew,

I've just created a  new package called ebox-mail-dovecot. It's a quick and dirty modification to support dovecot based on your configuration. Please if you could try it and give me some feedback it would be great. The package is available in http://people.warp.es/~javi/ebox-mail-dovecot_0.12.3_all.deb

If you try the package in a machine where you had previously installed ebox-mail you will have to run the following command right after you install the new package.

Code: [Select]
/usr/share/ebox/ebox-unconfigure-module mail

Keep in mind that the pop  and imap both ssl and clear are enabled by ticking de pop box. If you give me positive feedback, i'll spend more time on this package to polish what is needed.

Thanks again for sending your conf.


corona

  • Zen Apprentice
  • *
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #2 on: October 08, 2008, 12:32:31 am »
Oh yeah, forgot one other thing on the migrate, you have to run
"courier-dovecot-migrate.pl" from http://wiki.dovecot.org/Migration/Courier on the maildirs.

just cd to /var/vmail and run /path/to/courier-dovecot-migrate.pl --recursive and if it comes back with no errors run /path/to/courier-dovecot-migrate.pl --recursive --convert

I'll try the new package on the backup server. The unconfigure command, is that going to get rid of all the virtual mail domains and all the other postfix settings as well?

Thanks,
Andrew

corona

  • Zen Apprentice
  • *
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #3 on: October 08, 2008, 02:07:35 am »
That package seems to have gone on smoothly onto the backup server ( which had a running copy of dovecot on it ) .
I uninstalled ebox-mail (which i had previously force-installed), and installed your deb. I ran the unconfigure line above, logged into ebox, enabled the module, agreed to all the overwriting files (which did include the dovecot files). and saved changes. All my mail settings were still there, and the pop account on the server still checks mail fine, so it looks good. I'll wait a bit before I do the same on the main server, make sure I'm happy with it on the backup one.

Thanks,
Andrew

corona

  • Zen Apprentice
  • *
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #4 on: October 30, 2008, 09:47:09 pm »
Just another update, best part of a month gone since doing this, and our email server has been rock solid ever since, never a single problem logging into the dovecot pop/imap server on SSL ports (which I try to ensure all our users use).

Definitely recommend migrating the dovecot package into the standard ebox package.

Andrew

pocetrus

  • Zen Apprentice
  • *
  • Posts: 19
  • Karma: +1/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #5 on: November 17, 2008, 05:09:56 pm »
I have done this replacement following your description on a clean system from ebox-CD followed by the changes described above. First "Restart" of Summary/Mail system worked fine. Second "Restart" of the same with no changes between shows an Error-message:
"You have just hit a bug in eBox. Please seek technical support."
I had no groups and users defined at this time. If I do some changes in the Mail-Server-options and hit "(Red)Save changes" and then "Save" it seems to do this until "Saving mail module" - this seems not to finish. The green "Changes saved" bar never appears. Other changes except Mail-module: no problem.
Any Ideas or Infos which *.log file I should inspect?

Thanks,
Charles

Update:
I am able to save changes in the "Mail-Server-Options" as long as the Mail-Module-status is not active. When I activate it, same problem as above, and it shows status "stopped" and didn't start.
After a reboot ebox is not accessible from (Firefox)browser, but normal web (http) is.
« Last Edit: November 17, 2008, 07:57:58 pm by pocetrus »

corona

  • Zen Apprentice
  • *
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #6 on: November 17, 2008, 09:21:02 pm »
The log file to check first is /var/log/ebox/ebox.log and /var/log/ebox/error.log
They should hopefully point to which part of the module is throwing the error. You may have to wade through a log of firewall and ldap messages to find the right one, I suggest trying to save changes again and then immediately checking the logs.

Andrew

pocetrus

  • Zen Apprentice
  • *
  • Posts: 19
  • Karma: +1/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #7 on: November 17, 2008, 10:35:18 pm »
Thanks for Your fast answer.
Here are the last lines from the *.log files right after the malefunction appears.
Is there anything I can do - I am no programmer?!

/var/log/ebox/ebox.log
======================
2008/11/17 22:15:24 DEBUG> LogFiltering.pm:70 EBox::Events::Model::Watcher::LogFiltering::new - Missing argument: tableInfo
2008/11/17 22:15:24 WARN> Events.pm:623 EBox::Events::__ANON__ - model EBox::Events::Model::Watcher::LogFiltering cannot be instantiated
2008/11/17 22:15:37 INFO> Module.pm:135 EBox::Module::restartService - Restarting service for module: mail

/var/log/ebox/error.log
=======================
[Mon Nov 17 22:15:24 2008] [error] [client 10.0.0.4]
File does not exist: /usr/share/ebox/www/images/thead-b.png, referer: https://10.0.0.3/data/css/public.css
Subroutine EBox::Loggerd::O_APPEND redefined at /usr/share/perl/5.8/Exporter.pm line 65.at /usr/lib/perl/5.8/POSIX.pm line 19
Subroutine EBox::Loggerd::O_CREAT redefined at /usr/share/perl/5.8/Exporter.pm line 65.at /usr/lib/perl/5.8/POSIX.pm line 19
Subroutine EBox::Loggerd::O_EXCL redefined at /usr/share/perl/5.8/Exporter.pm line 65.at /usr/lib/perl/5.8/POSIX.pm line 19
Subroutine EBox::Loggerd::O_RDWR redefined at /usr/share/perl/5.8/Exporter.pm line 65.at /usr/lib/perl/5.8/POSIX.pm line 19

Thanks,
Charles
« Last Edit: November 19, 2008, 12:01:01 am by pocetrus »

corona

  • Zen Apprentice
  • *
  • Posts: 44
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #8 on: November 17, 2008, 10:54:04 pm »
It looks to me that the problem is in the mail-filter module, "EBox::Events::Model::Watcher::LogFiltering" and more specifically the logging if it. I never got around to reinstalling the mail-filter module on our system here after the dovecot change, so you should try uninstalling it for a start. 'apt-get remove ebox-mail-filter' should work I think. Then give it a go, see if that fixes the problem.

If that does work, you could try reinstalling it if you want to use it, and if it still doesn't work then there's obviously some incompatibilty between them, and you'll have to wait until a maintainer comes along to help (or open a ticket in the bug tracker).

I'm not directly involved in the programming of ebox myself, and don't have much time around work to learn enough to get into the depth of it.

Good Luck!
Andrew

sixstone

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1417
  • Karma: +26/-0
    • View Profile
    • Sixstone's blog
Re: [howto] replace courier with dovecot
« Reply #9 on: November 18, 2008, 08:18:54 am »
I have done this replacement following your description on a clean system from ebox-CD followed by the changes described above. First "Restart" of Summary/Mail system worked fine. Second "Restart" of the same with no changes between shows an Error-message:
"You have just hit a bug in eBox. Please seek technical support."
I had no groups and users defined at this time. If I do some changes in the Mail-Server-options and hit "(Red)Save changes" and then "Save" it seems to do this until "Saving mail module" - this seems not to finish. The green "Changes saved" bar never appears. Other changes except Mail-module: no problem.
Any Ideas or Infos which *.log file I should inspect?

May you enable debug by setting to "yes" the debug in /etc/ebox/99ebox.conf file. After that, try to reproduce the bug and paste here the shown information.

Thanks.
My secret is my silence...

pocetrus

  • Zen Apprentice
  • *
  • Posts: 19
  • Karma: +1/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #10 on: November 18, 2008, 10:28:43 am »
I have done a clean install once more from the eBox-CD and after the dovecot-procedere I switched the debug to yes.
So here is the info I got when restarting the Mail system.
I did it twice with activating File sharing inbetween.
Both debug-info-files are attached.

Thanks for your advice.
Charles

PS.: Thanks to Andrew too for your Tip.
eBox-mailfilter was removed (by dovecot installation before, I think), and never reinstalled.

javi

  • Zen Hero
  • *****
  • Posts: 1042
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #11 on: November 18, 2008, 04:43:58 pm »
Ok, can you please edit the following file:

Code: [Select]
/usr/share/ebox/stubs/mailfilter/dovecot.conf.mas

And remove this line:

Code: [Select]
#login_log_format_elements = user=<%u> method=%m rip=%r lip=%l %c

Save the file and try again :)

pocetrus

  • Zen Apprentice
  • *
  • Posts: 19
  • Karma: +1/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #12 on: November 18, 2008, 05:32:41 pm »
Hey, thanks - works great - no more errors after changing this -   :) :) :).

One little thing: on my system the path is
Code: [Select]
/usr/share/ebox/stubs/mail/dovecot.conf.mas
instead of .../mailfilter/... .

Now I can go on with testing around and setups and in a few days migrating my server.

Thanks a lot once more for your immediat support,
and this excelent solution of free servermanagement.
Charles
« Last Edit: December 08, 2008, 10:36:21 pm by pocetrus »

dexter18

  • Zen Apprentice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #13 on: November 19, 2008, 12:23:56 pm »
I guys!
Very nice work. You are wonderfull people.
I install ebox-dovecot-mail and I tkink is ok!

I can't get it work thunderbird: when I enable smtp authentification, after ai click ok on the certifcate messaje: "Mail server does net suport secure auth".
I tried every dam thing!

Please help!

Another question: The network domain name must be the same with the one form dns entries: EXAMPLE(LAN DOMAIN) and EXAMPLE.LOCAL(DNS entry)

Have a nice day!  ;)
« Last Edit: November 19, 2008, 02:10:26 pm by dexter18 »

pocetrus

  • Zen Apprentice
  • *
  • Posts: 19
  • Karma: +1/-0
    • View Profile
Re: [howto] replace courier with dovecot
« Reply #14 on: January 13, 2009, 03:05:53 pm »
Now, about 8 weeks after migrating my server to ubuntu 8.10 + EBox (8.04 has some weakness doing special RAID constellation) + Dovecot + Getmail, I am very happy with the EBox-solution. Works great.

One little (cosmetic) point I noticed:
On the Summary -> Status Page -> Section - Mail: POP3 and IMAP services are shown as "Stopped" althougt they are runnig both.

When I tested the system before changing to dovecot this fields showed correct entries.

Have a nice day
Charles