Skip to main content

Autoconfigure mail clients from Modoboa

Project description

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!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

modoboa-automua-1.0.0.tar.gz (33.9 kB view details)

Uploaded Source

Built Distribution

modoboa_automua-1.0.0-py3-none-any.whl (26.9 kB view details)

Uploaded Python 3

File details

Details for the file modoboa-automua-1.0.0.tar.gz.

File metadata

  • Download URL: modoboa-automua-1.0.0.tar.gz
  • Upload date:
  • Size: 33.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for modoboa-automua-1.0.0.tar.gz
Algorithm Hash digest
SHA256 11003767cb693fb752add2815537337cd59398dbb8e87ca1934310106fe40617
MD5 597dbd4f52733d42b89ed41c81b62811
BLAKE2b-256 3654f9c0796819515fbcb68fd2fc226c0c94d758a7588d7124708357f79da433

See more details on using hashes here.

File details

Details for the file modoboa_automua-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: modoboa_automua-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 26.9 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for modoboa_automua-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04c50e56d7e0b4e5dfc543d8d57e4001925102d0c314a3503cbe125a81193984
MD5 53ae95991bf382c916a577a8e040a829
BLAKE2b-256 7a4ed2e1feb390a42d07a180befa6ff7f865b46b273ea093fa8baa918cbbc76d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page