Re: newbie question on a dovecot buffer

2019-11-05 Thread Aki Tuomi via dovecot


On 6.11.2019 6.47, Plutocrat via dovecot wrote:
> On 06/11/2019 01.41, Richard Bown via dovecot wrote:
>  > Can I use Dovecot as a buffer between my mail providers Dovecot servers
>> and the several IMAP mail clients on my own network ? 
>> ie,  so Dovecot would mirror the mail on my account with my mail provider, 
>> So my local dovecot server downloads mail and caches/stores on the local SBC 
>> and all the local users use IMAP from that, instead of from my mail provider.
> I'm by no means an expert, but I've seen this mentioned before, and it seems 
> that you may be asking about this:
>
> https://wiki.dovecot.org/Replication
>
> P.

For caching, you can *try* imapc.

So

namespace remote {

  location = imapc:~/.cache

  prefix = Remote}

...

}


or


mail_location = imapc:~/.cache

imapc_username = username

imapc_host = hostname

etc.


See https://wiki2.dovecot.org/MailboxFormat/imapc



Re: newbie question on a dovecot buffer

2019-11-05 Thread Plutocrat via dovecot
On 06/11/2019 01.41, Richard Bown via dovecot wrote:
 > Can I use Dovecot as a buffer between my mail providers Dovecot servers
> and the several IMAP mail clients on my own network ? 
> ie,  so Dovecot would mirror the mail on my account with my mail provider, So 
> my local dovecot server downloads mail and caches/stores on the local SBC and 
> all the local users use IMAP from that, instead of from my mail provider.

I'm by no means an expert, but I've seen this mentioned before, and it seems 
that you may be asking about this:

https://wiki.dovecot.org/Replication

P.


newbie question on a dovecot buffer

2019-11-05 Thread Richard Bown via dovecot

Hi
apologies for what will seem a daft question
I'm getting problems with my mail provider who is using dovecot.
I've loaded Dovecot on a 8 core ARMHF SBC version 2.2.33.2 on Ubuntu 
18.04. The SBC is headless. and the load looks very light and only needs 
to store/cache 4GB of mail


Can I use Dovecot as a buffer between my mail providers Dovecot servers
and the several IMAP mail clients on my own network ?

ie,  so Dovecot would mirror the mail on my account with my mail 
provider, So my local dovecot server downloads mail and caches/stores on 
the local SBC and all the local users use IMAP from that, instead of 
from my mail provider.
Can I import the same directory structure as help on my mail providers 
server ?
I'm trying to avoid the timeout problem I get when using IMAP from my 
mail provider.

Can it be done ?
and can you withstand the questions on configuration, I haven't used 
Dovecot before so its a vertical learning curve

Thanks
--
 Best wishes /73
 Richard Bown

 Email : rich...@g8jvm.com

 HTTP  :  http://www.g8jvm.com

 ##

 Ham Call: G8JVM . QRV: 50-432 MHz + Microwave
 Maidenhead QRA: IO82SP38, LAT. 52 39.720' N LONG. 2 28.171 W
 QRV 6mtrs 200W, 4mtrs 150W, 2mtrs 300W, 70cms 200W,
 Microwave 1296MHz 110W, 2320MHz 100W, 5760MHz 10W & 10368MHz 5W
 OS: Linux Mint 19.2 x86_64 Tina, on a Dell Inspiron 3580 laptop
 ##
Come back Guy Fawkes, all is forgiven


Trying to replace anti spam plugin with IMAPSieve; no joy

2019-11-05 Thread Brad Koehn via dovecot
I’m trying to follow the instructions on the wiki to move from antispam to 
IMAPSieve, but it’s not working at all. A bit of a background:

dovecot-core  2:2.3.8-4~buster
dovecot-imapd 2:2.3.8-4~buster
dovecot-lmtpd 2:2.3.8-4~buster
dovecot-managesieved  2:2.3.8-4~buster
dovecot-pgsql 2:2.3.8-4~buster
dovecot-pop3d 2:2.3.8-4~buster
dovecot-sieve 2:2.3.8-4~buster
dovecot-solr  2:2.3.8-4~buster

My regular sieve scripts work fine for messages arriving through LMTP. I’ve 
updated my 20-imap.conf thusly:

##
## IMAP specific settings
##

protocol imap {
  mail_max_userip_connections = 30

  # Space separated list of plugins to load (default is global mail_plugins).
  mail_plugins = $mail_plugins imap_acl imap_sieve
}

