Vesta Control Panel - Forum

Community Forum

Skip to content

Advanced search
  • Quick links
    • Main site
    • Github repo
    • Google Search
  • FAQ
  • Login
  • Register
  • Board index Main Section Mail Server
  • Search

Sieve support enabled!

Questions regarding the Mail Server
Dovecot, Exim, RoundCube
Post Reply
  • Print view
Advanced search
5 posts • Page 1 of 1
GuzziGuy
Posts: 14
Joined: Thu Oct 30, 2014 6:27 pm

Sieve support enabled!
  • Quote

Post by GuzziGuy » Fri Oct 31, 2014 3:30 pm

I found a couple of queries here about sieve, but none answered. After playing around (quite) a bit with it, I think I have it resolved. This is in Ubuntu 14.04 so things may be slightly different on other OS. I'm showing just the lines that need changing in the configs.

Step 1 - install packages

Code: Select all

apt-get install dovecot-sieve dovecot-manageseived dovecot-lmtpd
I was missing the last one, which had me scratching my head for a bit.

Step 2 - initial dovecot settings

Most of the default configs (extra confs are added when installing packages) will be correct, just a couple to change:

Code: Select all

/etc/dovecot/dovecot.conf

#protocols = imap pop3
protocols = imap pop3 lmtp sieve

Code: Select all

/etc/dovecot/conf.d/20-lmtp.conf

#mail_plugins = $mail_plugins
mail_plugins = sieve
Step 3 - sieve scripts directory

By default, dovecot stores scripts in the user's home directory. But this doesn't work on Vesta because we are using virtual mail users; one CP user account (ie system user) holds all the mail accounts for their domains. We need a different setup; change your paths as required, but I put them in my admin user home directory:

Code: Select all

mkdir /home/admin/sieve
chown admin:mail /home/admin/sieve
chmod 770 /home/admin/sieve
Permissions are important! Then, we configure dovecot to save all scripts in here, in domain/user structure:

Code: Select all

/etc/dovecot/conf.d/90-sieve.conf

#sieve = ~/.dovecot.sieve
sieve = /home/admin/sieve/%d/%n/dovecot.sieve
#sieve_dir = ~/sieve
sieve_dir = /home/admin/sieve/%d/%n/scripts
Step 4 - exim

As others have discovered, this doesn't work yet, because dovecot doesn't know when mail is delivered, and therefore to sieve it. We change exim to deliver mail to dovecot.

Code: Select all

/etc/exim4/exim4.conf.template
look for 'ROUTERS CONFIGURATION section', then 'localuser:'

#transport = local_delivery
transport = dovecot_lmtp 

Code: Select all

/etc/exim4/exim4.conf.template
look for 'TRANSPORTS CONFIGURATION section', then add a new transport

dovecot_lmtp:
    driver = lmtp
    socket = /var/run/dovecot/lmtp
    #maximum number of deliveries per batch, default 1
    batch_max = 200
Step 5 - restart

Code: Select all

service dovecot restart
service exim4 restart
That should do it. You should then be able to use the sieve plugin in RC - or I've installed Horde, which also has a sieve plugin. Both seem to work as expected.

I'm no expert so feel free to take issue with any of the above! I'm particularly unsure about the exim4 config setup - is it save to change exim4.conf.template? Or does it get rebuilt with some changes of Vesta?

If anything changes I'll try to change the top post here so it serves as a guide.
Top

Steven
Posts: 15
Joined: Mon Oct 20, 2014 7:53 pm

Re: Sieve support enabled!
  • Quote

Post by Steven » Mon Nov 10, 2014 4:45 am

This is excellent and I followed this guide to successfully implement sieve support. However..

I noticed some errors in the logs like this;

dovecot_lmtp defer (-46): LMTP error after end of data

And I also noticed that there may be an issue with localdomain emails not getting through (try sending from one domain to another on the same box, and reply + reply) - the 2nd reply back doesn't make it home. Could be just me, but would be good for others to try this out as my mail config is pretty much on par with stock standard vestacp.

Regards Steven
Top

GuzziGuy
Posts: 14
Joined: Thu Oct 30, 2014 6:27 pm

Re: Sieve support enabled!
  • Quote

Post by GuzziGuy » Tue Nov 11, 2014 10:46 am

Glad this was helpful!
Steven wrote:dovecot_lmtp defer (-46): LMTP error after end of data
Hmm - I'm not seeing this in either my /var/log/mail.log or /var/log/exim4 - where did you see it? Is it actually causing any problems?
Steven wrote:And I also noticed that there may be an issue with localdomain emails not getting through (try sending from one domain to another on the same box, and reply + reply) - the 2nd reply back doesn't make it home.
You may be having the same issue I did, whereby exim4 requires auth to relay mail between local domains. See viewtopic.php?f=12&t=6183 - does that apply?
Top

mxroute
Posts: 16
Joined: Fri Jan 09, 2015 6:52 pm

Re: Sieve support enabled!
  • Quote

Post by mxroute » Fri Jan 09, 2015 6:56 pm

This was excellent work. If I may make one suggestion, you can make this work for more than just the admin user by changing the settings in 90-sieve.conf to this:

Code: Select all

sieve = ~/sieve/%d/%n/dovecot.sieve
sieve_dir = ~/sieve/%d/%n/scripts
That way it picks the home directory of the user running the dovecot process, which is the unix user that owns the domain authenticated on.
Top

tkramer
Posts: 7
Joined: Thu Feb 15, 2018 12:28 pm

Os: Debian 8x
Web: apache + nginx
Re: Sieve support enabled!
  • Quote

Post by tkramer » Fri Feb 16, 2018 4:31 am

Works perfectly on debian 9!

I followed the tip of @mxroute, but all worked ok on the main example!

Thanks!
Top


Post Reply
  • Print view

5 posts • Page 1 of 1

Return to “Mail Server”



  • Board index
  • All times are UTC
  • Delete all board cookies
  • The team
Powered by phpBB® Forum Software © phpBB Limited
*Original Author: Brad Veryard
*Updated to 3.2 by MannixMD
 

 

Login  •  Register

I forgot my password