Установка и настройка Sieve на CentOS7 с панелью управления VESTA
yum install dovecot-pigeonhole
Редактируем 20-managesieve.conf
nano /etc/dovecot/conf.d/20-managesieve.conf
раскомментируем протокол
protocols = $protocols sieve
Редактируем 10-master.conf
nano /etc/dovecot/conf.d/10-master.conf
добавляем auth-master unix-listener to service auth
service auth {
unix_listener
auth-client {
group = mail
mode = 0660
user = dovecot
}
unix_listener auth-master {
group = mail
mode = 0660
user = dovecot
}
user = dovecot
}
Добавляем в конец файла 10-master.conf
service managesieve-login {
inet_listener sieve {
port = 4190
}
}
service managesieve {
}
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 = ~/mail/%d/%n/dovecot.sieve
sieve_global_path = /etc/dovecot/sieve/default.sieve
sieve_dir = ~/mail/%d/%n/sieve
sieve_global_dir = /etc/dovecot/sieve/global/
}
lda_mailbox_autocreate = yes
lda_mailbox_autosubscribe = yes
protocol lda {
mail_plugins = $mail_plugins autocreate sieve quota
postmaster_address = postmaster@testdomain.com
hostname = srv.testdomain.com
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 autocreate sieve quota
log_path = /var/log/dovecot-lmtp-errors.log
info_log_path = /var/log/dovecot-lmtp.log
}
Редактируем 90-sieve.conf
nano /etc/dovecot/conf.d/90-sieve.conf
plugin {
# The path to the user's main active script. If ManageSieve is used, this the
# location of the symbolic link controlled by ManageSieve.
#sieve = ~/.dovecot.sieve sieve = ~/mail/%d/%n/dovecot.sieve
# The default Sieve script when the user has none. This is a path to a global
# sieve script file, which gets executed ONLY if user's private Sieve script
# doesn't exist. Be sure to pre-compile this script manually using the sievec
# command line tool.
# --> See sieve_before fore executing scripts before the user's personal
# script.
#sieve_default = /var/lib/dovecot/sieve/default.sieve
# Directory for :personal include scripts for the include extension. This
# is also where the ManageSieve service stores the user's scripts.
#sieve_dir = ~/sieve
sieve_dir = ~/mail/%d/%n/sieve
Создаем файл логов и назначаем им права
touch /var/log/dovecot-lda-errors.log
chmod 660 /var/log/dovecot-lda-errors.log
chown dovecot.mail /var/log/dovecot-lda-errors.log
touch /var/log/dovecot-lda.log
chmod 660 /var/log/dovecot-lda.log
chown dovecot.mail /var/log/dovecot-lda.log
touch /var/log/dovecot-lmtp-errors.log
chmod 660 /var/log/dovecot-lmtp-errors.log
chown dovecot.mail /var/log/dovecot-lmtp-errors.log
touch /var/log/dovecot-lmtp.log
chmod 660 /var/log/dovecot-lmtp.log
chown dovecot.mail /var/log/dovecot-lmtp.log
Создаем правило по умолчанию для sieve
mkdir /etc/dovecot/sieve
nano /etc/dovecot/sieve/default.sieve
require ["fileinto"];
# rule:[SPAM]
if header :contains "X-Spam-Flag" "YES"
{
fileinto "Spam";
}
touch /etc/dovecot/sieve/default.sieve
chmod +w /etc/dovecot/sieve/default.sieve
chown dovecot.mail /etc/dovecot/sieve/default.sieve
Перезапускаем dovecot
service dovecot restart
Редактируем конфиг rouncube
nano /etc/roundcubemail/config.inc.php
$config['plugins'] = array(
'archive',
'zipdownload',
'password',
'managesieve',
);
// default contents of filters script (eg. default spam filter)
$config['managesieve_default'] = '/etc/dovecot/sieve/default.sieve';
Редактируем конфиг exim
nano /etc/exim/exim.conf
localuser:
driver = accept
#transport = local_delivery
transport = dovecot
condition = ${lookup{$local_part}lsearch{/etc/exim/domains/$domain/passwd}{true}{false}}
######################################################################
# TRANSPORTS CONFIGURATION #
################################################################
begin transports
dovecot:
driver = pipe
command = /usr/libexec/dovecot/dovecot-lda -e -d $local_part@$domain -f $sender_address -a $original_local_part@$original_domain
return_path_add
log_output = true
delivery_date_add
envelope_to_add
user = ${extract{2}{:}{${lookup{$local_part}lsearch{/etc/exim/domains/$domain/passwd}}}}
group = mail
return_output
Перезапускаем exim
service exim restart
Теги: dovecot, Sieve, VestaCP, фильтр