plugin {
  sieve_plugins = sieve_imapsieve sieve_extprograms

  sieve_trace_dir = /tmp
  sieve_trace_level = matching

  # From elsewhere to Spam folder
  imapsieve_mailbox1_name = Spam
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_before = file:/usr/lib/dovecot/sieve/report-spam.sieve

  # 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

  sieve_pipe_bin_dir = /usr/lib/dovecot/sieve

  sieve_global_extensions = +vnd.dovecot.pipe +vnd.dovecot.environment
}



I created the report-spam.sieve and report-ham.sieve scripts in 
/usr/lib/dovecot/sieve and compiled them with sievec:

require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];

if environment :matches "imap.mailbox" "*" {
  set "mailbox" "${1}";
}

if string "${mailbox}" "Trash" {
  stop;
}

pipe :copy "sa-learn-pipe.sh" [ "ham" ];



require ["vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables"];

pipe :copy "sa-learn-pipe.sh" [ "spam" ];



Lastly, I have the sa-learn-pipe.sh script in /usr/lib/dovecot/sieve:

#!/bin/bash

echo "`date` learning $*" >> /tmp/sa-learn

# We run amavisd-new on another Kubernetes pod and communicate with it via 
socat on both ends; this worked with the old antispam plugin.

if [ "$*" = "ham" ] ; then
  socat - TCP:amavis:4443
else
  socat - TCP:amavis:
fi

exit 0



The /usr/lib/dovecot/sieve directory looks like this:
drwxr-xr-x 1 root root 4096 Nov  4 20:49 .
drwxr-xr-x 1 root root 4096 Nov  3 20:06 ..
-rwxr-xr-x 1 root root  237 Nov  3 15:56 report-ham.sieve
-rw-r--r-- 1 root root  384 Nov  4 20:49 report-ham.svbin
-rwxr-xr-x 1 root root  122 Nov  3 15:56 report-spam.sieve
-rw-r--r-- 1 root root  290 Nov  4 20:49 report-spam.svbin
-rwxr-xr-x 1 root root  208 Nov  3 17:58 sa-learn-pipe.sh

When the sieve scripts run when mail arrives during LMTP delivery they 
dutifully log their work in /tmp, so I know sieve works and sieve logging works 
too. The sieve scripts above never log anything, nor does /tmp/sa-learn ever 
get created as it would if sa-learn-pipe.sh were ever run. As far as I can tell 
I’ve duplicated the configuration from the wiki almost exactly, but dovecot is 
just not running the sieve scripts when messages are moved into/out of Junk. 

What am I missing?

Re: sievec *.sieve problem.

2019-11-05 Thread Reio Remma via dovecot

On 05/11/2019 10:03, Sami Ketola via dovecot wrote:



On 5 Nov 2019, at 9.53, Reio Remma via dovecot > wrote:


Hello!

For the second time I've tripped onto this banana peel. :)

I had 2 sieve files in a directory that I wanted to compile:

sievec *.sieve

The result of this is that first.sieve is compiled into second.sieve 
instead of first.svbin, thus destroying the source of second.sieve.


Please consider this a bug report. :)



Not a bug. Works as documented:

# sievec
Usage: sievec  [-c ] [-d] [-D] [-P ] [-x 
]

               []
sievec(root): Fatal: Missing  argument

if you want to compile all sieve scripts in a single directory just 
give that directory as parameter and don't let your shell to expand 
the wildcard.


Sami


Very well, although unfortunate and counterintuitive. :)

Reio


Re: sievec *.sieve problem.

2019-11-05 Thread Sami Ketola via dovecot


> On 5 Nov 2019, at 9.53, Reio Remma via dovecot  wrote:
> 
> Hello!
> 
> For the second time I've tripped onto this banana peel. :)
> 
> I had 2 sieve files in a directory that I wanted to compile:
> 
> sievec *.sieve
> 
> The result of this is that first.sieve is compiled into second.sieve instead 
> of first.svbin, thus destroying the source of second.sieve.
> 
> Please consider this a bug report. :)


Not a bug. Works as documented:

# sievec
Usage: sievec  [-c ] [-d] [-D] [-P ] [-x ] 
   []
sievec(root): Fatal: Missing  argument

if you want to compile all sieve scripts in a single directory just give that 
directory as parameter and don't let your shell to expand the wildcard.

Sami