Re: Dovecot impatient with mysql?

2017-04-06 Thread George Kontostanos
On Thu, Apr 6, 2017 at 7:10 PM, Robert Moskowitz <r...@htt-consult.com> wrote:
> It seems dovecot is impatient with connecting with mysql, as I see in
> maillog entries like:
>
> Apr  6 11:48:30 z9m9z dovecot: dict: Error: mysql(localhost): Connect failed
> to database (postfix): Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (13) - waiting for 5 seconds before retry
> Apr  6 11:48:35 z9m9z dovecot: dict: Error: mysql(localhost): Connect failed
> to database (postfix): Can't connect to local MySQL server through socket
> '/var/lib/mysql/mysql.sock' (13) - waiting for 25 seconds before retry
>
> I suspect it does connect eventually.  This is a test system with only 1GB
> of memory and free reports:
>
>   totalusedfree  shared buff/cache available
> Mem:1025484  696344   24556 21528  304584  251552
> Swap:524284   92168  432116
>
>
> The production box has 2GB, so if the problem is mysql is swapping out, that
> will be 'fixed', if it is processor, well this is an ARMv7 duo core, as is
> the production box.  I am considering buying the new quad core.
>
> Is there anything I can do to get dovecot more patient with mysql, or just
> ignore there messages?
>
> thank you

I really don't understand how you reached to the conclusion that
dovecot is impatient.

-- 
George Kontostanos
---


Exclude namespace from replication

2017-03-01 Thread George Kontostanos
Hello list,

I am using replication with dsync and I am facing some issues with
shared folders. More particularly expunged message reappearing. I have
searched a bit and it was suggested that shared folders should not be
synced.

My namespace looks like that:

namespace {
  inbox = no
  list = children
  location = 
maildir:/usr/local/vhosts/mail/%%d/%%n:LAYOUT=fs:INDEX=/usr/local/vhosts/indexes/%d/%n/shared/%%u:INDEXPVT=/usr/local/vhosts/indexes/%d/%n/shared/%%u
  prefix = shared/%%d/%%n/
  separator = /
  subscriptions = no
  type = shared
}

I was wondering if defining:

replication_dsync_parameters = -d -N -l 30 -U -x shared

Is enough. Or do I need to change the syntax of the namespace like that:

namespace shared {


type = shared
}

Thanks for your help


Re: Expunged message reappeared, giving a new UID

2017-03-01 Thread George Kontostanos
On Wed, Mar 1, 2017 at 3:40 PM, Γιώργος Δημακόπουλος
 wrote:
> Dovecot 2.2.27
>
> dsync-server(account_name): Warning: Maildir
> /usr/local/vhosts/mail/***/info/Sent: Expunged message reappeared,
> giving a new UID (old uid=29787, file=***)
>
> What triggers this replication for ever ??
>
> Thank you
> George

Please find also the doveconf -n

