Skip to main content

modoboa-automua

Autoconfigure mail clients from Modoboa.

This extension is based on automx to provide methods for automated mailbox configuration from Microsoft's Autodiscover and Mozilla's Autoconfig. It extends Modoboa to configure the server name to use for each domain from its administration interface, and to return the appropriate response to the MUA.

Requirements

  • Python 3 (>= 3.7)
  • Modoboa, deployed with the installer or manually

Installation

  1. Activate the virtual environment in which Modoboa is installed.
  2. Install this extension from PyPi:
    (env)$ pip install modoboa-automua
    
  3. Add this extension to the installed applications in your instance's settings:
    MODOBOA_APPS = (
        "modoboa",
        # ...
        # Modoboa extensions here.
        "modoboa_automua",
    )
    
  4. Update your database and collect the static files:
    (env)$ ./manage.py migrate
    (env)$ ./manage.py collectstatic
    

Finally, restart the Python process which is running Modoboa.

Usage

Once this extension is installed, you will need to configure either the server name to return for each domain - see AUTOMUA_DEFAULT_SERVER_NAME - or to configure each domain from the Modoboa administration - through the MUA tab.

Then, you will have to adjust your Web server to serve the autoconfig.* and autodiscover.* domains either by your Modoboa instance or with a new dedicated WSGI application - see AUTOMUA_SERVE_FRONTEND_ROUTES.

Configuration

The following settings are available to customize this extension.

AUTOMUA_DEFAULT_SERVER_NAME

The server name to use for all the domains which are configured to use the default values. By default, or if it is empty, the autoconfiguration will not be available for those domains.

For example:

AUTOMUA_DEFAULT_SERVER_NAME = "mx.example.org"

AUTOMUA_SERVE_FRONTEND_ROUTES

By default, this is True and views for mail clients will be served by the Modoboa application.

In production, you would rather like to serve those routes by a dedicated WSGI application to preserve the security of the Modoboa application - and prevent any changes to ALLOWED_HOST. To proceed, you will have to:

  1. Set AUTOMUA_SERVE_FRONTEND_ROUTES to False in the settings file of your Modoboa instance.

  2. Create a new folder - e.g. named automua - where the manage.py file of your instance is located, with the following files inside:

    • __init__.py, an empty file
    • settings.py, which could just contain the following lines:
      from modoboa_automua.frontend.settings import *  # noqa
      
      # Define SECRET_KEY, SITE_ID and DATABASES with the same values than
      # the one in the settings file of your Modoboa instance.
      
      # Optionaly, set the default server name:
      #AUTOMUA_DEFAULT_SERVER_NAME = "mx.example.org"
      
    • wsgi.py, with the following content - replace automua with the name of your folder if you have chosen a different one:
      import os
      
      from django.core.wsgi import get_wsgi_application
      
      os.environ.setdefault("DJANGO_SETTINGS_MODULE", "automua.settings")
      
      application = get_wsgi_application()
      
  3. Serve a new WSGI application with the newly created wsgi.py file as the entry point on all the required domains - e.g. autoconfig.* and autodiscover.*.

AUTOMUA_SERVER_SERVICES

You can configure the available services of your mail server which will be returned to the MUA for all domains. A service is composed by:

By default, all protocols in both SSL and STARTTLS are returned - SSL ones have higher priority though. They are defined in an ordered list by modoboa_automua.DEFAULT_SERVER_SERVICES.

For example, to expose only protocols in SSL:

from modoboa_automua import Service, ServiceSecurity, ServiceType

AUTOMUA_SERVER_SERVICES = (
    Service(ServiceType.POP, 995, ServiceSecurity.SSL),
    Service(ServiceType.IMAP, 993, ServiceSecurity.SSL),
    Service(ServiceType.SMTP, 465, ServiceSecurity.SSL),
)

Development

To setup a development environment, clone this repository and follow the installation steps but replace the installation from PyPi by:

(env)$ pip install -e .[test]

The Python code is formatted and linted thanks to flake8, isort and black. To ease the use of this tools, the following commands are available:

  • make lint: check the Python code syntax and imports order
  • make format: fix the Python code syntax and imports order

License

This extension is mainly developed by Cliss XXI and licensed under the AGPLv3+. Any contribution is welcome!

Metadata

Release files for modoboa-automua 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for modoboa-automua 1.0.0
File Size Uploaded
modoboa-automua-1.0.0.tar.gz 33.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for modoboa-automua 1.0.0
File Interpreter ABI Platform
modoboa_automua-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 60.8 kB

Release files / modoboa-automua-1.0.0.tar.gz

Download URL modoboa-automua-1.0.0.tar.gz
Size 33.9 kB
Tags Source
SHA-256 checksum
How to use checksums
11003767cb693fb752add2815537337cd59398dbb8e87ca1934310106fe40617
BLAKE2b-256 checksum
How to use checksums
3654f9c0796819515fbcb68fd2fc226c0c94d758a7588d7124708357f79da433
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release files / modoboa_automua-1.0.0-py3-none-any.whl

Download URL modoboa_automua-1.0.0-py3-none-any.whl
Size 26.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
04c50e56d7e0b4e5dfc543d8d57e4001925102d0c314a3503cbe125a81193984
BLAKE2b-256 checksum
How to use checksums
7a4ed2e1feb390a42d07a180befa6ff7f865b46b273ea093fa8baa918cbbc76d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.57.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page