diff --git a/doc/integration/imap_and_smtp.rst b/doc/integration/imap_and_smtp.rst index 2ab61583d..ded944f66 100644 --- a/doc/integration/imap_and_smtp.rst +++ b/doc/integration/imap_and_smtp.rst @@ -55,6 +55,15 @@ For dovecot 2.0 and older, use the `autocreate Operations on the file system ----------------------------- +.. warning:: + + Modoboa needs to access the ``dovecot`` binary to check its + version. To find the binary path, we use the ``which`` command + first and then try known locations (:file:`/usr/sbin/dovecot` and + :file:`/usr/local/sbin/dovecot`). If you installed dovecot in a + custom location, please tell us where the binary is by using the + ``DOVECOT_LOOKUP_PATH`` setting (see :file:`settings.py`). + Three operation types are considered: #. Mailbox creation diff --git a/modoboa/core/commands/templates/settings.py.tpl b/modoboa/core/commands/templates/settings.py.tpl index b7f36115f..87b8caa88 100644 --- a/modoboa/core/commands/templates/settings.py.tpl +++ b/modoboa/core/commands/templates/settings.py.tpl @@ -172,6 +172,8 @@ SOUTH_TESTS_MIGRATE = False #MODOBOA_CUSTOM_LOGO = os.path.join(MEDIA_URL, "custom_logo.png") +#DOVECOT_LOOKUP_PATH = ('/path/to/dovecot', ) + AUTHENTICATION_BACKENDS = ( 'modoboa.lib.authbackends.SimpleBackend', ) diff --git a/modoboa/extensions/admin/app_settings.py b/modoboa/extensions/admin/app_settings.py index c35a9fab2..8daebb4ef 100644 --- a/modoboa/extensions/admin/app_settings.py +++ b/modoboa/extensions/admin/app_settings.py @@ -1,4 +1,5 @@ from django import forms +from django.conf import settings from django.utils.translation import ugettext_lazy from modoboa.lib.formutils import YesNoField, SeparatorField from modoboa.lib.sysutils import exec_cmd @@ -49,10 +50,13 @@ class AdminParametersForm(parameters.AdminParametersForm): hide_fields = False dpath = None code, output = exec_cmd("which dovecot") - known_paths = ("/usr/sbin/dovecot", "/usr/local/sbin/dovecot") if not code: dpath = output.strip() else: + known_paths = getattr( + settings, "DOVECOT_LOOKUP_PATH", + ("/usr/sbin/dovecot", "/usr/local/sbin/dovecot") + ) for fpath in known_paths: if os.path.isfile(fpath) and os.access(fpath, os.X_OK): dpath = fpath