mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-23 06:38:40 +02:00
Documentation update.
This commit is contained in:
@@ -1,146 +0,0 @@
|
||||
############
|
||||
IMAP servers
|
||||
############
|
||||
|
||||
.. _dovecot:
|
||||
|
||||
*******
|
||||
Dovecot
|
||||
*******
|
||||
|
||||
If you are using the *maildir* format to store mailboxes, add the
|
||||
following line into Dovecot's main config file
|
||||
(*/etc/dovecot/dovecot.conf*)::
|
||||
|
||||
mail_location = maildir:<path_to_mailboxes>/%h/.maildir
|
||||
|
||||
The ``.maildir`` part is the previous example must match the value of
|
||||
the ``MAILDIR_ROOT`` parameter. See :ref:`admin-params`.
|
||||
|
||||
If you are using the mbox format, add the following::
|
||||
|
||||
mail_location = mbox:<path_to_mailboxes>/%h/:INBOX=<path_to_mailboxes>/%h/Inbox
|
||||
|
||||
To make the authentication work, edit *dovecot.conf* and add the
|
||||
following content inside::
|
||||
|
||||
auth default {
|
||||
# ... stuff before
|
||||
|
||||
passdb sql {
|
||||
# Path for SQL configuration file, see /etc/dovecot/dovecot-sql.conf for
|
||||
# example
|
||||
args = /etc/dovecot/dovecot-sql.conf
|
||||
}
|
||||
|
||||
userdb sql {
|
||||
# Path for SQL configuration file
|
||||
args = /etc/dovecot/dovecot-sql.conf
|
||||
}
|
||||
|
||||
# ... stuff after
|
||||
}
|
||||
|
||||
Make sure to activate only one backend (per type) inside your configuration
|
||||
(just comment the other ones).
|
||||
|
||||
For *MySQL* users, edit your */etc/dovecot/dovecot-sql.conf* and modify following lines::
|
||||
|
||||
driver = mysql
|
||||
connect = host=<mysqld socket> dbname=<database> user=<user> password=<password>
|
||||
default_pass_scheme = CRYPT
|
||||
password_query = SELECT email AS user, password FROM admin_user WHERE email='%u' and is_active=1
|
||||
user_query = SELECT concat(dom.name, '/', mb.path) AS home, uid, gid FROM admin_mailbox mb INNER JOIN admin_user user ON mb.user_id=user.id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE mb.address='%n' AND dom.name='%d' AND user.is_active=1 AND dom.enabled=1
|
||||
|
||||
Enable quota support
|
||||
====================
|
||||
|
||||
Put the following lines inside the *dovecot.conf* file::
|
||||
|
||||
protocol imap {
|
||||
mail_plugins = quota imap_quota
|
||||
}
|
||||
|
||||
Before continuing, you need to know which quota backend must be used
|
||||
(function of mailboxes format):
|
||||
|
||||
* mbox : backend=dirsize,
|
||||
* maildir : backend=maildir.
|
||||
|
||||
If you use version prior to 1.1, add also the following configuration::
|
||||
|
||||
plugin {
|
||||
# 10 MB default quota limit
|
||||
quota = <backend>:storage=10240
|
||||
}
|
||||
|
||||
For *MySQL* users, modify the above query inside *dovecot-sql.conf* as
|
||||
follow to activate per-user quotas::
|
||||
|
||||
user_query = SELECT concat(dom.name, '/', mb.path) AS home, uid, gid, concat('<backend>:storage=', mb.quota / 1024) AS quota FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE mb.address='%n' AND dom.name='%d'
|
||||
|
||||
For version >= 1.1, put the following configuration inside the *dovecot.conf* file::
|
||||
|
||||
plugin {
|
||||
# Default 10M storage limit with an extra 5M limit when saving to Trash.
|
||||
quota = <backend>:User quota
|
||||
quota_rule = *:storage=10M
|
||||
quota_rule2 = Trash:storage=5M
|
||||
}
|
||||
|
||||
For *MySQL* users, modify the above query inside *dovecot-sql.conf* to
|
||||
activate per-user quotas::
|
||||
|
||||
user_query = SELECT concat(dom.name, '/', mb.path) AS home, uid, gid, concat('*:storage=', mb.quota, 'M') AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE mb.address='%n' AND dom.name='%d'
|
||||
|
||||
Enable ManageSieve/Sieve support
|
||||
================================
|
||||
|
||||
.. note::
|
||||
The following configuration example should work with versions
|
||||
1.X. For versions >= 2, please refer to `Dovecot's wiki
|
||||
<http://wiki2.dovecot.org/>`_.
|
||||
|
||||
Edit the */etc/dovecot/dovecot.conf* file and make the following
|
||||
modifications:
|
||||
|
||||
* Add ``managesieve`` to the ``protocols`` variable::
|
||||
|
||||
protocols = imap imaps managesieve
|
||||
|
||||
* Uncomment the ``managesieve`` section::
|
||||
|
||||
protocol managesieve {
|
||||
# ...
|
||||
}
|
||||
|
||||
* Configure the ``lda`` protocol as follow::
|
||||
|
||||
protocol lda {
|
||||
postmaster_address = postmaster@<your domain>
|
||||
mail_plugins = sieve # + your other plugins
|
||||
# ...
|
||||
}
|
||||
|
||||
* In the ``plugin`` section, uncomment the following content::
|
||||
|
||||
plugin {
|
||||
# stuff before
|
||||
|
||||
# Location of the active script. When ManageSieve is used this is actually
|
||||
# a symlink pointing to the active script in the sieve storage directory.
|
||||
sieve=~/.dovecot.sieve
|
||||
|
||||
#
|
||||
# The path to the directory where the personal Sieve scripts are stored. For
|
||||
# ManageSieve this is where the uploaded scripts are stored.
|
||||
sieve_dir=~/sieve
|
||||
}
|
||||
|
||||
Restart *Dovecot*.
|
||||
|
||||
.. note::
|
||||
|
||||
If you're using *Postfix* as MTA, you have to use *Dovecot*'s local
|
||||
delivery agent otherwise your emails won't get filtered. See
|
||||
:ref:`dovecot_lda` to get information on how to activate it.
|
||||
@@ -1,162 +0,0 @@
|
||||
############
|
||||
SMTP servers
|
||||
############
|
||||
|
||||
.. _postfix:
|
||||
|
||||
*******
|
||||
Postfix
|
||||
*******
|
||||
|
||||
This section gives an example about building a simple virtual hosting
|
||||
configuration with *Postfix*. Refer to the `official documentation
|
||||
<http://www.postfix.org/VIRTUAL_README.html>`_ for more explanation.
|
||||
|
||||
Map files
|
||||
=========
|
||||
|
||||
You first need to create configuration files (or map files) that will
|
||||
be used by *postfix* to lookup into Modoboa tables.
|
||||
|
||||
Automatic generation
|
||||
--------------------
|
||||
|
||||
To automaticaly generate the requested map files and store them in a
|
||||
directory, run the following command::
|
||||
|
||||
$ modoboa-admin.py postfix_maps --dbtype <mysql|postgres> mapfiles
|
||||
|
||||
`mapfiles` is the directory where the files will be stored. Answer the
|
||||
few questions and you're done.
|
||||
|
||||
.. _manual_map_files:
|
||||
|
||||
Manual generation
|
||||
-----------------
|
||||
|
||||
.. note::
|
||||
|
||||
The SQL queries presented below are working only with MySQL
|
||||
only. To make them work with PostgreSQL, just replace (when needed)
|
||||
the `concat` function call by the standard concatenation operator
|
||||
(ie. `||`).
|
||||
|
||||
Define the following map files on your server (it should work with
|
||||
*postfix* versions >= 2.2):
|
||||
|
||||
``/etc/postfix/sql-domains.cf``::
|
||||
|
||||
user = <user>
|
||||
password = <password>
|
||||
dbname = <database>
|
||||
hosts = 127.0.0.1
|
||||
query = SELECT name FROM admin_domain WHERE name='%s' AND enabled=1
|
||||
|
||||
``/etc/postfix/sql-domain-aliases.cf``::
|
||||
|
||||
user = <user>
|
||||
password = <password>
|
||||
dbname = <database>
|
||||
hosts = 127.0.0.1
|
||||
query = SELECT dom.name FROM admin_domain dom INNER JOIN admin_domainalias domal ON dom.id=domal.target_id WHERE domal.name='%s' AND domal.enabled=1 AND dom.enabled=1
|
||||
|
||||
``/etc/postfix/sql-mailboxes.cf``::
|
||||
|
||||
user = <user>
|
||||
password = <password>
|
||||
dbname = <database>
|
||||
hosts = 127.0.0.1
|
||||
query = SELECT concat(dom.name, '/', mb.path, (SELECT value FROM lib_parameter WHERE name='admin.MAILDIR_ROOT'), '/') FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN admin_user user ON mb.user_id=user.id WHERE dom.enabled=1 AND dom.name='%d' AND user.is_active=1 AND mb.address='%u'
|
||||
|
||||
``/etc/postfix/sql-aliases.cf``::
|
||||
|
||||
user = <user>
|
||||
password = <password>
|
||||
dbname = <database>
|
||||
hosts = 127.0.0.1
|
||||
query = (SELECT concat(mb.address, '@', dom.name) FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE mb.id IN (SELECT al_mb.mailbox_id FROM admin_alias_mboxes al_mb INNER JOIN admin_alias al ON al_mb.alias_id=al.id INNER JOIN admin_domain dom ON al.domain_id=dom.id WHERE dom.name='%d' AND dom.enabled=1 AND al.address='%u' AND al.enabled=1)) UNION (SELECT al.extmboxes FROM admin_alias al INNER JOIN admin_domain dom ON al.domain_id=dom.id WHERE dom.name='%d' AND dom.enabled=1 AND al.address='%u' AND al.enabled=1 AND al.extmboxes<>'')
|
||||
|
||||
``/etc/postfix/sql-domain-aliases-mailboxes.cf``::
|
||||
|
||||
user = <user>
|
||||
password = <password>
|
||||
dbname = <database>
|
||||
hosts = 127.0.0.1
|
||||
query = SELECT DISTINCT concat(mb.address, '@', dom.name) FROM admin_alias al INNER JOIN admin_domain dom ON dom.id=al.domain_id INNER JOIN admin_domainalias domal ON domal.target_id=dom.id INNER JOIN (admin_alias_mboxes almb, admin_mailbox mb) ON (almb.alias_id=al.id AND almb.mailbox_id=mb.id) WHERE domal.name='%d' AND domal.enabled=1 AND (al.address='%u' OR mb.address='%u')
|
||||
|
||||
``/etc/postfix/sql-email2email.cf``::
|
||||
|
||||
user = <user>
|
||||
password = <password>
|
||||
dbname = <database>
|
||||
hosts = 127.0.0.1
|
||||
query = SELECT concat(mb.address, '@', dom.name) FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN admin_user user ON mb.user_id=user.id WHERE dom.name='%d' AND dom.enabled=1 AND mb.address='%u' AND user.is_active=1
|
||||
|
||||
``/etc/postfix/sql-catchall-aliases.cf``::
|
||||
|
||||
user = <user>
|
||||
password = <password>
|
||||
dbname = <database>
|
||||
hosts = 127.0.0.1
|
||||
query = (SELECT concat(mb.address, '@', dom.name) FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE mb.id IN (SELECT al_mb.mailbox_id FROM admin_alias al INNER JOIN admin_domain dom ON al.domain_id=dom.id INNER JOIN admin_alias_mboxes al_mb ON al.id=al_mb.alias_id WHERE al.enabled=1 AND al.address='*' AND dom.name='%d' AND dom.enabled=1)) UNION (SELECT al.extmboxes FROM admin_alias al INNER JOIN admin_domain dom ON al.domain_id=dom.id WHERE al.enabled='1' AND al.extmboxes<>'' AND al.address='*' AND dom.name='%d' AND dom.enabled=1)
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
Use the following configuration in the */etc/postfix/main.cf* file
|
||||
(this is just one possible configuration)::
|
||||
|
||||
# Stuff before
|
||||
mailbox_transport = virtual
|
||||
maildrop_destination_recipient_limit = 1
|
||||
virtual_minimum_uid = <vmail user id>
|
||||
virtual_gid_maps = static:<vmail group id>
|
||||
virtual_uid_maps = static:<vmail user id>
|
||||
virtual_mailbox_base = /var/vmail
|
||||
|
||||
relay_domains =
|
||||
virtual_mailbox_domains = mysql:/etc/postfix/sql-domains.cf
|
||||
virtual_alias_domains = mysql:/etc/postfix/sql-domain-aliases.cf
|
||||
virtual_mailbox_maps = mysql:/etc/postfix/sql-mailboxes.cf
|
||||
virtual_alias_maps = mysql:/etc/postfix/sql-aliases.cf,
|
||||
mysql:/etc/postfix/sql-domain-aliases-mailboxes.cf,
|
||||
mysql:/etc/postfix/sql-email2email.cf,
|
||||
mysql:/etc/postfix/sql-catchall-aliases.cf
|
||||
|
||||
# Stuff after
|
||||
|
||||
.. note::
|
||||
Modoboa supports both maildir and mbox formats. You can specify
|
||||
which format to use by modifying the MAILBOX_TYPE parameter available
|
||||
in the admin panel.
|
||||
|
||||
.. _dovecot_lda:
|
||||
|
||||
Recommended: using Dovecot's LDA
|
||||
================================
|
||||
|
||||
If you are using *Dovecot* in your environnement, we recommend to use
|
||||
its LDA. Doing so, you'll will be able to use extra functionalities
|
||||
such as sieve filters and more.
|
||||
|
||||
First, edit the */etc/postfix/main.cf* file and define (or modify if
|
||||
they already exist) the following parameters::
|
||||
|
||||
virtual_transport = dovecot
|
||||
dovecot_destination_recipient_limit = 1
|
||||
|
||||
Then, edit the */etc/postfix/master.cf* file and add the following
|
||||
definition at the end::
|
||||
|
||||
dovecot unix - n n - - pipe
|
||||
flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}
|
||||
|
||||
If you have followed the :ref:`manual_map_files` section to install your
|
||||
environnement, you need to modify the SQL query corresponding to the
|
||||
``virtual_mailbox_maps`` parameter. Edit the
|
||||
*/etc/postfix/maps/sql-mailboxes.cf* and modify the ``query``
|
||||
parameter as follow::
|
||||
|
||||
query = SELECT concat(dom.name, '/', mb.path) FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN admin_user user ON mb.user_id=user.id WHERE dom.enabled=1 AND dom.name='%d' AND user.is_active=1 AND mb.address='%u'
|
||||
|
||||
Restart *Postfix*.
|
||||
Reference in New Issue
Block a user