# 2.2.27 (c0f36b0): /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: FreeBSD 11.0-RELEASE-p8 amd64  zfs
auth_mechanisms = plain login
auth_verbose = yes
default_client_limit = 2560
default_process_limit = 512
default_vsz_limit = 1 G
dict {
  acl = mysql:/usr/local/etc/dovecot/dovecot-shared-sql.conf.ext
  quota = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
}
doveadm_password =  # hidden, use -P to show it
doveadm_port = 12345
log_path = /var/log/dovecot.log
mail_home = /usr/local/vhosts/mail/%d/%n
mail_location = maildir:/usr/local/vhosts/mail/%d/%n:LAYOUT=fs
mail_max_userip_connections = 70
mail_plugins = quota acl notify replication
mail_privileged_group = vmail
mail_shared_explicit_inbox = yes
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope
encoded-character vacation subaddress comparator-i;ascii-numeric
relational regex imap4flags copy include variables body enotify
environment mailbox date index ihave duplicate mime foreverypart
extracttext
mbox_write_locks = fcntl
namespace {
  inbox = no
  list = children
  location = 
maildir:/usr/local/vhosts/mail/%%d/%%n:LAYOUT=fs:INDEX=/usr/local/vhosts/indexes/%d/%n/shared/%%u:INDEXPVT=/usr/local/vhosts/indexes/%d/%n/shared/%%u
  prefix = shared/%%d/%%n/
  separator = /
  subscriptions = no
  type = shared
}
namespace inbox {
  inbox = yes
  list = yes
  location =
  mailbox Drafts {
auto = subscribe
special_use = \Drafts
  }
  mailbox Junk {
auto = subscribe
special_use = \Junk
  }
  mailbox Sent {
auto = subscribe
special_use = \Sent
  }
  mailbox Trash {
auto = subscribe
special_use = \Trash
  }
  prefix =
  separator = /
  type = private
}
passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  acl = vfile
  acl_shared_dict = proxy::acl
  mail_replica = tcp:mx
  quota = dict:User quota::proxy::quota
  quota_rule2 = Trash:storage=+100M
  sieve = /usr/local/vhosts/mail/%d/%n/.dovecot.sieve
  sieve_before = /usr/local/vhosts/sieve/before.d/
  sieve_dir = /usr/local/vhosts/mail/%d/%n
  sieve_global_dir = /usr/local/vhosts/sieve/%d
  sieve_global_path = /usr/local/vhosts/sieve/%d/default.sieve
}
protocols = imap lmtp sieve sieve
service aggregator {
  fifo_listener replication-notify-fifo {
mode = 0666
user = vmail
  }
  unix_listener replication-notify {
mode = 0666
user = vmail
  }
}
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
  }
  unix_listener auth-userdb {
mode = 0600
user = vmail
  }
  user = dovecot
}
service config {
  unix_listener config {
user = vmail
  }
}
service dict {
  unix_listener dict {
mode = 0600
user = vmail
  }
}
service doveadm {
  inet_listener {
port = 12345
  }
  user = vmail
}
service imap-login {
  inet_listener imap {
port = 143
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
  }
}
service managesieve-login {
  inet_listener sieve {
port = 4190
  }
  process_min_avail = 0
  service_count = 1
  vsz_limit = 64 M
}
service replicator {
  unix_listener replicator-doveadm {
mode = 0666
  }
}
ssl_cert = 

Re: Replacement for antispam plugin

