Instalacja dovecot

root@asl24:~# apt-get install  dovecot-common  dovecot-imapd dovecot-pop3d
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  ntp
The following NEW packages will be installed:
  dovecot-common dovecot-imapd dovecot-pop3d
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 7,763 kB of archives.
After this operation, 23.7 MB of additional disk space will be used.
Do you want to continue [Y/n]?
Get:1 http://ftp.man.poznan.pl/pub/linux/debian/debian/ squeeze/main dovecot-common amd64 1:1.2.15-7 [5,512 kB]
Get:2 http://ftp.man.poznan.pl/pub/linux/debian/debian/ squeeze/main dovecot-imapd amd64 1:1.2.15-7 [1,178 kB]
Get:3 http://ftp.man.poznan.pl/pub/linux/debian/debian/ squeeze/main dovecot-pop3d amd64 1:1.2.15-7 [1,073 kB]
Fetched 7,763 kB in 5s (1,357 kB/s)
Selecting previously deselected package dovecot-common.
(Reading database ... 23382 files and directories currently installed.)
Unpacking dovecot-common (from .../dovecot-common_1%3a1.2.15-7_amd64.deb) ...
Selecting previously deselected package dovecot-imapd.
Unpacking dovecot-imapd (from .../dovecot-imapd_1%3a1.2.15-7_amd64.deb) ...
Selecting previously deselected package dovecot-pop3d.
Unpacking dovecot-pop3d (from .../dovecot-pop3d_1%3a1.2.15-7_amd64.deb) ...
Processing triggers for man-db ...
Setting up dovecot-common (1:1.2.15-7) ...

Creating config file /etc/dovecot/dovecot.conf with new version

Creating config file /etc/dovecot/dovecot-ldap.conf with new version

