Для справкиSieve — язык описания правил фильтрации для почтовых сообщений. Создан компанией Cyrusoft International, Inc./ISAMET во время работы над Cyrus IMAP server.
Версии используемого программного обеспечения:
DirectAdmin: 1.40.3 CustomBuild 1.x Exim: 4.77 dovecot: 2.1.3 RoundCube webmail: 0.7.2 dovecot-2.1-pigeonhole-0.3.0
1. Настройка Dovecot
Идем на http://pigeonhole.dovecot.org/download.html и выбираем для своей версии Dovecot соответствующую версию pigeonhole. Pigeonhole is the name of the project that adds support for the Sieve language (RFC 5228) and the ManageSieve protocol (RFC 5804) to the Dovecot Secure IMAP Server. In the literal sense, a pigeonhole is a a hole or recess inside a dovecot for pigeons to nest in. It is, however, also the name for one of a series of small, open compartments in a cabinet used for filing or sorting mail. As a verb, it describes the act of putting an item into one of those pigeonholes. The name `Pigeonhole' therefore well describes an important part of the functionality that this project adds to Dovecot: sorting and filing e-mail messages. И так: cd /usr/local/src wget http://www.rename-it.nl/dovecot/2.1/dovecot-2.1-pigeonhole-0.3.0.tar.gz tar -zxvf dovecot-2.1-pigeonhole-0.3.0.tar.gz cd dovecot-2.1-pigeonhole-0.3.0 ./configure --prefix=/usr make && make install Переходим к конфигурации dovecot cd /etc/ cp ./dovecot.conf ./dovecot.conf-bak Открываем /etc/dovecot.conf для редактирования и добавляем service managesieve-login {
inet_listener sieve {
port = 4190
}
service_count = 1
process_min_avail = 1
vsz_limit = 64M
}
service managesieve {
process_limit = 10
}
protocol sieve {
managesieve_max_line_length = 65536
managesieve_implementation_string = dovecot
log_path = /var/log/dovecot-sieve-errors.log
info_log_path = /var/log/dovecot-sieve.log
}
plugin {
sieve = ~/.dovecot.sieve
sieve_global_path = /var/lib/dovecot/sieve/default.sieve
sieve_dir = ~/sieve
sieve_global_dir = /var/lib/dovecot/sieve/global/
}
protocol lda {
mail_plugins = $mail_plugins sieve
postmaster_address = postmaster@server.nsk21.ru
hostname = server.nsk21.ru
auth_socket_path = /var/run/dovecot/auth-master
log_path = /var/log/dovecot-lda-errors.log
info_log_path = /var/log/dovecot-lda.log
}
protocol lmtp {
mail_plugins = $mail_plugins sieve
log_path = /var/log/dovecot-lmtp-errors.log
info_log_path = /var/log/dovecot-lmtp.log
}
Находим строку
protocols = imap pop3
и добавляем в неее lmtp sieve
protocols = imap pop3 lmtp sieve
Затем секцию
service auth {
user = root
}
приводим к следующему виду
service auth {
user = root
unix_listener auth-master {
user = mail
group = mail
mode = 0664
}
}
Создаем файлы логов
# touch /var/log/dovecot-debug.log /var/log/dovecot-lda.log /var/log/dovecot-lmtp.log /var/log/dovecot-sieve.log /var/log/dovecot-lda-errors.log /var/log/dovecot-lmtp-errors.log /var/log/dovecot-sieve-errors.log
# chown mail:mail /var/log/dovecot-debug.log /var/log/dovecot-lda.log /var/log/dovecot-lmtp.log /var/log/dovecot-sieve.log /var/log/dovecot-lda-errors.log /var/log/dovecot-lmtp-errors.log /var/log/dovecot-sieve-errors.log
# chmod 660 /var/log/dovecot-debug.log /var/log/dovecot-lda.log /var/log/dovecot-lmtp.log /var/log/dovecot-sieve.log /var/log/dovecot-lda-errors.log /var/log/dovecot-lmtp-errors.log /var/log/dovecot-sieve-errors.log
Перезапускаем Dovecot и проверяем:
# ps aux | grep -v grep | grep managesieve-login
dovecot 20372 0.0 0.1 44608 2988 ? S 16:53 0:00 dovecot/managesieve-login
и
# netstat -an | grep LISTEN | grep :4190
tcp 0 0 0.0.0.0:4190 0.0.0.0:* LISTEN
2. Настройка Roundcube
cd /var/www/html/roundcube/plugins/managesieve
cp config.inc.php.dist config.inc.php
Открываем /var/www/html/roundcube/plugins/managesieve/config.inc.php
// managesieve server port
$rcmail_config['managesieve_port'] = 2000;
меняем на
// managesieve server port
$rcmail_config['managesieve_port'] = 4190;
Дальше открываем /var/www/html/roundcube/config/main.inc.php
Находим строку
$rcmail_config['plugins'] = array('password');
И меняем ее на
$rcmail_config['plugins'] = array('password','managesieve');
Заходим в интерфейс Roundcube http://domain.com/roundcube/ -> Настройки -> Фильтры -> Добавить фильр
Если при этом не возникло никаких ошибок, значит все настроено по части Roundcube хорошо. Создадим простое правило, по которому потом будем проверят работу фильтров: 
3. Настройка Exim
cd /etc
cp exim.conf exim.conf-bak
Открываем /etc/exim.conf для редактирования, находим строки
address_reply:
driver = autoreply
и сразу после них добавляем
dovecot_virtual_delivery:
driver = pipe
command = /usr/libexec/dovecot/deliver -d $local_part@$domain -f $sender_address -a $original_local_part@$original_domain
message_prefix =
message_suffix =
delivery_date_add
envelope_to_add
return_path_add
log_output
user = "${lookup{$domain}lsearch* {/etc/virtual/domainowners}{$value}}"
group = mail
temp_errors = 64 : 69 : 70: 71 : 72 : 73 : 74 : 75 : 78
Находим строку
transport = virtual_localdelivery
и меняем на
#transport = virtual_localdelivery
transport = dovecot_virtual_delivery
И перезапускаем Exim и проверяем!
# cat /var/log/dovecot-lda.log
Apr 08 17:45:55 lda(po4ta@domain.ru): Info: sieve: msgid=<66523BD3B58443CC93FAEED102FCE7E2@VDS54.RU>: stored mail into mailbox 'INBOX.@vds54-ru'
На этом все!
Ссылки на справочные материалы:Dovecot LDA with Exim Настройка почтового сервера Dovecot Pigeonhole Installation Roundcube ManageSieve Readme Sieve Support for Dovecot
|