[Dovecot] Script to install dovecot 1.2 plus Managerootsieve to CentOS5.2
I have no idea if this is of interest to anyone but it might save you some work .. I created a script that will install Dovecot 1.2-rc2 (currently) to a CentOS5.2 installation complete with Stephan Bosch's Managesieve, postfix, virtual users, LDAP, and LDAP personal address books. Oh right! .. and Squirrelmail plus various plugins (change LDAP password, LDIF import, Avelsieve). Also self-signed certificates are created from data supplied in a configuration file. I've stuck the required files here: http://www.nightstorm.com/~bam/CentOS5.2/ I did an install to a 32 bit CentOS so it has worked at least once on that architecture. It *should* work on a 64 bit as well (I provide the RPM) but I've not personally tested it. I am by no means an expert on any of this stuff (particularly the security aspects), so I'd certainly welcome any suggestions for ways to improve on the installation, the script, life, the universe, ... ;-) - Bruce
Re: [Dovecot] Problem with opening ports in alpha5 ?
Timo Sirainen wrote: > On Wed, 2009-01-07 at 07:31 -0500, Bruce A. Mallett wrote: > >> I've now had a change to try this using ... >> http://www.dovecot.org/nightly/dovecot-20090107.tar.gz >> > .. > >> -bash-3.2# dovecot -n >> # 1.2.alpha4: /etc/dovecot.conf >> > > Something's wrong. It should say alpha5. > You are true, I messed up. Sorry. This turned out to be more complicated than I initially expected. Why? Well, FWIW ... I've a spec file that I use to build an RPM for Centos5.2-64 which combines the dovecot-alphaX with the corresponding sieve and managesieve sources. So building a nightly with this does not work because the managesieve is not in sync (unless you can point me to a nightly of that as well) and won't build with the existing managesieve-alpha5. I ended up dropping back to building an RPM of just the dovecot sans the sieve portion using the nightly tar file. Having no sieve of course means that I had to delete that stuff from the dovecot.conf. Here is what I now get with the install of just the dovecot nightly (no sieve): == First with the "listen = *" commented out: -bash-3.2# dovecot -F Fatal: listen(::, 143) failed: Address already in use -bash-3.2# dovecot -n # 1.2.alpha5: /etc/dovecot.conf # OS: Linux 2.6.18-92.1.18.el5xen x86_64 CentOS release 5.2 (Final) ext3 info_log_path: /var/log/dovecot.log ssl_cert_file: /etc/postfix/ssl/smtpd.crt ssl_key_file: /etc/postfix/ssl/smtpd.key login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login max_mail_processes: 100 first_valid_uid: 150 last_valid_uid: 150 mail_location: maildir:/var/vmail/%d/%n mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 auth default: mechanisms: digest-md5 cram-md5 plain debug: yes debug_passwords: yes passdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf userdb: driver: prefetch userdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf socket: type: listen client: path: /var/run/dovecot/auth-client mode: 432 master: path: /var/run/dovecot/auth-master mode: 384 user: vmail group: mail == Next with the "listen = *" enabled: -bash-3.2# dovecot -F # It works! Had to ^C the above -bash-3.2# dovecot -n # 1.2.alpha5: /etc/dovecot.conf # OS: Linux 2.6.18-92.1.18.el5xen x86_64 CentOS release 5.2 (Final) ext3 info_log_path: /var/log/dovecot.log listen: * ssl_cert_file: /etc/postfix/ssl/smtpd.crt ssl_key_file: /etc/postfix/ssl/smtpd.key login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login max_mail_processes: 100 first_valid_uid: 150 last_valid_uid: 150 mail_location: maildir:/var/vmail/%d/%n mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 auth default: mechanisms: digest-md5 cram-md5 plain debug: yes debug_passwords: yes passdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf userdb: driver: prefetch userdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf socket: type: listen client: path: /var/run/dovecot/auth-client mode: 432 master: path: /var/run/dovecot/auth-master mode: 384 user: vmail group: mail == Next I change to "listen = [::]" : -bash-3.2# dovecot -F # It works again! ^C'd the above -bash-3.2# dovecot -n # 1.2.alpha5: /etc/dovecot.conf # OS: Linux 2.6.18-92.1.18.el5xen x86_64 CentOS release 5.2 (Final) ext3 info_log_path: /var/log/dovecot.log listen: [::] ssl_cert_file: /etc/postfix/ssl/smtpd.crt ssl_key_file: /etc/postfix/ssl/smtpd.key login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login max_mail_processes: 100 first_valid_uid: 150 last_valid_uid: 150 mail_location: maildir:/var/vmail/%d/%n mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec
Re: [Dovecot] Problem with opening ports in alpha5 ?
Timo Sirainen wrote: > On Tue, 2009-01-06 at 09:55 -0500, Bruce A. Mallett wrote: > >> If I leave the "listen" value as the default in /etc/dovecot.conf I'll >> get a message similar to the following on each port that it tries to >> open during startup: >> >> # dovecot -F >> Fatal: listen(::, 143) failed: Address already in use >> >> If I set either: >> listen = * >> >> or >>listen = [::] >> >> then it will start up fine. Perhaps it is as though the code tries to >> open the port twice for both ip4 and ip6? >> > > I can't reproduce this with current hg. Could you try if this still > happens with nightly snapshots? If it does, dovecot -n output might show > something useful. Oh and what OS are you using? > > Timo, I've now had a change to try this using ... http://www.dovecot.org/nightly/dovecot-20090107.tar.gz It still fails as before. It is curious however that the failure does not occur in a Centos 5.2-64bit install under VMWare but it does occur on a Centos 5.2-64bit VPS. The output is below. Let me know how else I might help. - Bruce === -bash-3.2# uname -a Linux mail 2.6.18-92.1.18.el5xen #1 SMP Wed Nov 12 09:48:10 EST 2008 x86_64 x86_64 x86_64 GNU/Linux -bash-3.2# iptables -L -v iptables v1.3.5: can't initialize iptables table `filter': iptables who? (do you need to insmod?) Perhaps iptables or your kernel needs to be upgraded. -bash-3.2# lsof -i COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME master 1069 root 11u IPv4 2879 TCP *:smtp (LISTEN) avahi-dae 1144 avahi 13u IPv4 3192 UDP *:mdns avahi-dae 1144 avahi 14u IPv4 3194 UDP *:44308 sshd 2493 root3u IPv4 36284 TCP *:ssh (LISTEN) sshd 26501 root3u IPv4 422259 TCP vaserv.com:ssh->c-75-67-244-49.hsd1.nh.comcast.net:33143 (ESTABLISHED) -bash-3.2# dovecot -F Fatal: listen(::, 143) failed: Address already in use -bash-3.2# dovecot -n # 1.2.alpha4: /etc/dovecot.conf # OS: Linux 2.6.18-92.1.18.el5xen x86_64 CentOS release 5.2 (Final) ext3 info_log_path: /var/log/dovecot.log protocols: imap imaps pop3 pop3s managesieve ssl_cert_file: /etc/postfix/ssl/smtpd.crt ssl_key_file: /etc/postfix/ssl/smtpd.key login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login login_executable(managesieve): /usr/libexec/dovecot/managesieve-login max_mail_processes: 100 first_valid_uid: 150 last_valid_uid: 150 mail_location: maildir:/var/vmail/%d/%n mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_executable(managesieve): /usr/libexec/dovecot/managesieve mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 mail_plugin_dir(managesieve): /usr/lib64/dovecot/managesieve auth default: mechanisms: digest-md5 cram-md5 plain debug: yes debug_passwords: yes passdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf userdb: driver: prefetch userdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf socket: type: listen client: path: /var/run/dovecot/auth-client mode: 432 master: path: /var/run/dovecot/auth-master mode: 384 user: vmail group: mail plugin: sieve: ~/.dovecot.sieve sieve_storage: /var/vmail/%d/%n/sieve -bash-3.2# clear -bash-3.2# uname -a Linux mail 2.6.18-92.1.18.el5xen #1 SMP Wed Nov 12 09:48:10 EST 2008 x86_64 x86_64 x86_64 GNU/Linux -bash-3.2# dovecot -F Fatal: listen(::, 143) failed: Address already in use -bash-3.2# dovecot -n # 1.2.alpha4: /etc/dovecot.conf # OS: Linux 2.6.18-92.1.18.el5xen x86_64 CentOS release 5.2 (Final) ext3 info_log_path: /var/log/dovecot.log protocols: imap imaps pop3 pop3s managesieve ssl_cert_file: /etc/postfix/ssl/smtpd.crt ssl_key_file: /etc/postfix/ssl/smtpd.key login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login login_executable(managesieve): /usr/libexec/dovecot/managesieve-login max_mail_processes: 100 first_valid_uid: 150 last_valid_uid: 150 mail_location: maildir:/var/vmail/%d/%n mail_debug: yes mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_executable(managesieve): /usr/libexec/dovecot/managesieve mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(
Re: [Dovecot] Problem with opening ports in alpha5 ?
CentOS 5.2 - 64 bit I'll give it a try later tonight and report back tomorrow. Timo Sirainen wrote: > On Tue, 2009-01-06 at 09:55 -0500, Bruce A. Mallett wrote: > >> If I leave the "listen" value as the default in /etc/dovecot.conf I'll >> get a message similar to the following on each port that it tries to >> open during startup: >> >> # dovecot -F >> Fatal: listen(::, 143) failed: Address already in use >> >> If I set either: >> listen = * >> >> or >>listen = [::] >> >> then it will start up fine. Perhaps it is as though the code tries to >> open the port twice for both ip4 and ip6? >> > > I can't reproduce this with current hg. Could you try if this still > happens with nightly snapshots? If it does, dovecot -n output might show > something useful. Oh and what OS are you using? > >
[Dovecot] Problem with opening ports in alpha5 ?
If I leave the "listen" value as the default in /etc/dovecot.conf I'll get a message similar to the following on each port that it tries to open during startup: # dovecot -F Fatal: listen(::, 143) failed: Address already in use If I set either: listen = * or listen = [::] then it will start up fine. Perhaps it is as though the code tries to open the port twice for both ip4 and ip6? - Bruce
[Dovecot] symlink() failure in 1.2 managesieve
I've been simultaneously learning about dovecot and experimenting with the 1.2.alpha4. To start I built an rpm under CentOS 5.2 from: dovecot-1.2.alpha4.tar.gz dovecot-1.2-managesieve-0.11.2.tar.gz dovecot-1.2.alpha4-managesieve-0.11.2.diff.gz dovecot-1.2.alpha4.tar.gz dovecot-1.2-sieve-0.1.2.tar.gz and then setup with mysql to use virtual users. Mail-wise, it all works. :) Where I'm having trouble is with the managesieve part. I find that when I activate a sieve script I get a symlink() failure message in /var/log/maillog similar to this: Dec 2 05:12:47 hostname dovecot: MANAGESIEVE([EMAIL PROTECTED]): sieve-storage: Creating symlink() hostname.com/account//.dovecot.sieve to /usr/local/virtual/hostname.com/account/sieve/Test.sieve failed: No such file or directory I began to chase this first by inserting i_info() calls into various points of the managesieve build and later by attaching to the process with gdb. I can see that in sieve_storage_script_activate() the storage->active_path member is incomplete (i.e., is not a full, absolute path name) and the cwd is "/tmp", thus the symlink() call fails. Based on what I've been reading in the documentation, shouldn't the system have resolved the "home" area for the mail to be the same as what is determined for the virtual user mail area? Using the README in the alpha4 package I've found that I can get it to work by adding the following after the "protocol manageseive {}" section: plugin { sieve=/usr/local/virtual/%d/%n/.dovecot.sieve sieve_storage=/usr/local/virtual/%d/%n/sieve } While that helps, I'm a little confused as to why I need to do this. I believe that the documentation states that the sieve defaults to .dovecot.sieve under the MAIL_LOCATION directory. So it is not clear to me if I am doing something wrong, if there is an oversight in the software and/or documentation (or perhaps my reading of it), or is it really necessary to specify the same information multiple times? - Bruce Here is some output that may be of use: -bash-3.2# dovecot -n # 1.2.alpha4: /etc/dovecot.conf # OS: Linux 2.6.18-8.1.8.el5xen x86_64 CentOS release 5.2 (Final) ext3 info_log_path: /var/log/dovecot.log protocols: imap imaps pop3 pop3s managesieve login_dir: /var/run/dovecot/login login_executable(default): /usr/libexec/dovecot/imap-login login_executable(imap): /usr/libexec/dovecot/imap-login login_executable(pop3): /usr/libexec/dovecot/pop3-login login_executable(managesieve): /usr/libexec/dovecot/managesieve-login max_mail_processes: 100 first_valid_uid: 150 last_valid_uid: 150 mail_location: maildir:/usr/local/virtual/%d/%n mail_executable(default): /usr/libexec/dovecot/imap mail_executable(imap): /usr/libexec/dovecot/imap mail_executable(pop3): /usr/libexec/dovecot/pop3 mail_executable(managesieve): /usr/libexec/dovecot/managesieve mail_plugin_dir(default): /usr/lib64/dovecot/imap mail_plugin_dir(imap): /usr/lib64/dovecot/imap mail_plugin_dir(pop3): /usr/lib64/dovecot/pop3 mail_plugin_dir(managesieve): /usr/lib64/dovecot/managesieve auth default: mechanisms: plain digest-md5 debug: yes debug_passwords: yes passdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf userdb: driver: sql args: /etc/dovecot/dovecot-mysql.conf plugin: sieve: /usr/local/virtual/%d/%n/.dovecot.sieve sieve_storage: /usr/local/virtual/%d/%n/sieve - -bash-3.2# grep -v '^ *\(#.*\)\?$' /etc/dovecot/dovecot-mysql.conf driver = mysql connect = host=/var/lib/mysql/mysql.sock dbname=postfix user=postfix password=postfix default_pass_scheme = MD5-CRYPT user_query = \ SELECT maildir as home, 150 AS uid, 12 AS gid FROM mailbox WHERE username = '%u' password_query = select password from mailbox where username='%u'