Creating config file /etc/dovecot/dovecot-sql.conf with new version
Creating generic self-signed certificate: /etc/ssl/certs/dovecot.pem
This certificate will expire in 10 years.
(replace with hand-crafted or authorized one if needed).
Starting IMAP/POP3 mail server: dovecot.
Setting up dovecot-imapd (1:1.2.15-7) ...
Restarting IMAP/POP3 mail server: dovecotIf you have trouble with authentication failures,
enable auth_debug setting. See http://wiki.dovecot.org/WhyDoesItNotWork
This message goes away after the first successful login.
.
Setting up dovecot-pop3d (1:1.2.15-7) ...
Restarting IMAP/POP3 mail server: dovecotIf you have trouble with authentication failures,
enable auth_debug setting. See http://wiki.dovecot.org/WhyDoesItNotWork
This message goes away after the first successful login.
.
root@asl24:~#
Po zainstalowaniu dovecot nie będzie działał, gdyż nie posiada aktywnych protokołów oraz informacji o lokalizacji skrzynek użytkowników.
Naprawienie konfiguracji polega na poprawieniu dwóch parametrów w pliku konfiguracyjnym /etc/dovecot/dovecot.conf:
protocols = pop3 pop3s imap imaps
mail_location = mbox:~/mail:INBOX=/var/mail/%u
Ustawienie logowania przez dovecot:
log_path = /var/log/dovecot.log
info_log_path = /var/log/dovecot-info.log
Zakres logowania:
auth_verbose=yes		#wszystkie nieudane próby logowania
auth_debug=yes			#informacje o logowaniach, hasła ukryte
auth_debug_passwords=yes	#nie ukyrwa haseł
mail_debug=yes			#dużo informacji o działaniu dovecot
verbose_ssl=yes			#ostrzeżenia i błędy SSL
Procesy dovecot:
root@asl24:~# ps auxf|grep dovec
root     27275  0.0  0.3   7548   848 pts/1    S+   17:00   0:00      \_ grep dovec 
root     27261  0.0  0.3  39052   824 ?        Ss   16:59   0:00 /usr/sbin/dovecot -c /etc/dovecot/dovecot.conf
root     27263  0.0  1.2  74892  3240 ?        S    16:59   0:00  \_ dovecot-auth
root     27264  0.0  1.2  74892  3152 ?        S    16:59   0:00  \_ dovecot-auth -w
dovecot  27265  0.0  1.0  36904  2580 ?        S    16:59   0:00  \_ pop3-login
dovecot  27266  0.0  1.0  36904  2576 ?        S    16:59   0:00  \_ pop3-login
dovecot  27267  0.0  1.0  36904  2580 ?        S    16:59   0:00  \_ pop3-login
dovecot  27268  0.0  1.0  36916  2580 ?        S    16:59   0:00  \_ imap-login
dovecot  27269  0.0  1.0  36916  2576 ?        S    16:59   0:00  \_ imap-login
dovecot  27270  0.0  1.0  36916  2576 ?        S    16:59   0:00  \_ imap-login
root@asl24:~#
Testowanie czy działa:
root@asl24:~# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE STARTTLS AUTH=PLAIN] Dovecot ready.
A1 LOGIN asl24 qwerty
A1 OK [CAPABILITY IMAP4rev1 LITERAL+ SASL-IR LOGIN-REFERRALS ID ENABLE SORT SORT=DISPLAY THREAD=REFERENCES THREAD=REFS MULTIAPPEND UNSELECT IDLE CHILDREN NAMESPACE UIDPLUS LIST-EXTENDED I18NLEVEL=1 CONDSTORE QRESYNC ESEARCH ESORT SEARCHRES WITHIN CONTEXT=SEARCH LIST-STATUS] Logged in
A2 SELECT INBOX
* FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen \Draft \*)] Flags permitted.
* 1 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1336777566] UIDs valid
* OK [UIDNEXT 2] Predicted next UID
* OK [HIGHESTMODSEQ 1] Highest
A2 OK [READ-WRITE] Select completed.
A3 FETCH 1 BODY[HEADER]
* 1 FETCH (BODY[HEADER] {373}
Return-Path: 
X-Original-To: asl24
Delivered-To: asl24@kalkos.asl24.pl
Received: by asl24.pl (Postfix, from userid 0)
id D2F9D5EAA; Sat, 12 May 2012 01:06:19 +0200 (CEST)
To: asl24@kalkos.asl24.pl
Subject: test
Message-Id: <20120511230619.D2F9D5EAA@asl24.pl>
Date: Sat, 12 May 2012 01:06:19 +0200 (CEST)
From: root@kalkos.asl24.pl (root)

)
A3 OK Fetch completed.
A4 FETCH 1 BODY[TEXT]
* 1 FETCH (BODY[TEXT] {9}
test.

)
A4 OK Fetch completed.
A5 LOGOUT
* BYE Logging out
A5 OK Logout completed.
Connection closed by foreign host.
root@asl24:~#
root@asl24:~# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
+OK Dovecot ready.
user asl24
+OK
pass qwerty
+OK Logged in.
LIST
+OK 1 messages:
1 382
.
TOP 1
+OK
Return-Path: 
X-Original-To: asl24
Delivered-To: asl24@kalkos.asl24.pl
Received: by asl24.pl (Postfix, from userid 0)
        id D2F9D5EAA; Sat, 12 May 2012 01:06:19 +0200 (CEST)
To: asl24@kalkos.asl24.pl
Subject: test
Message-Id: <20120511230619.D2F9D5EAA@asl24.pl>
Date: Sat, 12 May 2012 01:06:19 +0200 (CEST)
From: root@kalkos.asl24.pl (root)

.
RETR 1
+OK 382 octets
Return-Path: 
X-Original-To: asl24
Delivered-To: asl24@kalkos.asl24.pl
Received: by asl24.pl (Postfix, from userid 0)
	id D2F9D5EAA; Sat, 12 May 2012 01:06:19 +0200 (CEST)
To: asl24@kalkos.asl24.pl
Subject: test
Message-Id: <20120511230619.D2F9D5EAA@asl24.pl>
Date: Sat, 12 May 2012 01:06:19 +0200 (CEST)
From: root@kalkos.asl24.pl (root)

test.

.
QUIT
+OK Logging out.
Connection closed by foreign host.
root@asl24:~#

Uwierzytelnianie

Udostępnienie uwierzytelniania sasl dla postfix poprzez Unix Socket:
auth default {
	(...)
	mechanisms = plain login
	(...)
	socket listen {
		client {
			path = /var/spool/postfix/private/auth
			mode = 0660
			user = postfix
			group = postfix
		}
	}
}