How to enable manage sieve plugin on Roundcube VestaCP
asumsikan kita sudah menginstall VestaCP dengan baik di Centos.
Konfig Sieve
Install paket dovecot-pigeonhole:
yum install dovecot-pigeonhole
tambahkan protokol:
# vim /etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp sieve
listen = *
base_dir = /var/run/dovecot/
!include conf.d/*.conf
tambahkan auth-master
ke dalam auth
(file 10-master.conf):
service auth {
unix_listener auth-client {
group = mail
mode = 0660
user = dovecot
}
unix_listener auth-master {
group = mail
mode = 0660
user = dovecot
}
user = dovecot
}
tambahkan konfig berikut diakhir baris konfigurasi 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 = ~/.dovecot.sieve
sieve_global_path = /etc/dovecot/sieve/default.sieve
sieve_dir = ~/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@sys.dgprasetya.com
hostname = sys.dgprasetya.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
}
set permission dan owner:
# touch /var/log/{dovecot-lda-errors.log,dovecot-lda.log}
# touch /var/log/{dovecot-sieve-errors.log,dovecot-sieve.log}
# touch /var/log/{dovecot-lmtp-errors.log,dovecot-lmtp.log}
# mkdir -p /etc/dovecot/sieve/global
# chown dovecot: -R /etc/dovecot/sieve
# chown mail:mail /var/log/dovecot-*
restart exim service exim restart
lalu cek apakah sieve sudah running netstat -tunlp | grep :4190
Konfig Exim
setting global spam filter:
# vim /etc/dovecot/sieve/default.sieve
require ["fileinto"];
# rule:[SPAM]
if header :contains "X-Spam-Flag" "YES" {
fileinto "Spam";
}
# rule:[SPAM2]
elsif header :matches "Subject" ["*money*","*Viagra*","Cialis"] {
fileinto "Spam";
}
enable managesieve
plugin:
# vim /etc/roundcubemail/main.inc.php
$rcmail_config['plugins'] = array('password','managesieve');
konfig managesieve plugin:
vim /usr/share/roundcubemail/plugins/managesieve/
$config['managesieve_port'] = 4190;
$config['managesieve_default'] = '/etc/dovecot/sieve/default.sieve';
Setting Exim Delivery
set local user delivery di bagian router config:
localuser:
driver = accept
#transport = local_delivery
transport = dovecot
#transport = dovecot_virtual_delivery
condition = ${lookup{$local_part}lsearch{/etc/exim/domains/$domain/passwd}{true}{false}}
set transpot dovecot di bagian Transpot:
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
restart exim service exim restart
. create filter via roundbox webmail: Settings > Filters
lihat log exim untuk detail:
2015-09-30 12:35:36 1ZhA3E-00058e-KT <= root@abc.def.co.id H=abc.def.co.id [1xx.2xx.xx7.1xx] P=esmtps X=UNKNOWN:AES256-GCM-SHA384:256 S=1482 id=E1ZhA3D-003cU6-Ms@abc.def.co.id
2015-09-30 12:35:36 1ZhA3E-00058e-KT => noc <abc@def.dgprasetya.com> R=localuser T=dovecot
tested on Centos 6.7 VestaCP 0.9.8.
Ref: