Full text search indexing behavior and testing?

2017-07-03 Thread Mart Pirita
Hi,

I'm confused about FTS. https://wiki.dovecot.org/Tools/Doveadm/Index say's:

"Messages can also be added automatically to full text search index using:

plugin {
  ...
  fts_autoindex = yes
}"


So I added "fts_autoindex = yes" into dovecot.conf (I'm using single
config file). That's it? How to test FTS? Or I still must use some
external indexing server?


-- 
Mart


Re: Any way to limit number of active IMAP/POP3 sessions from a single user / per user?

2017-07-03 Thread Alexey Asemov (Alex/AT)

Hello Aki, Timo,

Thanks a lot for your answers. I'll test with setting 
mail_max_userip_connections from DB first and tell if it works. If it 
does not, I'll go with the policy server.


Again, thanks a lot.

On 03.07.2017 9:29, Timo Sirainen wrote:

On 3 Jul 2017, at 9.24, Aki Tuomi  wrote:



On 02.07.2017 10:53, Alexey Asemov (Alex/AT) wrote:

Hello,

Just wonder: is there any way in Dovecot to limit number of active
IMAP/POP3 connections for a single user, not touching any other users?
Basically, the situation is single user hammering servers by lots of
POP3 connections from time to time, and limiting exactly one user
could be good.

Easiest would be to use 2.2.29 or later and use policy server for it.
With older version, I'm not sure if this is doable sensibly.

I think returning mail_max_userip_connections from userdb works.



Re: Any way to limit number of active IMAP/POP3 sessions from a single user / per user?

2017-07-03 Thread Alexey Asemov (Alex/AT)
I can confirm setting mail_max_userip_connections from database in 
userdb query *does not* work at all. User can still open multiple 
connection above the limit, seems like it has no effect. I thoroughly 
checked DB response and it contains proper field name/value.


I am using dovecot 2.2.31.

Also, I have mail_max_userip_connections set globally in the dovecot 
configuration file and wonder if this can interfere, but at least some 
other settings do not and so I doubt it's the cause.


So for now I have to go with writing a policy server for that it seems :)

I assume it does not work because user/IP limit is probably checked 
before parsing DB parameters.
Maybe dovecot code can be adjusted somehow so it allows setting 
mail_max_userip_connections from userdb before it's processed?


Re: Any way to limit number of active IMAP/POP3 sessions from a single user / per user?

2017-07-03 Thread Timo Sirainen
On 3 Jul 2017, at 19.34, Alexey Asemov (Alex/AT)  wrote:
> 
> I can confirm setting mail_max_userip_connections from database in userdb 
> query *does not* work at all. User can still open multiple connection above 
> the limit, seems like it has no effect. I thoroughly checked DB response and 
> it contains proper field name/value.
> 
> I am using dovecot 2.2.31.
> 
> Also, I have mail_max_userip_connections set globally in the dovecot 
> configuration file and wonder if this can interfere, but at least some other 
> settings do not and so I doubt it's the cause.

Oh, right, I remembered that this setting wasn't handled until imap process 
started, but it's handled by login process. But what you could do if the user 
has a static IP:

remote 1.2.3.4 {
  mail_max_userip_connections = 1
}

or even a static IP address space:

remote 1.2.3.0/24 {
  mail_max_userip_connections = 1
}

> So for now I have to go with writing a policy server for that it seems :)
> 
> I assume it does not work because user/IP limit is probably checked before 
> parsing DB parameters.
> Maybe dovecot code can be adjusted somehow so it allows setting 
> mail_max_userip_connections from userdb before it's processed?

Since it's login process, it would have to be returned by passdb lookup. But 
that's a lot of trouble for such a special use case.


replication and notify

2017-07-03 Thread Vitali Quiering
Hello,

we are using dovecot 2.2.13 on debian jessie from default repositories in 
multiple two node replication cluster. For another cluster I was trying to set 
this up on debian stretch with current dovecot 2.2.27.
It seemed that notifiy was not working at all. Running replicate manually did 
work though.
I found several mailing list questions regarding this issue. It looks like 
there is some locking issue with maildir storage engine or notifying the 
replicator might not work. Tried to setup sdbox without any improvements.

