• Uncategorized

dovecot-1.2.13

Dovecot is an open source IMAP and POP3 email server for Linux/UNIX-like systems, written with security primarily in mind. Dovecot is an excellent choice for both small and large installations. It’s fast, simple to set up, requires no special administration and it uses very little memory.

Source: http://dovecot.org/

Below you can find transcript of configuration and compilation session of Dovecot server and a script which I use for this purpose (as attachement).

root@feniks:~# su - soft
soft@feniks:~% cd dovecot
soft@feniks:~/dovecot% wget http://dovecot.org/releases/1.2/dovecot-1.2.13.tar.gz
soft@feniks:~/dovecot% gtar -zxf dovecot-1.2.13.tar.gz
soft@feniks:~/dovecot% cp drf_dovecot-1.2.6_conf drf_dovecot-1.2.13_conf
soft@feniks:~/dovecot% vi !$

In this configuration file I set up additional paths to OpenLDAP and SSL libraries and optimalization options (for SunStudio).

CFLAGS="-xO3 -xautopar"
CXXFLAGS=$CFLAGS
CPPFLAGS="-I/usr/local/ssl/include -I/usr/local/openldap/include -I/usr/local/include"
LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/openldap/lib -R/usr/local/openldap/lib -L/usr/local/lib -R/usr/local/lib"

Configuration with use of my script:

soft@feniks:~/dovecot% ./drf_dovecot-1.2.13_conf 
cc: Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
usage: cc [ options] files.  Use 'cc -flags' for details
PATH=/usr/local/bin:/usr/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb
CFLAGS=-xO3 -xautopar
CPPFLAGS=-I/usr/local/ssl/include -I/usr/local/openldap/include -I/usr/local/include
CXXFLAGS=-xO3 -xautopar
LDFLAGS=-L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/openldap/lib -R/usr/local/openldap/lib -L/usr/local/lib -R/usr/local/lib
=============================================
dmake clean [y|n] ?
n
=============================================
configure [y|n] ?
y
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/mkdir -p
checking for gawk... gawk
...

This is important when you will use LDAP for authentication:

checking for ldap_init in -lldap... yes
checking ldap.h usability... yes
checking ldap.h presence... yes
checking for ldap.h... yes
checking for ldap_initialize in -lldap... yes
checking for ldap_start_tls_s in -lldap... yes
checking for ber_free in -lldap... no
checking for ber_free in -llber... yes
...

Configuration summary:

Install prefix . : /usr/local/dovecot-1.2.13
File offsets ... : 64bit
I/O polling .... : poll
I/O notifys .... : none
SSL ............ : yes (OpenSSL)
GSSAPI ......... : no
passdbs ........ : passwd passwd-file shadow pam checkpassword ldap
                 : -bsdauth -sia -sql -vpopmail
userdbs ........ : static prefetch passwd passwd-file checkpassword ldap
                 : -sql -vpopmail -nss
SQL drivers .... :
                 : -pgsql -mysql -sqlite

Compilation time:

=============================================
dmake [y|n] ?
ydmake  all-recursive
Making all in src
Making all in lib
dmake  all-am
source='array.c' object='array.o' libtool=no \
DEPDIR=.deps depmode=none /bin/bash ../../depcomp \
cc -DHAVE_CONFIG_H -I. -I../..    -I/usr/local/ssl/include -I/usr/local/openldap/include -I/usr/local/include  -xO3 -xautopar -I/usr/local/openssl-0.9.8o/include -c array.c
...
Making all in doc
Making all in wiki
cat dovecot-config.in | sed \
-e "s|^moduledir=|moduledir=/usr/local/dovecot-1.2.13/lib/dovecot|" \
-e "s|^dovecot_incdir=|dovecot_incdir=/usr/local/dovecot-1.2.13/include/dovecot|" > dovecot-config
Compillation successful
=============================================
dmake test || dmake check [y|n] ?
y
dmake: Fatal error: Don't know how to make target `test'
Making check in src
Making check in lib
dmake  check-am
...

Certain software has set of tests which are called by make test command. Dovecot does not have those tests, so error message is shown and make check is called. The compillation is successful, so you can switch to root and run make install command:

soft@feniks:~/dovecot% exit
root@feniks:~# cd /home/soft/dovecot/dovecot-1.2.13 
root@feniks:/home/soft/dovecot/dovecot-1.2.13# dmake -m serial install
...
test -z "/usr/local/dovecot-1.2.13/lib/dovecot" || /usr/local/bin/mkdir -p "/usr/local/dovecot-1.2.13/lib/dovecot"
test -z "/data/etc/dovecot" || /usr/local/bin/mkdir -p "/data/etc/dovecot"
 /usr/local/bin/ginstall -c -m 644 dovecot-example.conf '/data/etc/dovecot'
test -z "/usr/local/dovecot-1.2.13/include/dovecot" || /usr/local/bin/mkdir -p "/usr/local/dovecot-1.2.13/include/dovecot"

As you see above I do not care about running service, because I install Dovecot to different directory. When I want to switch to new version then I will stop service, change symbolic link in /usr/local, to new Dovecot and run service. Before upgrade always worth is to read Release Notes, especially when major number of version is changed. If you have possibilities it is worth to test new version on developement server before you run it on production.

dovecot-1.2.13

Dovecot jest Open Sourceowym serwerem IMAP i POP3 dla systemów Linux/UNIX, napisanym z naciskiem na bezpieczeństwo. Dovecot jest doskonałym wyborem zarówno dla małych jak i wielkich instalacji. Jest szybki, łatwy do ustawienia, nie wymaga specjalnej administracji i używa niewiele pamięci.

Źródło: http://dovecot.org/

Poniżej znajdziecie zapis sesji konfiguracji i kompilacji serwera dovecot oraz skrypt, którego użyłem do kompilacji.

