Skip to content
Jan Radon edited this page Dec 1, 2017 · 14 revisions

Welcome to the dovecot-ceph-plugin wiki!

Dovecot-Ceph-Plugin Configuration

The plugin configuration is split up into dovecot and ceph configuration. The dovecot configuration can be changed in 90-plugin.conf. There are defaults for all settings.

Dovecot 90-plugin.conf

When running Ceph with default settings, the default cluster name is ceph, which means you would save your Ceph configuration file with the file name ceph.conf in the /etc/ceph/ default directory. When you are running several clusters you may need to change this value.

rbox_cluster_name = ceph

The following setting defines the storage pool used to store the e-mails. The default is mail_storage.

rbox_pool_name = mail_storage

It may makes sense to update immutable attributes, to keep track of changes. You can set the following setting to true to enable this feature.

rbox_update_immutable = false

You can define which metadata attributes should be saved as ceph XATTR. See dovecot doku for metadata details.

rbox_mutable_metadata = MGPORZVBUI

Currently the only immutable metadata attribute which can be updated, is the original mailbox 'B' metadata attribute to keep track of the mailbox name of a mail. This information may be helpfull when rebuilding a lost index.

rbox_immutable_metadata = B

You can specify which dovecot-ceph configuration should be used by the dovecot-ceph-plugin. The plugin will try to read the plugin ceph configuration from a ceph object with this oid. If it fails, it will create a default configuration.

rbox_config_obj_name=rbox_cfg

Ceph configuration

Per default, users e-mail are saved under the namespace username/*. For public e-mails which do not have a owner, the namespace public is used. This default leads to a problem, when you allow to rename a username. To solve this it is possible to generate a global unique identifier (guid) for the namespace and create a user mapping object which stores the user - guid association. Currently this is a setting which can only be changed before you start storing e-mails. This means, if you already have e-mails stored with rbox_generate_namespace=false and change this value to true, the old emails are no longer accessible! The configuration is saved as a json object accessible via the oid <rbox_config_obj_name> and can be modified and created with the rmb tool.

rbox_generate_namespace = false

You can specify the namespace where the configuration (user namespace config) will be saved.

rbox_namespac_cfg_ns = rbox_ns_cfg

If generated_namespace is active, a new ceph object for each user will be created, holding the namespace information. The name of this object will be <username><rbox_ns_suffix>.

rbox_ns_suffix = _namespace

RMB command line tool

The plugin provides a command line tool which will be installed to %dovecot_home%/bin/rmb. The tool gives you access to the ceph mail storage.

List users mailboxes:

rmb -N <username> ls mb

Example:

List mailboxes of user t
rmb -N t ls mb

List all user’s e-mail:

rmb [-p <mail_storage>] -N <username> ls - sort uid|recv_date|save_date|phy_size

Example:

Print all e-mails to screen sorted asc by uid
rmb -N t ls - sort uid

Search for e-mails:

rmb [-p <mail_storage>] -N <username> ls Metadata >|<|= value

Example:

Search e-mails received after 2017-11-22 13:40
rmb [-p mail_storage] -N ls R>"2017-11-22 13:40"

By replacing ls with get, it is possible to download e-mails to disk:

rmb [-p <mail_storage>] -N <username> get - -O <dir>

Example:

Download e-mail with UID 1 to ~/rmb
rmb -N t get U=1

Update e-mail metadata:

rmb [-p <mail_storage>] -N <username> set <oid> <Metadata> <value>

Example:

Set UID of e-mail object 00109203d4d61f5a0c7600009c60bf7 to 1
rmb -N t set 00109203d4d61f5a0c7600009c60bf7 U 1

Changing dovecot-ceph configuration:

Create new default configuration:

rmb -cfg -C [-obj <rbox_cfg>]

Example:

Create new default configuration with the default name rbox_cfg
rmb -cfg -C

Show current dovecot-ceph configuration:

rmb -cfg ls - [-obj <rbox_cfg>]

Example:

Print configuration
rmb -cfg ls -

Update dovecot-ceph configuration:

rmb -cfg [-obj <rbox_cfg>] <key>=<value> --yes-i-really-really-mean-it

Example:

Set the value of generated_namespaces to true
rmb -cfg generated_namespaces=true --yes-i-really-really-mean-it
Warning
changing values in the dovecot-ceph configuration should be done, before storing e-mails in ceph. If it is done afterwards there will be problems accessing old mails.

Getting help

Accessing the man page

man rmb

Print usage information

rmb --help

Restore Index

To restore an rbox index, dovecot tool doveadm force-resync -u user <MAILBOX_NAME> can be used. The tool first makes a backup of the current index file if it exists. Afterwards, it tries to read the Mailbox GUID from the index file to determine the mailbox unique identifier. If GUID cannot be found, the mailbox name given in doveadm command line argument will be used.

The restore process works in the following way.

  • The tool searches for all Rados objects matching xattr M = Mailbox guid in user namespace (in case no GUID is available, it uses B = Mailbox name)

  • Found mail objects are added to the newly created index file.

  • The tool tries to find a matching mail record in cache or backup index file (seq, uid), to complete the newly created index entry.

  • The resulting index will only include mails which have a corresponding rados mail object.

Clone this wiki locally