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 emails. 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

rbox_generate_namespace = false
rbox_namespac_cfg_ns = rbox_ns_cfg
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 mail:

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

Example:

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

Search for mails:

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

Example:

search mails receveid 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 mail with UID 1 to ~/rmb
rmb -N t get U=1

Update mail metadata:

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

Example:

set UID of 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 emails in ceph. If it is done afterwards there will be problems accessing old mails.

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