root@feniks:~# su - soft
soft@feniks:~% cd dovecot
soft@feniks:~/dovecot% wget http://dovecot.org/releases/1.2/dovecot-1.2.13.tar.gz
soft@feniks:~/dovecot% gtar -zxf dovecot-1.2.13.tar.gz
soft@feniks:~/dovecot% cp drf_dovecot-1.2.6_conf drf_dovecot-1.2.13_conf
soft@feniks:~/dovecot% vi !$

W pliku konfiguracyjnym ustawione są dodatkowe ścieżki do bibliotek OpenLDAP i SSL oraz opcje optymalizacji (dla SunStudio)

CFLAGS="-xO3 -xautopar"
CXXFLAGS=$CFLAGS
CPPFLAGS="-I/usr/local/ssl/include -I/usr/local/openldap/include -I/usr/local/include"
LDFLAGS="-L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/openldap/lib -R/usr/local/openldap/lib -L/usr/local/lib -R/usr/local/lib"

Konfiguracja z wykorzystaniem skryptu:

soft@feniks:~/dovecot% ./drf_dovecot-1.2.13_conf 
cc: Sun C 5.9 SunOS_sparc Patch 124867-01 2007/07/12
usage: cc [ options] files.  Use 'cc -flags' for details
PATH=/usr/local/bin:/usr/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb
CFLAGS=-xO3 -xautopar
CPPFLAGS=-I/usr/local/ssl/include -I/usr/local/openldap/include -I/usr/local/include
CXXFLAGS=-xO3 -xautopar
LDFLAGS=-L/usr/local/ssl/lib -R/usr/local/ssl/lib -L/usr/local/openldap/lib -R/usr/local/openldap/lib -L/usr/local/lib -R/usr/local/lib
=============================================
dmake clean [y|n] ?
n
=============================================
configure [y|n] ?
y
checking for a BSD-compatible install... /usr/local/bin/ginstall -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/mkdir -p
checking for gawk... gawk
...

To jest ważne, jeśli chcemy używać LDAPa do uwierzytelniania:

checking for ldap_init in -lldap... yes
checking ldap.h usability... yes
checking ldap.h presence... yes
checking for ldap.h... yes
checking for ldap_initialize in -lldap... yes
checking for ldap_start_tls_s in -lldap... yes
checking for ber_free in -lldap... no
checking for ber_free in -llber... yes
...

Podsumowanie konfiguracji:

Install prefix . : /usr/local/dovecot-1.2.13
File offsets ... : 64bit
I/O polling .... : poll
I/O notifys .... : none
SSL ............ : yes (OpenSSL)
GSSAPI ......... : no
passdbs ........ : passwd passwd-file shadow pam checkpassword ldap
                 : -bsdauth -sia -sql -vpopmail
userdbs ........ : static prefetch passwd passwd-file checkpassword ldap
                 : -sql -vpopmail -nss
SQL drivers .... :
                 : -pgsql -mysql -sqlite

Czas na kompilację:

=============================================
dmake [y|n] ?
y
dmake  all-recursive
Making all in src
Making all in lib
dmake  all-am
source='array.c' object='array.o' libtool=no \
DEPDIR=.deps depmode=none /bin/bash ../../depcomp \
cc -DHAVE_CONFIG_H -I. -I../..    -I/usr/local/ssl/include -I/usr/local/openldap/include -I/usr/local/include  -xO3 -xautopar -I/usr/local/openssl-0.9.8o/include -c array.c
...
Making all in doc
Making all in wiki
cat dovecot-config.in | sed \
-e "s|^moduledir=|moduledir=/usr/local/dovecot-1.2.13/lib/dovecot|" \
-e "s|^dovecot_incdir=|dovecot_incdir=/usr/local/dovecot-1.2.13/include/dovecot|" > dovecot-config
Compillation successful
=============================================
dmake test || dmake check [y|n] ?
y
dmake: Fatal error: Don't know how to make target `test'
Making check in src
Making check in lib
dmake  check-am
...

Niektóre programy posiadają zestaw testów wywoływany poleceniem make test, Dovecot nie posiada, stąd komunikat o błędzie i wykonanie make check. Kompilacja zakończyła się pomyślnie, można więc przejść do instalacji:

soft@feniks:~/dovecot% exit
root@feniks:~# cd /home/soft/dovecot/dovecot-1.2.13 
root@feniks:/home/soft/dovecot/dovecot-1.2.13# dmake -m serial install
...
test -z "/usr/local/dovecot-1.2.13/lib/dovecot" || /usr/local/bin/mkdir -p "/usr/local/dovecot-1.2.13/lib/dovecot"
test -z "/data/etc/dovecot" || /usr/local/bin/mkdir -p "/data/etc/dovecot"
 /usr/local/bin/ginstall -c -m 644 dovecot-example.conf '/data/etc/dovecot'
test -z "/usr/local/dovecot-1.2.13/include/dovecot" || /usr/local/bin/mkdir -p "/usr/local/dovecot-1.2.13/include/dovecot"

Jak widać nie muszę się przejmować tym, że obecnie działająca wersja zostanie nadpisana, gdyż instaluję Dovecota do osobnego katalogu. Jak będę chciał użyć nowej wersji to zatrzymam usługę, zmienię link symboliczny /usr/local/dovecot aby wskazywał na nowego Dovecota i uruchomię usługę. Przed upgradem wersji zawsze warto spojrzeć do dokumentacji (tudzież Release Notes) czy nie trzeba wykonać jakichś specjalnych działań, szczególnie jeśli zmienia się główny numer wersji. Jeśli jest możliwość, to warto przetestować działanie nowej wersji na serwerze developerskim zanim uruchomi się na produkcyjnym.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.