In version 2.2.31 there is a change in the changelog:
- imap: NOTIFY command has been almost completely broken since the beginning. I 
guess nobody has been trying to use it.

Question 1: Is this change regarding the notify process that notifies the 
replicator?
Question 2: When will this version be available on dovecot stretch-auto 
repository? I installed sid version to test.
Question 3: What else can I do to make replication work?

Thanks,
Vitali

Config:
> # OS: Linux 4.9.0-3-amd64 x86_64 Debian 9.0 ext4
> auth_mechanisms = plain login
> default_internal_user = vmail
> doveadm_password =  # hidden, use -P to show it
> doveadm_port = 12345
> dsync_remote_cmd = ssh -l%{login} %{host} doveadm dsync-server -u%u
> info_log_path = /var/log/dovecot/dovecot-info.log
> log_path = /var/log/dovecot/dovecot.log
> log_timestamp = "%Y-%m-%d %H:%M:%S "
> mail_debug = no
> mail_location = maildir:/var/vmail/%d/%n
> mail_plugins = " notify replication"
> mail_privileged_group = vmail
> namespace inbox {
>   inbox = yes
>   location =
>   mailbox Drafts {
> special_use = \Drafts
>   }
>   mailbox Junk {
> special_use = \Junk
>   }
>   mailbox Sent {
> special_use = \Sent
>   }
>   mailbox "Sent Messages" {
> special_use = \Sent
>   }
>   mailbox Trash {
> special_use = \Trash
>   }
>   prefix =
> }
> passdb {
>   args = /etc/dovecot/dovecot-sql.conf
>   driver = sql
> }
> plugin {
>   mail_replica = tcp:mx02.example.com
>   replication_full_sync_interval = 24 hour
>   sieve = /var/vmail/%d/%n/.dovecot.sieve
>   sieve_dir = /var/vmail/%d/%n/
>   sieve_storage = /var/vmail/%d/%n/sieve/
> }
> protocols = " imap pop3"
> service aggregator {
>   fifo_listener replication-notify-fifo {
> mode = 0666
> user = vmail
>   }
>   unix_listener replication-notify {
> mode = 0666
> user = vmail
>   }
> }
> service auth {
>   unix_listener /var/spool/postfix/private/auth {
> group = postfix
> mode = 0666
> user = postfix
>   }
>   unix_listener auth-master {
> mode = 0600
> user = vmail
>   }
>   user = root
> }
> service doveadm {
>   inet_listener {
> port = 12345
>   }
> }
> service imap-login {
>   inet_listener imap {
> port = 143
>   }
>   inet_listener imaps {
> port = 993
> ssl = yes
>   }
>   process_min_avail = 1
> }
> service pop3-login {
>   inet_listener pop3 {
> port = 110
>   }
>   inet_listener pop3s {
> port = 995
> ssl = yes
>   }
> }
> service replicator {
>   process_min_avail = 1
>   unix_listener replicator-doveadm {
> mode = 0666
>   }
> }
> ssl = required
> ssl_cert =  ssl_cipher_list = HIGH:MEDIUM:+TLSv1:!SSLv2:+SSLv3
> ssl_key =  # hidden, use -P to show it
> userdb {
>   args = /etc/dovecot/dovecot-sql.conf
>   driver = sql
> }
> protocol lda {
>   auth_socket_path = /var/run/dovecot/auth-userdb
>   log_path = /var/log/dovecot/dovecot-deliver.log
>   mail_plugins = " notify replication sieve"
>   postmaster_address = postmas...@example.com
> }
> protocol pop3 {
>   pop3_uidl_format = %08Xu%08Xv
> }

