Search K
Appearance
Appearance
As mentioned in Palomar Architecture, you can't have multiple servers accessing the same user at the same time or it will lead into trouble. This can become problematic with shared mailboxes, because two users who are sharing a folder may run in different servers.
The solution is to access the shared folders via IMAP protocol, which passes through the Dovecot proxies so the actual filesystem access is done only on a single server.
There are some limitations for this kind of use case:
imapc_*
settings are global. You can't have two different namespaces with different imapc settings yet.You'll need to setup master user logins to work for all the users. The logged in user becomes the master user. The master user doesn't actually have any special privileges. It's just used to get ACLs applied correctly using permissions of the master user (the logged in user). It is supported to access shared mailboxes of users which live on other backends via the IMAP protocol. For this purpose shared mailboxes in a cluster must be accessed via another namespace which has location
configured to use imapc
.
It is recommended to disable shared namespaces for master users so you should add userdb_namespace/shared/disabled=yes
to your master passdb as a passdb extra fields.
Depending on the authentication configuration, it may be necessary to also override the acl_user
via userdb extra fields like: userdb_acl_user=%{auth_user}
.
Mailboxes in the shared namespace can be accessed using the given namespace prefix. For example the user someone1
could have access to a mailbox(shared_mailbox
) owned by the user someone2
. To access mails in this mailbox someone1
would access a mailbox with the name shared/someone2/shared_mailbox
. The permissions which are given to someone1
on this mailbox are determined by ACLs.
Example:
namespace shared {
type = shared
prefix = shared/%%u/
list = children
subscriptions = no
# Use INDEXPVT to enable per-user \Seen flags.
location = imapc:~/shared/%%u:INDEXPVT=~/shared-pvt/%%u
}
Note
Obox relies on having the INDEXPVT directory configured to ~/shared-pvt
otherwise the private indexes are not tracked by metacache and can get lost if user changes backends.
Note
See shared mailbox expansion documentation for an explanation more details on the used variables.
Additionally imapc must be configured accordingly on the backends:
userdb_imapc_master_user=%{user}
or imapc_master_user=%{user}
imapc_master_user
becomes set using userdb. In case of a simple setup imapc_master_user
can also be just set to %u
(the logged in user).imapc_password
must be set to the master password which is configured on all backends and proxiesimapc_host
must point to a load balancer's address that connects to Dovecot Proxyimapc_host = proxy-load-balancer
# Leave this empty. It will automatically be filled with the destination
# username
#imapc_user =
imapc_password = master-secret
The acl plugin must be loaded and configured:
mail_plugins = $mail_plugins acl
plugin {
acl = vfile
acl_ignore_namespace = shared/*
acl_shared_dict = $your_prefered_shared_dict
}
# In order to be able to issue ACL commands over imap, imap_acl must be loaded
protocol imap {
mail_plugins = $mail_plugins imap_acl
}
The ACL plugin must be told to ignore the shared namespace and all its children using the acl_ignore_namespace
setting.
The shared dictionary needs to be accessible from all the backends. The possibilities are:
Dictionary Type | Description |
---|---|
file | A single shared file in filesystem. This becomes a performance bottleneck easily if there are many in a shared filesystem. |
fs posix | Shared directory in filesystem. This will create many small files in a shared filesystem. |
sql | Shared SQL server |
Other shared dictionaries] | See shared mailbox listing |
When using the quota plugin, it must be configured to not attempt to calculate quota for the shared namespaces. This is suggested to be achieved by limiting the quota plugin to the private inbox namespace using:
quota=count:ns=<inbox namespace prefix>
See quota plugin for more details.
The following snippets show important configuration parts for configuring cluster wide sharing of mailboxes. The following snippets are not complete configuration.
passdb {
driver = static
master = yes
default_fields = proxy=y
args = password=imapcpass
}
passdb {
driver = static
args = proxy=y password=masterpass
}
mail_plugins = $mail_plugins acl
imapc_host = <proxy-load-balancer>
imapc_password = imapcpass
imapc_user = # empty defaults to shared user
namespace shared {
type = shared
prefix = shared/%%u/
separator = /
list = children
subscriptions = no
location = imapc:~/shared/%%u:INDEXPVT=~/shared-pvt/%%u
}
namespace inbox {
inbox = yes
location =
}
passdb {
# masterpass is the normal users master password
args = password=masterpass userdb_imapc_master_user=%{user}
driver = static
}
passdb {
driver = static
master = yes
# imapcpass is the master password used for master logins (via imapc)
args = password=imapcpass userdb_namespace/shared/disabled=yes userdb_acl_user=%{auth_user}
}
dict {
# Any shared dictionary is suitable this is just an example using mysql
acl-mysql = mysql:/etc/dovecot/dovecot-acl-dict-sql.conf.ext
}
plugin {
acl = vfile
acl_ignore_namespace = shared/*
acl_shared_dict = proxy:dict:acl-mysql
}
protocol imap {
mail_plugins = $mail_plugins imap_acl
}
# If quota is used make sure to disable counting for shared namespace
#mail_plugins = $mail_plugins quota
#plugin {
#quota = count:User storage:ns=
#quota_rule = *:storage=1G
#}