2017-02-12 Thread George Kontostanos
On Sun, Feb 12, 2017 at 8:56 PM, Stephan Bosch <step...@rename-it.nl> wrote:
> Op 2/12/2017 om 5:36 PM schreef George Kontostanos:
>> On Sun, Feb 12, 2017 at 3:52 PM, Aki Tuomi <aki.tu...@dovecot.fi> wrote:
>>
>>>> On February 10, 2017 at 10:06 AM Aki Tuomi <aki.tu...@dovecot.fi> wrote:
>>>>
>>>>
>>>> Hi!
>>>> Since antispam plugin is deprecated and we would really prefer people
>>>> not to use it, we wrote instructions on how to replace it with
>>>> IMAPSieve. Comments and suggestions are most welcome.
>>>>
>>>> https://wiki.dovecot.org/HowTo/AntispamWithSieve
>>>>
>>>> ---
>>>> Aki Tuomi
>>>> Dovecot oy
>>> Hi everyone,
>>>
>>> thank you all for your feedback, questions and comments. We have upgraded
>>> the documentation based on this, including information how to exclude Trash
>>> folder in ham script.
>>>
>>> Aki
>>>
>>
>> Thank you all very much. I am now running into a very weird issue. Whenever
>> an Junk email is “seen” I get the following error:
>>
>> Debug: sieve: vnd.dovecot.execute extension: no bin or socket directory
>> specified; extension is unconfigured (both sieve_execute_bin_dir and
>> sieve_execute_socket_dir are not set)
>> Feb 12 18:02:54 imap(user@domain): Debug: imapsieve: Static mailbox rule
>> [1]: mailbox=`Junk' from=`*' causes=(COPY) =>
>> before=`file:/usr/local/lib/dovecot/sieve/report-spam.sieve' after=(none)
>> Feb 12 18:02:54 imap(user@dmain): Debug: imapsieve: Static mailbox rule
>> [2]: mailbox=`*' from=`Junk' causes=(COPY) =>
>> before=`file:/usr/local/lib/dovecot/sieve/report-ham.sieve' after=(none)
>
> That is not an error. That is merely a debug message indicating that the
> vnd.dovecot.execute extension is unconfigured.
>
> Don't enable that extension if you're not using the "execute"
> command/test. Yes, it is in the example, but it has no function either.
> Only the vnd.dovecot.pipe extension is actually used ("pipe" command).
>
>> Also it automatically creates a .spamassassin/ folder in the user:
>>
>> -rw---  1 vmail  vmail136 Feb 10 17:33 .dovecot.lda-dupes
>> lrwx--  1 vmail  vmail 17 Mar 13  2016 .dovecot.sieve@ ->
>> managesieve.sieve
>> -rw---  1 vmail  vmail322 Feb 11 03:02 .dovecot.svbin
>> drwx--  2 vmail  vmail512 Feb 12 18:04 .spamassassin/
>> drwx--  5 vmail  vmail512 Feb 10 17:32 Drafts/
>> drwx--  5 vmail  vmail512 Feb 12 18:09 Junk/
>> drwx--  5 vmail  vmail512 Feb 11 17:36 Saved/
>> drwx--  5 vmail  vmail512 Jan 16 11:55 Sent/
>> drwx--  5 vmail  vmail512 Feb 12 18:09 Trash/
>> drwx--  2 vmail  vmail   1024 Feb 12 18:07 cur/
>> -rw---  1 vmail  vmail 21 Mar 13  2016 dovecot-acl-list
>> -rw---  1 vmail  vmail 68 Oct 17 13:19 dovecot-keywords
>> -rw---  1 vmail  vmail245 Feb 12 18:07 dovecot-uidlist
>> -rw---  1 vmail  vmail  8 Jun  9  2016 dovecot-uidvalidity
>> -r--r--r--  1 vmail  vmail  0 Mar 12  2016 dovecot-uidvalidity.56e48129
>> -rw---  1 vmail  vmail640 Feb 11 22:24 dovecot.index
>> -rw---  1 vmail  vmail  27788 Feb 12 18:07 dovecot.index.cache
>> -rw---  1 vmail  vmail  25996 Feb 12 18:07 dovecot.index.log
>> -rw---  1 vmail  vmail192 Feb 12 16:04 dovecot.mailbox.log
>> -rw---  1 vmail  vmail181 Feb 10 17:34 managesieve.sieve
>> drwx--  2 vmail  vmail512 Feb 12 17:46 new/
>> -rw---  1 vmail  vmail 39 Jun  9  2016 subscriptions
>> drwx--  2 vmail  vmail512 Feb 12 18:04 tmp/
>>
>> Any ideas ? I am attaching my config.
>
> The likely scenario is that the sa-learn tool is creating a hidden
> directory inside the $HOME directory of the user for user-specific state
> information. According to your mail_home and mail_location
> configuration, that is the same directory as the INBOX mailbox. That is
> why this may be interpreted as a mailbox by the maildir format. It is
> generally a bad idea to have those equal; you should put the mail
> location in a sub-directory of the home directory to prevent problems
> like this.
>
> https://wiki.dovecot.org/VirtualUsers/Home
>
> Regards,
>
> Stephan.
>
>
>
That makes perfect sense. I might need to find a way to migrate now to
the correct structure.

Thanks


-- 
George Kontostanos
---


Re: Replacement for antispam plugin

2017-02-12 Thread George Kontostanos
On Sun, Feb 12, 2017 at 7:52 PM, Ralph Seichter <dovecot...@seichter.de> wrote:
> On 12.02.2017 17:36, George Kontostanos wrote:
>
>> it automatically creates a .spamassassin/ folder in the user
>
> That happens because sa-learn is invoked as the user who is logged into
> IMAP. If you want all users to contribute to a global SpamAssassin
> database (like I do), you'll need to create your own learning mechanism
> instead of calling sa-learn directly.
>
> -Ralph

Actually I think that sa-learn is invoked as user vmail. But of course
I might be wrong.

sa-learn-ham.sh

LOG='/var/log/sa-learn.log'
exec /usr/local/bin/sa-learn --ham -D >> $LOG 2>&1

I had to give ownership to vmail to sa-learn.log otherwise it would
refuse to run.

Do you have any suggestions as per the way sa-learn should be executed?

Thanks for your help.

-- 
George Kontostanos
---


Re: Replacement for antispam plugin

2017-02-12 Thread George Kontostanos
On Sun, Feb 12, 2017 at 3:52 PM, Aki Tuomi  wrote:

>
> > On February 10, 2017 at 10:06 AM Aki Tuomi  wrote:
> >
> >
> > Hi!
> > Since antispam plugin is deprecated and we would really prefer people
> > not to use it, we wrote instructions on how to replace it with
> > IMAPSieve. Comments and suggestions are most welcome.
> >
> > https://wiki.dovecot.org/HowTo/AntispamWithSieve
> >
> > ---
> > Aki Tuomi
> > Dovecot oy
>
> Hi everyone,
>
> thank you all for your feedback, questions and comments. We have upgraded
> the documentation based on this, including information how to exclude Trash
> folder in ham script.
>
> Aki
>


Thank you all very much. I am now running into a very weird issue. Whenever
an Junk email is “seen” I get the following error:

Debug: sieve: vnd.dovecot.execute extension: no bin or socket directory
specified; extension is unconfigured (both sieve_execute_bin_dir and
sieve_execute_socket_dir are not set)
Feb 12 18:02:54 imap(user@domain): Debug: imapsieve: Static mailbox rule
[1]: mailbox=`Junk' from=`*' causes=(COPY) =>
before=`file:/usr/local/lib/dovecot/sieve/report-spam.sieve' after=(none)
Feb 12 18:02:54 imap(user@dmain): Debug: imapsieve: Static mailbox rule
[2]: mailbox=`*' from=`Junk' causes=(COPY) =>
before=`file:/usr/local/lib/dovecot/sieve/report-ham.sieve' after=(none)

Also it automatically creates a .spamassassin/ folder in the user:

-rw---  1 vmail  vmail136 Feb 10 17:33 .dovecot.lda-dupes
lrwx--  1 vmail  vmail 17 Mar 13  2016 .dovecot.sieve@ ->
managesieve.sieve
-rw---  1 vmail  vmail322 Feb 11 03:02 .dovecot.svbin
drwx--  2 vmail  vmail512 Feb 12 18:04 .spamassassin/
drwx--  5 vmail  vmail512 Feb 10 17:32 Drafts/
drwx--  5 vmail  vmail512 Feb 12 18:09 Junk/
drwx--  5 vmail  vmail512 Feb 11 17:36 Saved/
drwx--  5 vmail  vmail512 Jan 16 11:55 Sent/
drwx--  5 vmail  vmail512 Feb 12 18:09 Trash/
drwx--  2 vmail  vmail   1024 Feb 12 18:07 cur/
-rw---  1 vmail  vmail 21 Mar 13  2016 dovecot-acl-list
-rw---  1 vmail  vmail 68 Oct 17 13:19 dovecot-keywords
-rw---  1 vmail  vmail245 Feb 12 18:07 dovecot-uidlist
-rw---  1 vmail  vmail  8 Jun  9  2016 dovecot-uidvalidity
-r--r--r--  1 vmail  vmail  0 Mar 12  2016 dovecot-uidvalidity.56e48129
-rw---  1 vmail  vmail640 Feb 11 22:24 dovecot.index
-rw---  1 vmail  vmail  27788 Feb 12 18:07 dovecot.index.cache
-rw---  1 vmail  vmail  25996 Feb 12 18:07 dovecot.index.log
-rw---  1 vmail  vmail192 Feb 12 16:04 dovecot.mailbox.log
-rw---  1 vmail  vmail181 Feb 10 17:34 managesieve.sieve
drwx--  2 vmail  vmail512 Feb 12 17:46 new/
-rw---  1 vmail  vmail 39 Jun  9  2016 subscriptions
drwx--  2 vmail  vmail512 Feb 12 18:04 tmp/

Any ideas ? I am attaching my config.

Thanks

# 2.2.27 (c0f36b0): /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
# OS: FreeBSD 10.3-RELEASE-p11 amd64  ufs
auth_mechanisms = plain login
auth_verbose = yes
default_client_limit = 2560
default_process_limit = 512
dict {
  acl = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
  quota = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
}
log_path = /var/log/dovecot.log
mail_home = /usr/local/vhosts/mail/%d/%n
mail_location = maildir:/usr/local/vhosts/mail/%d/%n:LAYOUT=fs
mail_max_userip_connections = 20
mail_plugins = quota acl
mail_privileged_group = vmail
mail_shared_explicit_inbox = yes
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
copy include variables body enotify environment mailbox date index ihave
duplicate mime foreverypart extracttext imapsieve
mbox_write_locks = fcntl
namespace {
  inbox = no
  list = children
  location =
maildir:/usr/local/vhosts/mail/%%d/%%n:LAYOUT=fs:INDEX=/usr/local/vhosts/indexes/%d/%n/shared/%%u:INDEXPVT=/usr/local/vhosts/indexes/%d/%n/shared/%%u
  prefix = shared/%%d/%%n/
  separator = /
  subscriptions = no
  type = shared
}
namespace inbox {
  inbox = yes
  list = yes
  location =
  mailbox Drafts {
auto = subscribe
special_use = \Drafts
  }
  mailbox Junk {
auto = subscribe
special_use = \Junk
  }
  mailbox Sent {
auto = subscribe
special_use = \Sent
  }
  mailbox Trash {
auto = subscribe
special_use = \Trash
  }
  prefix =
  separator = /
  type = private
}
passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  acl = vfile
  acl_shared_dict = proxy::acl
  imapsieve_mailbox1_before =
file:/usr/local/lib/dovecot/sieve/report-spam.sieve
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_name = Junk
  imapsieve_mailbox2_before =
file:/usr/local/lib/dovecot/sieve/report-ham.sieve
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_from = Junk
  imapsieve_mailbox2_name = *
  

Re: Replacement for antispam plugin

2017-02-10 Thread George Kontostanos
On Fri, Feb 10, 2017 at 9:59 PM, Ralph Seichter <dovecot...@seichter.de>
wrote:

> On 10.02.17 20:34, Michael Slusarz wrote:
>
> > When you move a message to a new mailbox, that is a "new message"
> > event (a new UID in the target mailbox is created; the message count
> > increases). So imap.mailbox is set to the name of the *target* mailbox.
>
> My tests seem to indicate otherwise. Deleting a message currently
> located in the Junk folder causes the report-ham.sieve script to be
> invoked, which in my case contains the following:
>
>   require ["vnd.dovecot.pipe", "copy", "environment"];
>   if environment "imap.mailbox" "Trash" {
> stop;
>   } elsif environment "imap.mailbox" "Junk" {
> pipe :copy "debug-junk";
>   } else {
> pipe :copy "learn-ham";
>   }
>
> I can see that "learn-ham" is always invoked when a message is deleted
> from or moved out of the Junk folder, so my guess is that imap.mailbox
> is neither "Trash" nor "Junk" ("debug-junk" is never called, according
> to the Dovecot logs). Unfortunately I don't know how to debug this
> further.
>
> I don't want "learn-ham" to be run when a message located in the Junk
> folder is manually deleted or moved to Trash, and right now I don't know
> how to accomplish this.
>
> -Ralph
>

Same problem here. As a workaround I tried the following:

# From Spam folder to Inbox
  imapsieve_mailbox2_name = Inbox
  imapsieve_mailbox2_from = Spam
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve

In theory this should trigger the  report-ham script, only if a mail is
moved from Spam to Inbox. However, it does not seem to work either.
-- 
George Kontostanos
---


Re: Replacement for antispam plugin

2017-02-10 Thread George Kontostanos
On Fri, Feb 10, 2017 at 6:25 PM, George Kontostanos <gkontos.m...@gmail.com>
wrote:

>
>
> On Fri, Feb 10, 2017 at 5:09 PM, Darac Marjal <mailingl...@darac.org.uk>
> wrote:
>
>> On Fri, Feb 10, 2017 at 03:52:52PM +0100, Ralph Seichter wrote:
>>
>>> On 10.02.2017 09:06, Aki Tuomi wrote:
>>>
>>> Since antispam plugin is deprecated and we would really prefer people
>>>> not to use it, we wrote instructions on how to replace it with
>>>> IMAPSieve.
>>>>
>>>
>>> In my setup, I use the following sieve script globally for all users:
>>>
>>>  if header :is "X-Spam-Flag" "YES" {
>>>fileinto "Junk";
>>>stop;
>>>  }
>>>
>>> This allows processing based on spam flags set by Amavis/SpamAssassin.
>>> I wonder if the method shown in
>>>
>>>  https://wiki.dovecot.org/HowTo/AntispamWithSieve
>>>
>>> will cause incoming mail (via LMTP) that is already flagged as spam to
>>> be processed by report-spam.sieve and, in consequence, will be learned
>>> as spam for a second time, which would of course be undesirable?
>>>
>>
>> It shouldn't do. Check out https://wiki.dovecot.org/Pigeo
>> nhole/Sieve/Plugins/IMAPSieve, which explains that sieve is normally
>> only used at delivery time, but the sieve_imapsieve plugin runs a
>> *different* sieve script based on IMAP actions (for example, COPY).
>>
>> So, when you deliver, your main script tells dovecot WHERE to deliver to.
>> When you issue and IMAP COPY command, the Antispam scripts tell dovecot to
>> pipe the message to spamassassin. The delivery does not involve IMAP and
>> the IMAP COPY does not constitute redelivery.
>>
>>
>> --
>> For more information, please reread.
>>
>
> I think that this needs some change:
>
>  # From Spam folder to elsewhere
>   imapsieve_mailbox2_name = *
>   imapsieve_mailbox2_from = Spam
>   imapsieve_mailbox2_causes = COPY
>   imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve
>
> When a message from Spam is moved to Trash then the report-ham.sieve is
> being executed.
>
> Can we add an exception for the Trash folder?
>
> Thanks
>
>
> --
> George Kontostanos
> ---
>

Could we use something like this:

imapsieve_mailbox2_name = ! Trash

-- 
George Kontostanos
---


Re: Replacement for antispam plugin

2017-02-10 Thread George Kontostanos
On Fri, Feb 10, 2017 at 5:09 PM, Darac Marjal <mailingl...@darac.org.uk>
wrote:

> On Fri, Feb 10, 2017 at 03:52:52PM +0100, Ralph Seichter wrote:
>
>> On 10.02.2017 09:06, Aki Tuomi wrote:
>>
>> Since antispam plugin is deprecated and we would really prefer people
>>> not to use it, we wrote instructions on how to replace it with IMAPSieve.
>>>
>>
>> In my setup, I use the following sieve script globally for all users:
>>
>>  if header :is "X-Spam-Flag" "YES" {
>>fileinto "Junk";
>>stop;
>>  }
>>
>> This allows processing based on spam flags set by Amavis/SpamAssassin.
>> I wonder if the method shown in
>>
>>  https://wiki.dovecot.org/HowTo/AntispamWithSieve
>>
>> will cause incoming mail (via LMTP) that is already flagged as spam to
>> be processed by report-spam.sieve and, in consequence, will be learned
>> as spam for a second time, which would of course be undesirable?
>>
>
> It shouldn't do. Check out https://wiki.dovecot.org/Pigeo
> nhole/Sieve/Plugins/IMAPSieve, which explains that sieve is normally only
> used at delivery time, but the sieve_imapsieve plugin runs a *different*
> sieve script based on IMAP actions (for example, COPY).
>
> So, when you deliver, your main script tells dovecot WHERE to deliver to.
> When you issue and IMAP COPY command, the Antispam scripts tell dovecot to
> pipe the message to spamassassin. The delivery does not involve IMAP and
> the IMAP COPY does not constitute redelivery.
>
>
> --
> For more information, please reread.
>

I think that this needs some change:

 # From Spam folder to elsewhere
  imapsieve_mailbox2_name = *
  imapsieve_mailbox2_from = Spam
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_before = file:/usr/lib/dovecot/sieve/report-ham.sieve

When a message from Spam is moved to Trash then the report-ham.sieve is
being executed.

Can we add an exception for the Trash folder?

Thanks


-- 
George Kontostanos
---


Re: Domains on different IPs

2016-12-23 Thread George Kontostanos
On Sat, Dec 17, 2016 at 1:35 PM, Mark Constable  wrote:

> I want to supply separate Letsencrypt certificates for each virtual domain
> and seeing that SNI does not work I need to allocate separate IPs. Could
> anyone give some pointers, or keywords to search for, on...
>
> a) how to make dovecot listen for different domains on different IPs?
>
> b) how to configure separate SSL certs for each of these IPs?
>

The way we do it is by specifying each IP address and certificate in
10-ssl.conf

ssl = yes

local xxx.xxx.xxx.xxx { # instead of IP you can also use hostname, which
will be resolved

  protocol imap {

ssl_cert = 

Re: dsync replication quota2 issue

2016-10-12 Thread George Kontostanos
On Tue, Oct 11, 2016 at 2:31 PM, George Kontostanos <gkontos.m...@gmail.com>
wrote:

> Hello list,
>
> We are testing a configuration with 2 mail servers using dsync replication
> (dovecot 2.2.25 ). Everything works fine except the quota2 which is
> calculated wrong only on one server. Quota2 resides on  different databases
> since each server needs to update it.
>
> The problem: The local server always updates quota2 twice on each message
> it receives. This happens only on one server. Updates run fine on the
> second.
>
> SQL Debug:
>
>  Query UPDATE quota2 SET bytes=bytes+2108,messages=messages+1 WHERE
> username = 'u...@domain.org'
>  Query UPDATE quota2 SET bytes=bytes+2108,messages=messages+1 WHERE
> username = 'u...@domain.org'
>
> The result  on the server that runs fine
>
> mysql> select * from quota2;
> ++-+--+
> | username   | bytes   | messages |
> ++-+--+
> |
> | u...@domain.org | 2917126 |   17 |
>
> The result on  the server that has the problem:
>
> mysql> select * from quota2;
> ++-+--+
> | username   | bytes   | messages |
> ++-+--+
> |
> | u...@domain.org | 2920317 |   19 |
>
> dovecot -n is the same on both:
>
> root@mx2:/var/log # dovecot -n
> # 2.2.25 (7be1766): /usr/local/etc/dovecot/dovecot.conf
> # Pigeonhole version 0.4.15 (97b3da0)
> # OS: FreeBSD 10.3-RELEASE amd64  ufs
> auth_mechanisms = plain login
> auth_verbose = yes
> default_client_limit = 2560
> default_process_limit = 512
> dict {
>   acl = mysql:/usr/local/etc/dovecot/dovecot-dict-shares-sql.conf.ext
>   quota = mysql:/usr/local/etc/dovecot/dovecot-dict-quota-sql.conf.ext
> }
> doveadm_password =  # hidden, use -P to show it
> doveadm_port = 12345
> log_path = /var/log/dovecot.log
> mail_debug = yes
> mail_home = /usr/local/vhosts/mail/%d/%n
> mail_location = maildir:/usr/local/vhosts/mail/%d/%n:LAYOUT=fs
> mail_max_userip_connections = 70
> mail_plugins = quota acl notify replication
> mail_privileged_group = vmail
> mail_shared_explicit_inbox = yes
> managesieve_notify_capability = mailto
> managesieve_sieve_capability = fileinto reject envelope encoded-character
> vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
> copy include variables body enotify environment mailbox date index ihave
> duplicate mime foreverypart extracttext
> mbox_write_locks = fcntl
> namespace {
>   inbox = no
>   list = children
>   location = maildir:/usr/local/vhosts/mail/%%d/%%n:LAYOUT=fs:INDEX=/
> usr/local/vhosts/indexes/%d/%n/shared/%%u:INDEXPVT=/usr/
> local/vhosts/indexes/%d/%n/shared/%%u
>   prefix = shared/%%d/%%n/
>   separator = /
>   subscriptions = no
>   type = shared
> }
> namespace inbox {
>   inbox = yes
>   list = yes
>   location =
>   mailbox Drafts {
> auto = subscribe
> special_use = \Drafts
>   }
>   mailbox Junk {
> auto = subscribe
> special_use = \Junk
>   }
>   mailbox Sent {
> auto = subscribe
> special_use = \Sent
>   }
>   mailbox Trash {
> auto = subscribe
> special_use = \Trash
>   }
>   prefix =
>   separator = /
>   type = private
> }
> passdb {
>   args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
>   driver = sql
> }
> plugin {
>   acl = vfile
>   acl_shared_dict = proxy::acl
>   mail_replica = tcp:beta.sophimail.com:12345
>   quota = dict:User quota::proxy::quota
>   quota_rule2 = Trash:storage=+100M
>   sieve = /usr/local/vhosts/mail/%d/%n/.dovecot.sieve
>   sieve_before = /usr/local/vhosts/sieve/before.d/
>   sieve_dir = /usr/local/vhosts/mail/%d/%n
>   sieve_global_dir = /usr/local/vhosts/sieve/%d
>   sieve_global_path = /usr/local/vhosts/sieve/%d/default.sieve
> }
> protocols = imap lmtp sieve sieve
> service aggregator {
>   fifo_listener replication-notify-fifo {
> mode = 0666
> user = vmail
>   }
>   unix_listener replication-notify {
> mode = 0666
> user = vmail
>   }
> }
> service auth-worker {
>   user = vmail
> }
> service auth {
>   unix_listener /var/spool/postfix/private/auth {
> group = postfix
> mode = 0666
> user = postfix
>   }
>   unix_listener auth-userdb {
> mode = 0600
> user = vmail
>   }
>   user = dovecot
> }
> service config {
>   unix_listener config {
> user = vmail
>   }
> }
> service dict {
>   unix_listener dict {
> mode = 0600
> user = vmail
>   }
> }
> service doveadm {
>   inet_list

dsync replication quota2 issue

2016-10-11 Thread George Kontostanos
Hello list,

We are testing a configuration with 2 mail servers using dsync replication
(dovecot 2.2.25 ). Everything works fine except the quota2 which is
calculated wrong only on one server. Quota2 resides on  different databases
since each server needs to update it.

The problem: The local server always updates quota2 twice on each message
it receives. This happens only on one server. Updates run fine on the
second.

SQL Debug:

 Query UPDATE quota2 SET bytes=bytes+2108,messages=messages+1 WHERE
username = 'u...@domain.org'
 Query UPDATE quota2 SET bytes=bytes+2108,messages=messages+1 WHERE
username = 'u...@domain.org'

The result  on the server that runs fine

mysql> select * from quota2;
++-+--+
| username   | bytes   | messages |
++-+--+
|
| u...@domain.org | 2917126 |   17 |

The result on  the server that has the problem:

mysql> select * from quota2;
++-+--+
| username   | bytes   | messages |
++-+--+
|
| u...@domain.org | 2920317 |   19 |

dovecot -n is the same on both:

root@mx2:/var/log # dovecot -n
# 2.2.25 (7be1766): /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.15 (97b3da0)
# OS: FreeBSD 10.3-RELEASE amd64  ufs
auth_mechanisms = plain login
auth_verbose = yes
default_client_limit = 2560
default_process_limit = 512
dict {
  acl = mysql:/usr/local/etc/dovecot/dovecot-dict-shares-sql.conf.ext
  quota = mysql:/usr/local/etc/dovecot/dovecot-dict-quota-sql.conf.ext
}
doveadm_password =  # hidden, use -P to show it
doveadm_port = 12345
log_path = /var/log/dovecot.log
mail_debug = yes
mail_home = /usr/local/vhosts/mail/%d/%n
mail_location = maildir:/usr/local/vhosts/mail/%d/%n:LAYOUT=fs
mail_max_userip_connections = 70
mail_plugins = quota acl notify replication
mail_privileged_group = vmail
mail_shared_explicit_inbox = yes
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
copy include variables body enotify environment mailbox date index ihave
duplicate mime foreverypart extracttext
mbox_write_locks = fcntl
namespace {
  inbox = no
  list = children
  location =
maildir:/usr/local/vhosts/mail/%%d/%%n:LAYOUT=fs:INDEX=/usr/local/vhosts/indexes/%d/%n/shared/%%u:INDEXPVT=/usr/local/vhosts/indexes/%d/%n/shared/%%u
  prefix = shared/%%d/%%n/
  separator = /
  subscriptions = no
  type = shared
}
namespace inbox {
  inbox = yes
  list = yes
  location =
  mailbox Drafts {
auto = subscribe
special_use = \Drafts
  }
  mailbox Junk {
auto = subscribe
special_use = \Junk
  }
  mailbox Sent {
auto = subscribe
special_use = \Sent
  }
  mailbox Trash {
auto = subscribe
special_use = \Trash
  }
  prefix =
  separator = /
  type = private
}
passdb {
  args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
  driver = sql
}
plugin {
  acl = vfile
  acl_shared_dict = proxy::acl
  mail_replica = tcp:beta.sophimail.com:12345
  quota = dict:User quota::proxy::quota
  quota_rule2 = Trash:storage=+100M
  sieve = /usr/local/vhosts/mail/%d/%n/.dovecot.sieve
  sieve_before = /usr/local/vhosts/sieve/before.d/
  sieve_dir = /usr/local/vhosts/mail/%d/%n
  sieve_global_dir = /usr/local/vhosts/sieve/%d
  sieve_global_path = /usr/local/vhosts/sieve/%d/default.sieve
}
protocols = imap lmtp sieve sieve
service aggregator {
  fifo_listener replication-notify-fifo {
mode = 0666
user = vmail
  }
  unix_listener replication-notify {
mode = 0666
user = vmail
  }
}
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
  }
  unix_listener auth-userdb {
mode = 0600
user = vmail
  }
  user = dovecot
}
service config {
  unix_listener config {
user = vmail
  }
}
service dict {
  unix_listener dict {
mode = 0600
user = vmail
  }
}
service doveadm {
  inet_listener {
port = 12345
  }
  user = vmail
}
service imap-login {
  inet_listener imap {
port = 143
  }
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
  }
}
service managesieve-login {
  inet_listener sieve {
port = 4190
  }
  process_min_avail = 0
  service_count = 1
  vsz_limit = 64 M
}
service replicator {
  unix_listener replicator-doveadm {
mode = 0666
  }
}
ssl_cert =