Log from mx01:
> 2017-07-03 21:50:54 imap-login: Info: Login: user=, 
> method=PLAIN, rip=1.2.3.4, lip=172.31.1.100, mpid=9584, TLS, 
> session=
> 2017-07-03 21:50:54 imap(user): Debug: Loading modules from directory: 
> /usr/lib/dovecot/modules
> 2017-07-03 21:50:54 imap(user): Debug: Module loaded: 
> /usr/lib/dovecot/modules/lib15_notify_plugin.so
> 2017-07-03 21:50:54 imap(user): Debug: Module loaded: 
> /usr/lib/dovecot/modules/lib20_replication_plugin.so
> 2017-07-03 21:50:54 imap(user): Debug: Added userdb setting: 
> mail=maildir:/var/vmail/example.com/user
> 2017-07-03 21:50:54 imap(user): Debug: Effective uid=5000, gid=5000, 
> home=/var/vmail/example.com/user
> 2017-07-03 21:50:54 imap(user): Debug: Namespace inbox: type=private, 
> prefix=, sep=, inbox=yes, hidden=no, list=yes, subscriptions=yes 
> location=maildir:/var/vmail/example.com/user
> 2017-07-03 21:50:54 imap(user): Debug: maildir++: 
> root=/var/vmail/example.com/user, index=, indexpvt=, control=, 
> inbox=/var/vmail/example.com/user, alt=
> 2017-07-03 21:50:54 imap(user): Debug: INBOX: Mailbox opened because: SELECT
> 2017-07-03 21:50:54 imap(user): Debug: Deleted Messages: Mailbox opened 
> because: STATUS
> 2017-07-03 21:50:54 imap-login: Info: Login: user=, 
> method=PLAIN, rip=1.2.3.4, lip=172.31.1.100, mpid=9586, TLS, 
> session=
> 2017-07-03 21:50:54 imap(user): Debug: Loading modules from directory: 
> /usr/lib/dovecot/mo

[PATCH] dsync: fix splitting login from host

2017-07-03 Thread Thomas Reifferscheid
Using strchr() was splitting login and host at the first
occurrence of '@' which leads to troublesome behaviour.
When calling strace one would notice the misbehaviour:

execve("/usr/sbin/ssh", ["ssh", "-lthomas", "domain.org@10.8.13.2"

using strrch() however splits login and host at the last occurrence
of '@'.

Signed-off-by: Thomas Reifferscheid 
---
 src/doveadm/doveadm-dsync.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/doveadm/doveadm-dsync.c b/src/doveadm/doveadm-dsync.c
index caf569f1d..3b8d4549a 100644
--- a/src/doveadm/doveadm-dsync.c
+++ b/src/doveadm/doveadm-dsync.c
@@ -479,7 +479,7 @@ parse_ssh_location(const char *location, const char 
*username)
 {
const char *host, *login;
 
-   host = strchr(location, '@');
+   host = strrchr(location, '@');
if (host != NULL)
login = t_strdup_until(location, host++);
else {
-- 
2.11.0


Re: Sieve can't move messages in a public namespace

2017-07-03 Thread Paolo

Il 30/06/2017 10:46, Paolo ha scritto:

Hello,

my dovecot version is 2.1.17

I've configured some public namespaces (config attached). When a mail 
arrives at a certain mail address, that mail is handled by dovecot 
lmtp server and a sieve script is executed that shuold move the 
message in one of the namespaces. This is the script:


require "fileinto";

if header :contains "From" "exam...@example.com" {
   fileinto "Cond-UFF_FORNITORI/CONTABILITA/Inviata";
}
else {
fileinto "Cond-UFF_FORNITORI/CONTABILITA/Ricevuta";
}

The problem is that the sieve script fails with the error:

   sieve: info: started log at Jun 27 12:42:28.
   error: msgid=: 
failed to store into mailbox 
'Cond-UFF_FORNITORI/CONTABILITA/Ricevuta': Mailbox doesn't exist: 
Cond-UFF_FORNITORI/CONTABILITA/Ricevuta.


I double checked config, dovecot documentation, sieve documentation, 
ACL, filesystem paths, filesystem permissions, etc. etc. I'm pretty 
sure it's all right.

So why isn't sieve working?

Thanks if you bother to answer & Cheers

Paolo


Nobody has clues?