From 72dc443d3cfcc59190f1ad9957d9664ff671e85f Mon Sep 17 00:00:00 2001 From: Spitap Date: Thu, 25 May 2023 11:13:29 +0200 Subject: [PATCH 1/4] few changes --- doc/installation.rst | 5 +- doc/manual_installation/dovecot.rst | 61 +++-- doc/manual_installation/modoboa.rst | 24 +- doc/manual_installation/postfix.rst | 56 +++-- doc/manual_installation/webserver.rst | 337 ++++++++++++++------------ 5 files changed, 285 insertions(+), 198 deletions(-) diff --git a/doc/installation.rst b/doc/installation.rst index 38577a051..1bb981222 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -10,6 +10,7 @@ You will need a Server to perform well with at least: * RAM: 2GB * Disk: 10GB * Python 3.8+ +* Postgres 12+ or MariaDB 10.4+ or MySQL 8+ or sqlite3 or LDAP .. note:: **👀 Heads up for modoboa versions 1.15 and later** @@ -17,6 +18,8 @@ You will need a Server to perform well with at least: If you still have Python 2 installed on your system either uninstall it or force modoboa user to run with Python 3. +If you want to run virus scan on your server you will need **4GB** of RAM. + Recommended way =============== @@ -28,7 +31,7 @@ postfix, dovecot, amavis and more) on one machine. .. warning:: - For now, only Debian and CentOS based Linux distributions are + For now, only Debian based Linux distributions are supported. We do our best to improve compatibility but if you use another Linux or a UNIX system, you will have to install Modoboa :ref:`manually `. diff --git a/doc/manual_installation/dovecot.rst b/doc/manual_installation/dovecot.rst index d9e8fa961..7c7a1eb1c 100644 --- a/doc/manual_installation/dovecot.rst +++ b/doc/manual_installation/dovecot.rst @@ -10,6 +10,17 @@ suitable for this combination. In this section, we assume dovecot's configuration resides in :file:`/etc/dovecot`, all pathes will be relative to this directory. +You can find configuration documentation `here `_. + +This proposed configuration is the one you can find with modoboa-installer. For up to date configuration, `take a look here `_ + +Packages +======== + +For debian and derivative, recommended packages are:: + + apt install dovecot-imapd dovecot-lmtpd dovecot-managesieved dovecot-sieve + Mailboxes ========= @@ -17,12 +28,14 @@ First, edit the :file:`conf.d/10-mail.conf` and set the ``mail_location`` variable:: # maildir - mail_location = maildir:~/.maildir + mail_location = maildir:~/Maildir -Then, edit the ``inbox`` namespace and add the following lines:: +Then, edit the ``inbox`` namespace and add the following line:: inbox = yes +In order for dovecot to automaticaly create ususal folder on account creation, edit the ``inbox`` namespace of :file:`15-mailboxes.conf`:: + mailbox Drafts { auto = subscribe special_use = \Drafts @@ -40,6 +53,14 @@ Then, edit the ``inbox`` namespace and add the following lines:: special_use = \Trash } +Starting dovecot 2.2.20+, you can add ``autoexpunge`` parameter to delete older message, for instance:: + + mailbox Trash { + auto = subscribe + special_use = \Trash + autoexpunge=30d + } + With dovecot 2.1+, it ensures all the special mailboxes will be automaticaly created for new accounts. @@ -79,11 +100,11 @@ executed (see :ref:`Postfix configuration `). Edit the crontab of the user who owns the mailboxes on the file system:: - $ crontab -u -e + $ crontab -u -e And add the following line inside:: - * * * * * python /manage.py handle_mailbox_operations + * * * * * python /manage.py handle_mailbox_operations .. warning:: @@ -139,6 +160,9 @@ to your database engine. MySQL users ----------- +For debian and derivative, you need to install mysql connector for dovecot:: + sudo apt install dovecot-mysql + :: driver = mysql @@ -169,6 +193,9 @@ MySQL users PostgreSQL users ---------------- +For debian and derivative, you need to install postgres connector for dovecot:: + sudo apt install dovecot-pgsql + :: driver = pgsql @@ -197,6 +224,9 @@ PostgreSQL users SQLite users ------------ +For debian and derivative, you need to install sqlite connector for dovecot:: + sudo apt install dovecot-sqlite + :: driver = sqlite @@ -233,12 +263,12 @@ You should comment the userdb section, which will be managed by SQL with modoboa args = /etc/dovecot/dovecot-ldap.conf.ext } - #userdb { - #driver = ldap - #args = /etc/dovecot/dovecot-ldap.conf.ext - + #userdb { + #driver = ldap + #args = /etc/dovecot/dovecot-ldap.conf.ext + # Default fields can be used to specify defaults that LDAP may override - #default_fields = home=/home/virtual/%u + #default_fields = home=/home/virtual/%u #} Your own dovecot LDAP configuration file is now :file:`/etc/dovecot/dovecot-ldap.conf.ext`. @@ -249,7 +279,7 @@ Synchronize dovecot LDAP conf with modoboa LDAP conf To make dovecot LDAP configuration synchronized with modoboa LDAP configuration, you should create a dedicated dovecot conf file. At the end of your dovecot configuration file (:file:`dovecot-ldap.conf.ext`), add the following line:: - + !include_try dovecot-modoboa.conf.ext Then, set modoboa parameter *Enable Dovecot LDAP sync* to *Yes*. @@ -401,7 +431,7 @@ execute the following commands:: $ su - postgres $ psql [modoboa database] < /path/to/modoboa_postgres_trigger.sql $ exit - + Replace ``[modoboa database]`` by the appropriate value. Forcing recalculation @@ -438,15 +468,6 @@ uncommented:: # ... } -Messages filtering using Sieve is done by the LDA. - -Inside :file:`conf.d/15-lda.conf`, activate the ``sieve`` plugin like this:: - - protocol lda { - # Space separated list of plugins to load (default is global mail_plugins). - mail_plugins = $mail_plugins sieve - } - Finally, configure the ``sieve`` plugin by editing the :file:`conf.d/90-sieve.conf` file. Put the follwing caontent inside:: diff --git a/doc/manual_installation/modoboa.rst b/doc/manual_installation/modoboa.rst index 287d3926f..239196fef 100644 --- a/doc/manual_installation/modoboa.rst +++ b/doc/manual_installation/modoboa.rst @@ -7,6 +7,9 @@ Modoboa This section describes the installation of the web interface (a `Django `_ project). +This proposed configuration is the one you can find with modoboa-installer. For up to date configuration, `take a look here `_ + + Prepare the system ------------------ @@ -25,7 +28,7 @@ distributions using `virtualenv `_: # apt-get install virtualenv python3-pip # useradd modoboa # create a dedicated user - # su -l modoboa # log in as the newly created user + # sudo -u modoboa -i bash # log in as the newly created user $ virtualenv --python python3 ./env # create the virtual environment $ source ./env/bin/activate # activate the virtual environment @@ -40,6 +43,7 @@ following system packages according to your distribution: | libxml2-dev libxslt-dev | | libjpeg-dev librrd-dev | | rrdtool libffi-dev libssl-dev | +| pkg-config libcairo2-dev | +-------------------------------+ +-----------------------------+ @@ -99,13 +103,15 @@ Install the corresponding Python binding: .. code-block:: console - (env)$ pip install psycopg2 + (env)$ pip install psycopg[binary]>=3.1 .. note:: Alternatively, you can install the ``python3-psycopg2`` package instead on Debian-based distributions if your virtual environment was created with ``--system-site-packages`` option. + Note that psycopg 3.1 is required starting with modoboa 2.2.0 and + ubuntu and debian packages are too old for now. Then, create a user and a database. For example, to create the ``modoboa`` database owned by a ``modoboa`` user, run the following commands on your @@ -169,7 +175,8 @@ you just have to run the following command: If you choose to install extensions one at a time, you will have to add their names in settings.py to ``MODOBOA_APPS``. Also ensure that you have the line ``from modoboa_amavis.settings import *`` at the - end of this file. + end of this file and possibly perform more steps. Check the manuall + of each extensions for specific Instructions. The list of available extensions can be found on the :doc:`index page <../index>`. Instructions to install them are available on @@ -226,15 +233,15 @@ following content inside: INSTANCE= # Operations on mailboxes - * * * * * vmail $PYTHON $INSTANCE/manage.py handle_mailbox_operations + * * * * * $PYTHON $INSTANCE/manage.py handle_mailbox_operations # Generate DKIM keys (they will belong to the user running this job) * * * * * root umask 077 && $PYTHON $INSTANCE/manage.py modo manage_dkim_keys # Sessions table cleanup - 0 0 * * * modoboa $PYTHON $INSTANCE/manage.py clearsessions + 0 0 * * * root $PYTHON $INSTANCE/manage.py clearsessions # Logs table cleanup - 0 0 * * * modoboa $PYTHON $INSTANCE/manage.py cleanlogs + 0 0 * * * root $PYTHON $INSTANCE/manage.py cleanlogs # Logs parsing */15 * * * * root $PYTHON $INSTANCE/manage.py logparser &> /dev/null 0 * * * * modoboa $PYTHON $INSTANCE/manage.py update_statistics @@ -271,14 +278,13 @@ You can launch it manually using the following command: But we recommend an automatic start using ``systemd`` or ``supervisor``. Here is a configuration example for ``supervisor``: - .. sourcecode:: ini [program:policyd] autostart=true autorestart=true - command=/srv/modoboa/env/bin/python /srv/modoboa/instance/manage.py policy_daemon - directory=/srv/modoboa + command= /manage.py policy_daemon + directory= redirect_stderr=true user=modoboa numprocs=1 diff --git a/doc/manual_installation/postfix.rst b/doc/manual_installation/postfix.rst index 4d9d7e9ea..f9bf3a0e3 100644 --- a/doc/manual_installation/postfix.rst +++ b/doc/manual_installation/postfix.rst @@ -30,35 +30,57 @@ stored. Answer the few questions and you're done. Configuration ============= -Use the following configuration in the :file:`/etc/postfix/main.cf` file +Use the following configuration in the :file:`/etc/postfix/main.cf` file. For TLS configuration, you can look at the +`used configuration `_ +for `modoboa installer `_. (this is just one possible configuration):: # Stuff before + unknown_local_recipient_reject_code = 550 + unverified_recipient_reject_code = 550 + + # appending .domain is the MUA's job. + append_dot_mydomain = no + + ## Proxy maps + proxy_read_maps = + proxy:unix:passwd.byname + proxy::/etc/postfix/sql-domains.cf + proxy::/etc/postfix/sql-domain-aliases.cf + proxy::/etc/postfix/sql-aliases.cf + proxy::/etc/postfix/sql-relaydomains.cf + proxy::/etc/postfix/sql-maintain.cf + proxy::/etc/postfix/sql-relay-recipient-verification.cf + proxy::/etc/postfix/sql-sender-login-map.cf + proxy::/etc/postfix/sql-spliteddomains-transport.cf + proxy::/etc/postfix/sql-transport.cf + + ## Virtual transport settings virtual_transport = lmtp:unix:private/dovecot-lmtp - virtual_mailbox_domains = :/etc/postfix/sql-domains.cf - virtual_alias_domains = :/etc/postfix/sql-domain-aliases.cf - virtual_alias_maps = :/etc/postfix/sql-aliases.cf + virtual_mailbox_domains = proxy::/etc/postfix/sql-domains.cf + virtual_alias_domains = proxy::/etc/postfix/sql-domain-aliases.cf + virtual_alias_maps = proxy::/etc/postfix/sql-aliases.cf - relay_domains = :/etc/postfix/sql-relaydomains.cf + ## Relay domains + relay_domains = proxy::/etc/postfix/sql-relaydomains.cf transport_maps = - :/etc/postfix/sql-transport.cf - :/etc/postfix/sql-spliteddomains-transport.cf + proxy::/etc/postfix/sql-transport.cf + proxy::/etc/postfix/sql-spliteddomains-transport.cf smtpd_recipient_restrictions = - # ... - check_recipient_access - :/etc/postfix/sql-maintain.cf - :/etc/postfix/sql-relay-recipient-verification.cf permit_mynetworks - reject_unauth_destination + permit_sasl_authenticated + check_recipient_access + proxy::/etc/postfix/sql-maintain.cf + proxy::/etc/postfix/sql-relay-recipient-verification.cf reject_unverified_recipient - # ... + reject_unauth_destination + reject_non_fqdn_sender + reject_non_fqdn_recipient + reject_non_fqdn_helo_hostname - smtpd_sender_login_maps = :/etc/postfix/sql-sender-login-map.cf - - smtpd_sender_restrictions = - reject_sender_login_mismatch + smtpd_sender_login_maps = proxy::/etc/postfix/sql-sender-login-map.cf # Stuff after diff --git a/doc/manual_installation/webserver.rst b/doc/manual_installation/webserver.rst index 68011505b..c885964fb 100644 --- a/doc/manual_installation/webserver.rst +++ b/doc/manual_installation/webserver.rst @@ -23,39 +23,56 @@ First, make sure that ``mod_wsgi`` is installed on your server. Create a new virtualhost in your Apache configuration and put the following content inside:: + WSGIPythonHome /var/www/modoboa/env + WSGIPythonPath /var/www/modoboa/instance + ServerName - DocumentRoot + + DocumentRoot Alias /media/ /media/ - /media> - Order deny,allow - Allow from all + /media/> + Options FollowSymLinks + Require all granted Alias /sitestatic/ /sitestatic/ - /sitestatic> - Order deny,allow - Allow from all + /sitestatic/> + Options FollowSymLinks + Require all granted - WSGIScriptAlias / //wsgi.py + Alias /new-admin /frontend + /frontend> + Options FollowSymLinks + Require all granted + + + WSGIScriptAlias / /instance/wsgi.py + WSGIApplicationGroup %{GLOBAL} # Pass Authorization header to enable API usage: WSGIPassAuthorization On + + LogLevel info This is just one possible configuration. -To use mod_wsgi daemon mode, add the two following directives just -under ``WSGIScriptAlias``:: - - WSGIDaemonProcess example.com python-path=:/lib/python3.7/site-packages - WSGIProcessGroup example.com - Replace values between ``<>`` with yours. If you don't use a `virtualenv `_, just remove the last part of the ``WSGIDaemonProcess`` directive. +.. note:: + + You may need to add:: + import sys + + sys.path.append('') + sys.path.append('/bin') + sys.path.append('/lib/python3.X/site-packages') + + in :file:`/instance/wsgi.py`. .. note:: @@ -77,6 +94,161 @@ the one you prefer between `Green Unicorn `_ or In both cases, you'll need to download and `install nginx `_. +uWSGI ++++++ + +The following setup is meant to get you started quickly. You should +read the documentation of both nginx and uwsgi to understand how to +optimize their configuration for your site. + +The Django documentation includes the following warning regarding +uwsgi: + +.. warning:: + + Use uwsgi 1.2.6 or newer. If you do not, you *will* run into + problems. Modoboa will fail in obscure ways. + +To use this setup, first `download and install uwsgi +`_. + +Recommend packages for debian and derivatives:: + + apt install uwsgi uwsgi-plugin-python3 + +Here is a sample nginx configuration:: + upstream modoboa { + server unix: fail_timeout=0; + } + + server { + listen 80; + listen [::]:80; + server_name ; + rewrite ^ https://$server_name$request_uri? permanent; + } + + server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name ; + root ; + + ssl_certificate ; + ssl_certificate_key ; + ssl_protocols TLSv1.2 TLSv1.3; + ssl_ciphers "ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384"; + ssl_prefer_server_ciphers on; + ssl_session_cache shared:SSL:10m; + ssl_verify_depth 3; + ssl_dhparam /etc/nginx/dhparam.pem; + + client_max_body_size 10M; + + access_log /var/log/nginx/modoboa-access.log; + error_log /var/log/nginx/modoboa-error.log; + + location /sitestatic/ { + try_files $uri $uri/ =404; + } + + location /media/ { + try_files $uri $uri/ =404; + } + + location ^~ /new-admin { + alias /frontend/; + index index.html; + + expires -1; + add_header Pragma "no-cache"; + add_header Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"; + + try_files $uri $uri/ /index.html = 404; + } + + location / { + include uwsgi_params; + uwsgi_param UWSGI_SCRIPT instance.wsgi:application; + uwsgi_pass modoboa; + } + %{extra_config} + } + +````, ````, ```` and ```` must be replaced by the value you used. +```` + + +when :ref:`you deployed your instance `. + +If you do not plan to use SSL then change the listen directive to +``listen 80;`` and delete each of the following directives:: + + ssl on; + keepalive_timeout 70; + ssl_certificate ; + ssl_certificate_key ; + uwsgi_param UWSGI_SCHEME https; + +If you do plan to use SSL, you'll have to generate a certificate and a +key. `This article +`_ +contains information about how to do it. + +Make sure to replace the ``<...>`` in the sample configuration with +appropriate values. Here are some explanations for the cases that may +not be completely self-explanatory: + +```` + This is the URL which will be the root of your Modoboa site at your + domain. For instance, if your Modoboa installation is reachable at + at ``https://foo/modoboa`` then ```` is + ``/modoboa``. In this case you probably also have to set the + ``alias`` directives to point to where Modoboa's sitestatic and + media directories are because otherwise nginx won't be able to find + them. + + If Modoboa is at the root of your domain, then ```` + is an empty string and can be deleted from the configuration + above. In this case, you probably do not need the ``alias`` + directives. + +```` + The location where uwsig is listening. It could be a unix domain + socket or an address:port combination. Ubuntu configures uwsgi so + that the port is:: + + unix:/run/uwsgi/app//socket + + where ```` is the name of the application. + +Your uwsgi configuration should be:: + + [uwsgi] + # Not needed when using uwsgi from pip + # plugins = python + chdir = + module = .wsgi:application + master = true + harakiri = 60 + processes = 4 + vhost = true + no-default-app = true + +The plugins directive should be turned on if you use a uwsgi +installation that requires it. If uwsgi was installed from pip, it +does not require it. In the configuration above: + +```` + The directory where :file:`manage.py` resides. This directory is the + parent of ```` + +```` + The name that you passed to ``modoboa-admin.py deploy`` when you + created your Modoboa instance, usually ``instance``. + +Now, you can go the :ref:`dovecot` section to continue the installation. + Green Unicorn +++++++++++++ @@ -155,140 +327,3 @@ Paste this content to your configuration (replace values between ``<>`` with yours) and restart nginx. Now, you can go the :ref:`dovecot` section to continue the installation. - -uWSGI -+++++ - -The following setup is meant to get you started quickly. You should -read the documentation of both nginx and uwsgi to understand how to -optimize their configuration for your site. - -The Django documentation includes the following warning regarding -uwsgi: - -.. warning:: - - Use uwsgi 1.2.6 or newer. If you do not, you *will* run into - problems. Modoboa will fail in obscure ways. - -To use this setup, first `download and install uwsgi -`_. - -Here is a sample nginx configuration:: - - server { - listen 443 ssl; - ssl on; - keepalive_timeout 70; - - server_name ; - root ; - - ssl_certificate ; - ssl_certificate_key ; - - access_log /var/log/nginx/.access.log; - error_log /var/log/nginx/.error.log; - - location /sitestatic/ { - autoindex on; - alias ; - } - - # Whether or not Modoboa uses a media directory depends on how - # you configured Modoboa. It does not hurt to have this. - location /media/ { - autoindex on; - alias ; - } - - # This denies access to any file that begins with - # ".ht". Apache's .htaccess and .htpasswd are such files. A - # Modoboa installed from scratch would not contain any such - # files, but you never know what the future holds. - location ~ /\.ht { - deny all; - } - - location / { - include uwsgi_params; - uwsgi_pass ; - uwsgi_param UWSGI_SCRIPT .wsgi:application; - uwsgi_param UWSGI_SCHEME https; - } - } - -```` must be replaced by the value you used -when :ref:`you deployed your instance `. - -If you do not plan to use SSL then change the listen directive to -``listen 80;`` and delete each of the following directives:: - - ssl on; - keepalive_timeout 70; - ssl_certificate ; - ssl_certificate_key ; - uwsgi_param UWSGI_SCHEME https; - -If you do plan to use SSL, you'll have to generate a certificate and a -key. `This article -`_ -contains information about how to do it. - -Make sure to replace the ``<...>`` in the sample configuration with -appropriate values. Here are some explanations for the cases that may -not be completely self-explanatory: - -```` - Where Modoboa's :file:`settings.py` resides. This is also where the - :file:`sitestatic` and :file:`media` directories reside. - -```` - This is the URL which will be the root of your Modoboa site at your - domain. For instance, if your Modoboa installation is reachable at - at ``https://foo/modoboa`` then ```` is - ``/modoboa``. In this case you probably also have to set the - ``alias`` directives to point to where Modoboa's sitestatic and - media directories are because otherwise nginx won't be able to find - them. - - If Modoboa is at the root of your domain, then ```` is an empty string and can be deleted from the configuration - above. In this case, you probably do not need the ``alias`` - directives. - -```` - The location where uwsig is listening. It could be a unix domain - socket or an address:port combination. Ubuntu configures uwsgi so - that the port is:: - - unix:/run/uwsgi/app//socket - - where ```` is the name of the application. - -Your uwsgi configuration should be:: - - [uwsgi] - # Not needed when using uwsgi from pip - # plugins = python - chdir = - module = .wsgi:application - master = true - harakiri = 60 - processes = 4 - vhost = true - no-default-app = true - -The plugins directive should be turned on if you use a uwsgi -installation that requires it. If uwsgi was installed from pip, it -does not require it. In the configuration above: - -```` - The directory where :file:`manage.py` resides. This directory is the - parent of ```` - -```` - The name that you passed to ``modoboa-admin.py deploy`` when you - created your Modoboa instance. - -Now, you can go the :ref:`dovecot` section to continue the installation. From 244b03bf36868001f8f0303bf19d3a2662989010 Mon Sep 17 00:00:00 2001 From: Spitap Date: Fri, 4 Aug 2023 21:39:54 +0200 Subject: [PATCH 2/4] Few fixes, updated with send-only --- doc/manual_installation/dovecot.rst | 2 +- doc/manual_installation/modoboa.rst | 14 ++++++-------- doc/manual_installation/webserver.rst | 3 ++- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/manual_installation/dovecot.rst b/doc/manual_installation/dovecot.rst index 7c7a1eb1c..f0e5a8227 100644 --- a/doc/manual_installation/dovecot.rst +++ b/doc/manual_installation/dovecot.rst @@ -34,7 +34,7 @@ Then, edit the ``inbox`` namespace and add the following line:: inbox = yes -In order for dovecot to automaticaly create ususal folder on account creation, edit the ``inbox`` namespace of :file:`15-mailboxes.conf`:: +In order for dovecot to automaticaly create usual folders on account creation, edit the ``inbox`` namespace of :file:`15-mailboxes.conf`:: mailbox Drafts { auto = subscribe diff --git a/doc/manual_installation/modoboa.rst b/doc/manual_installation/modoboa.rst index 239196fef..66b1df231 100644 --- a/doc/manual_installation/modoboa.rst +++ b/doc/manual_installation/modoboa.rst @@ -106,12 +106,10 @@ Install the corresponding Python binding: (env)$ pip install psycopg[binary]>=3.1 .. note:: - - Alternatively, you can install the ``python3-psycopg2`` package instead on - Debian-based distributions if your virtual environment was created with - ``--system-site-packages`` option. - Note that psycopg 3.1 is required starting with modoboa 2.2.0 and - ubuntu and debian packages are too old for now. + Ubuntu and Debian repositories contain python-psycopgX package + but starting modoboa 2.2.0 minimum version required is 3.1 and + it has not yet it these distro yet + Prior modoboa version can run with ``python3-psycopg2``. Then, create a user and a database. For example, to create the ``modoboa`` database owned by a ``modoboa`` user, run the following commands on your @@ -175,8 +173,8 @@ you just have to run the following command: If you choose to install extensions one at a time, you will have to add their names in settings.py to ``MODOBOA_APPS``. Also ensure that you have the line ``from modoboa_amavis.settings import *`` at the - end of this file and possibly perform more steps. Check the manuall - of each extensions for specific Instructions. + end of this file and possibly perform more steps. Check the + documentation/readme of each extensions for specific Instructions. The list of available extensions can be found on the :doc:`index page <../index>`. Instructions to install them are available on diff --git a/doc/manual_installation/webserver.rst b/doc/manual_installation/webserver.rst index c885964fb..7badb4f2c 100644 --- a/doc/manual_installation/webserver.rst +++ b/doc/manual_installation/webserver.rst @@ -117,6 +117,7 @@ Recommend packages for debian and derivatives:: apt install uwsgi uwsgi-plugin-python3 Here is a sample nginx configuration:: + upstream modoboa { server unix: fail_timeout=0; } @@ -208,7 +209,7 @@ not be completely self-explanatory: media directories are because otherwise nginx won't be able to find them. - If Modoboa is at the root of your domain, then ```` + If Modoboa is at the root of your domain, then ```` is an empty string and can be deleted from the configuration above. In this case, you probably do not need the ``alias`` directives. From 2c4d32217a6e395afe272a3a3fdaaaa449f00da1 Mon Sep 17 00:00:00 2001 From: Spitap Date: Mon, 28 Aug 2023 14:48:44 +0200 Subject: [PATCH 3/4] Modified theme for readthedoc --- doc/conf.py | 6 +++--- doc/requirements.txt | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index e102bf7ae..10b565e31 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -61,9 +61,9 @@ copyright = "2023, Antoine Nguyen" # NOQA:A001 # built documents. # # The short X.Y version. -version = "1.10" +version = "2.2.0" # The full version, including alpha/beta/rc tags. -release = "1.10.0" +release = "2.2.0" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -107,7 +107,7 @@ pygments_style = "sphinx" on_rtd = os.environ.get("READTHEDOCS", None) == "True" if on_rtd: - html_theme = "default" + html_theme = "sphinx_rtd_theme" else: html_theme = "nature" diff --git a/doc/requirements.txt b/doc/requirements.txt index 50ab59091..93c90e2cb 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1 +1,2 @@ docutils<0.21 +sphinx_rtd_theme From 08f9251eda011416bf84743f626c6b927239794a Mon Sep 17 00:00:00 2001 From: Antoine Nguyen Date: Mon, 28 Aug 2023 16:01:13 +0200 Subject: [PATCH 4/4] Fixed syntax issue --- doc/upgrade.rst | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/doc/upgrade.rst b/doc/upgrade.rst index d6e11e836..f3dbed168 100644 --- a/doc/upgrade.rst +++ b/doc/upgrade.rst @@ -206,33 +206,29 @@ Send-only mailboxes do not have access to IMAP. You need to change your dovecot configuration to enable it. .. note:: + modoboa-webmail may not work with send-only user for now. If you use ``Postgres``: -Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql.conf.ext``: +Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql.conf.ext``:: -.. sourcecode:: + user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, '*:bytes=' || mb.quota || 'M' AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d' - user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, '*:bytes=' || mb.quota || 'M' AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d' - - password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3')) AND email='%%u' AND is_active AND dom.enabled + password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3')) AND email='%%u' AND is_active AND dom.enabled You basically simply need to add ``(mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND`` for ``user_query`` after ``WHERE`` and ``(mb.is_send_only IS NOT TRUE OR '%s' NOT IN ('imap', 'pop3')) AND`` for ``password_query`` after ``WHERE``. If you use ``MySQL``: -Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql-master.ext``: +Change ``user_query`` and ``password_query`` in ``/etc/dovecot/dovecot-sql-master.ext``:: -.. sourcecode:: + user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, CONCAT('*:bytes=', mb.quota, 'M') AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d' - user_query = SELECT '%{home_dir}/%%d/%%n' AS home, %mailboxes_owner_uid as uid, %mailboxes_owner_gid as gid, CONCAT('*:bytes=', mb.quota, 'M') AS quota_rule FROM admin_mailbox mb INNER JOIN admin_domain dom ON mb.domain_id=dom.id INNER JOIN core_user u ON u.id=mb.user_id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND mb.address='%%n' AND dom.name='%%d' - - password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3')) AND u.email='%%u' AND u.is_active=1 AND dom.enabled=1 + password_query = SELECT email AS user, password, '%{home_dir}/%%d/%%n' AS userdb_home, %mailboxes_owner_uid AS userdb_uid, %mailboxes_owner_gid AS userdb_gid, CONCAT('*:bytes=', mb.quota, 'M') AS userdb_quota_rule FROM core_user u INNER JOIN admin_mailbox mb ON u.id=mb.user_id INNER JOIN admin_domain dom ON mb.domain_id=dom.id WHERE (mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3')) AND u.email='%%u' AND u.is_active=1 AND dom.enabled=1 You basically simply need to add ``(mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3', 'lmtp')) AND`` for ``user_query`` after ``WHERE`` and ``(mb.is_send_only=0 OR '%s' NOT IN ('imap', 'pop3'))`` for ``password_query`` after ``WHERE``. - 2.1.0 =====