This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Mailboxes migration using OfflineIMAP

A simple Modoboa extension which provides a way to migrate existing mailboxes using OfflineIMAP.

How does it work

This extension mainly provides a cron script which periodically synchronize user mailboxes from an existing IMAP server to a new one. The workflow is pretty simple:

  • A user from the old server logs into Modoboa using the same credentials
  • A new account is automatically created and a new migration task is created using the provided credentials
  • The cron script periodically synchronizes mailboxes corresponding to migration tasks
  • Once a migration is done, it can be disabled through the admin panel

Installation

Install this extension system-wide or inside a virtual environment by running the following command:

$ python setup.py install

Then, edit the settings.py file of your modoboa instance and add modoboa_imap_migration inside the MODOBOA_APPS variable like this:

MODOBOA_APPS = (
  # ...
  'modoboa_imap_migration',
)

Restart the python process running modoboa (uwsgi, gunicorn, apache, whatever).

You also need to install OfflineIMAP.

Configuration

Authentication backend

An IMAP authentication backend is provided by the extension and must be enabled.

Edit the settings.py file and modify the AUTHENTICATION_BACKENDS variable as follows:

AUTHENTICATION_BACKENDS = (
    'modoboa.lib.authbackends.SimpleBackend',
    'modoboa_imap_migration.auth_backends.IMAPBackend',
)

cron script

The synchronization script must be configured to run periodically on your new server. Since it will copy mailboxes content to its final destination, filesystem permissions must be respected. To do that, it must be executed by the user which owns mailboxes (generally vmail).

Here is a configuration example where the script is executed every hours. You can copy it inside the /etc/cron.d/modoboa file:

PYTHON=/srv/modoboa/env/bin/python
INSTANCE=/srv/modoboa/instance

0       */1     *       *       *       vmail   cd /srv/vmail && $PYTHON $INSTANCE/manage.py generate_offlineimap_config --output .offlineimaprc && /usr/local/bin/offlineimap > /dev/null 2>&1

Feel free to adapt it.

Helper script for OfflineIMAP

OfflineIMAP will need a way to retrieve user passwords of the old server. To do that, just copy the following Python code into a file called .offlineimap.py:

import os
import site
import sys

site.addsitedir("/srv/modoboa/env/lib/python2.7/site-packages")
sys.path.append("/srv/modoboa/instance")
os.environ["DJANGO_SETTINGS_MODULE"] = "instance.settings"

import django
django.setup()

from modoboa.core import load_core_settings
from modoboa_imap_migration.models import Migration

load_core_settings()

def get_user_password(username):
    """Retrieve a password from Modoboa's database."""
    return Migration.objects.select_related().get(
        mailbox__user__username=username
    ).password

Then, copy this file into the home directory of the user owning mailboxes (generally vmail). For example:

$ cp .offlineimap.py /srv/vmail
$ chown vmail:vmail /srv/vmail/.offlineimap.py

Online settings

You need to configure the access to the old IMAP server.

All the configuration is done from the admin panel (Modoboa > Parameters > IMAP migration).

Release History

Release History

1.0.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.0

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
modoboa-imap-migration-1.0.4.tar.gz (9.4 kB) Copy SHA256 Checksum SHA256 Source Dec 4, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting