Sync iRedMail upgrade tutorials for 0.9.9.

This commit is contained in:
Zhang Huangbin 2018-05-23 12:59:41 +08:00
parent c0429877b1
commit 8a5a19c7bd
4 changed files with 454 additions and 1 deletions

View File

@ -309,6 +309,7 @@ Notes:
`password` | Password| `password=AsTr0ng@`
`language` | Preferred language of iRedAdmin web UI | `language=en_US`
`quota` | Mailbox quota (in MB) | `quota=1024`
`mailbox_format` | Mailbox format. e.g. `maildir`, `mdbox`. Defaults to `maildir` if not present. For more details, please read Dovecot document: <https://wiki2.dovecot.org/MailboxFormat> | `mailbox_format=mdbox`
</div>

View File

@ -64,3 +64,234 @@ Please run commands below to fix incorrect file owner/group and permission:
chown mlmmj:mlmmj /opt/mlmmjadmin/settings.py
chmod 0400 /opt/mlmmjadmin/settings.py
```
## OpenLDAP special
### Update iRedMail LDAP schema file
iRedMail-0.9.9 introduces 1 new LDAP attribute for mail user account:
* `mailboxFormat`: used to store mailbox format. All formats supported by
Dovecot are ok. for example, `maildir`, `mdbox`. For more details, please
check Dovecot document here: <https://wiki2.dovecot.org/MailboxFormat>
!!! warning
If you use different mailbox format, you need to set mailbox format to the
one you're using.
Download the latest iRedMail LDAP schema file
* On RHEL/CentOS:
```
cd /tmp
wget https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /etc/openldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /etc/openldap/schema/
service slapd restart
```
* On Debian/Ubuntu:
```
cd /tmp
wget https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /etc/ldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /etc/ldap/schema/
service slapd restart
```
* On FreeBSD:
```
cd /tmp
wget https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /usr/local/etc/openldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /usr/local/etc/openldap/schema/
service slapd restart
```
* On OpenBSD:
> Note: if you're running ldapd as LDAP server, the schema directory is
> `/etc/ldap`, and service name is `ldapd`.
```
cd /tmp
ftp https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /etc/openldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /etc/openldap/schema/
rcctl restart slapd
```
### Dovecot: read mailbox format from LDAP
Please open file `/etc/dovecot/dovecot-ldap.conf` (Linux/OpenBSD) or
`/usr/local/etc/dovecot/dovecot-ldap.conf` (FreeBSD), find the `user_attrs =`
line like below:
```
user_attrs = mail=master_user,mail=user,homeDirectory=home,=mail=maildir:~/Maildir/,mailQuota=quota_rule=*:bytes=%$
```
Please replace `maildir:` by `${ldap:mailboxFormat:maildir}`. After modified,
it looks like below:
```
user_attrs = mail=master_user,mail=user,homeDirectory=home,=mail=${ldap:mailboxFormat:maildir}:~/Maildir/,mailQuota=quota_rule=*:bytes=%$
```
If attribute `mailboxFormat` doesn't present in user object, Dovecot will use
string `maildir` as default value.
## MySQL/MariaDB special
### SQL structure changes in `vmail` database
We've made some changes to `vmail` database:
* New SQL column `mailbox.mailboxformat`: used to store mailbox format.
All formats supported by Dovecot are ok. for example, `maildir`, `mdbox`.
__Default value is `maildir`.__
For more details, please check Dovecot document here:
<https://wiki2.dovecot.org/MailboxFormat>
!!! warning
If you use different mailbox format, you need to set mailbox format to the
one you're using.
Download SQL template file used to update SQL database:
```
cd /root/
wget https://bitbucket.org/zhb/iredmail/raw/default/extra/update/0.9.9/iredmail.pgsql
```
Connect to PostgreSQL server as `postgres` user and import the SQL file:
* on Linux, it's `postgres` user
* on FreeBSD, it's `pgsql` user
* on OpenBSD, it's `_postgresql` user
```
mysql vmail < /root/iredmail.pgsql
```
### Dovecot: read mailbox format from SQL
Please open file `/etc/dovecot/dovecot-mysql.conf` (Linux/OpenBSD) or
`/usr/local/etc/dovecot/dovecot-mysql.conf` (FreeBSD), find the `user_attrs =`
line like below:
```
user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
...
```
Add a new `CONCAT` line after above `CONCAT()` line:
```
user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \
...
```
## PostgreSQL special
### SQL structure changes in `vmail` database
We've made some changes to `vmail` database:
* New SQL column `mailbox.mailboxformat`: used to store mailbox format.
All formats supported by Dovecot are ok. for example, `maildir`, `mdbox`.
__Default value is `maildir`.__
For more details, please check Dovecot document here:
<https://wiki2.dovecot.org/MailboxFormat>
!!! warning
If you use different mailbox format, you need to set mailbox format to the
one you're using.
Download SQL template file used to update SQL database:
```
cd /root/
wget https://bitbucket.org/zhb/iredmail/raw/default/extra/update/0.9.9/iredmail.mysql
```
* Run shell commands as root user below to connect to PostgreSQL server:
```
# su - postgres
$ psql -d vmail
sql> \i /tmp/mysql.pgsql
```
### Dovecot: read mailbox format from SQL
Please open file `/etc/dovecot/dovecot-pgsql.conf` (Linux/OpenBSD) or
`/usr/local/etc/dovecot/dovecot-pgsql.conf` (FreeBSD), then
#### PostgreSQL 8.x
If you're running __PostgreSQL 8.x__, you can find the `user_attrs =` line like
below:
```
user_query = SELECT \
mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS home, \
...
```
Please Add a line after above line:
```
user_query = SELECT \
mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS home, \
mailbox.mailboxformat || ':' || mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS mail, \
...
```
Restart Dovecot service is required.
#### PostgreSQL 9.x and later releases
If you're running __PostgreSQL 9.x__ and later releases, you can find the
`user_attrs =` line like below:
```
user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
...
```
Add a new `CONCAT` line after above `CONCAT()` line:
```
user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \
...
```
Restart Dovecot service is required.

View File

@ -880,6 +880,11 @@ to be a domain admin.</p>
<td>Mailbox quota (in MB)</td>
<td><code>quota=1024</code></td>
</tr>
<tr>
<td><code>mailbox_format</code></td>
<td>Mailbox format. e.g. <code>maildir</code>, <code>mdbox</code>. Defaults to <code>maildir</code> if not present. For more details, please read Dovecot document: <a href="https://wiki2.dovecot.org/MailboxFormat">https://wiki2.dovecot.org/MailboxFormat</a></td>
<td><code>mailbox_format=mdbox</code></td>
</tr>
</tbody>
</table>
</div>

View File

@ -28,6 +28,25 @@
<li><a href="#fix-incorrect-file-ownergroup-of-mlmmjadmin-config-file">Fix incorrect file owner/group of mlmmjadmin config file</a></li>
</ul>
</li>
<li><a href="#openldap-special">OpenLDAP special</a><ul>
<li><a href="#update-iredmail-ldap-schema-file">Update iRedMail LDAP schema file</a></li>
<li><a href="#dovecot-read-mailbox-format-from-ldap">Dovecot: read mailbox format from LDAP</a></li>
</ul>
</li>
<li><a href="#mysqlmariadb-special">MySQL/MariaDB special</a><ul>
<li><a href="#sql-structure-changes-in-vmail-database">SQL structure changes in vmail database</a></li>
<li><a href="#dovecot-read-mailbox-format-from-sql">Dovecot: read mailbox format from SQL</a></li>
</ul>
</li>
<li><a href="#postgresql-special">PostgreSQL special</a><ul>
<li><a href="#sql-structure-changes-in-vmail-database_1">SQL structure changes in vmail database</a></li>
<li><a href="#dovecot-read-mailbox-format-from-sql_1">Dovecot: read mailbox format from SQL</a><ul>
<li><a href="#postgresql-8x">PostgreSQL 8.x</a></li>
<li><a href="#postgresql-9x-and-later-releases">PostgreSQL 9.x and later releases</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
@ -81,7 +100,204 @@ latest stable release immediately:</p>
<p>Please run commands below to fix incorrect file owner/group and permission:</p>
<pre><code>chown mlmmj:mlmmj /opt/mlmmjadmin/settings.py
chmod 0400 /opt/mlmmjadmin/settings.py
</code></pre><div class="footer">
</code></pre>
<h2 id="openldap-special">OpenLDAP special</h2>
<h3 id="update-iredmail-ldap-schema-file">Update iRedMail LDAP schema file</h3>
<p>iRedMail-0.9.9 introduces 1 new LDAP attribute for mail user account:</p>
<ul>
<li><code>mailboxFormat</code>: used to store mailbox format. All formats supported by
Dovecot are ok. for example, <code>maildir</code>, <code>mdbox</code>. For more details, please
check Dovecot document here: <a href="https://wiki2.dovecot.org/MailboxFormat">https://wiki2.dovecot.org/MailboxFormat</a></li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>If you use different mailbox format, you need to set mailbox format to the
one you're using.</p>
</div>
<p>Download the latest iRedMail LDAP schema file</p>
<ul>
<li>On RHEL/CentOS:</li>
</ul>
<pre><code>cd /tmp
wget https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /etc/openldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /etc/openldap/schema/
service slapd restart
</code></pre>
<ul>
<li>On Debian/Ubuntu:</li>
</ul>
<pre><code>cd /tmp
wget https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /etc/ldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /etc/ldap/schema/
service slapd restart
</code></pre>
<ul>
<li>On FreeBSD:</li>
</ul>
<pre><code>cd /tmp
wget https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /usr/local/etc/openldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /usr/local/etc/openldap/schema/
service slapd restart
</code></pre>
<ul>
<li>
<p>On OpenBSD:</p>
<blockquote>
<p>Note: if you're running ldapd as LDAP server, the schema directory is
<code>/etc/ldap</code>, and service name is <code>ldapd</code>.</p>
</blockquote>
</li>
</ul>
<pre><code>cd /tmp
ftp https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/samples/iredmail/iredmail.schema
cd /etc/openldap/schema/
cp iredmail.schema iredmail.schema.bak
cp -f /tmp/iredmail.schema /etc/openldap/schema/
rcctl restart slapd
</code></pre>
<h3 id="dovecot-read-mailbox-format-from-ldap">Dovecot: read mailbox format from LDAP</h3>
<p>Please open file <code>/etc/dovecot/dovecot-ldap.conf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/dovecot/dovecot-ldap.conf</code> (FreeBSD), find the <code>user_attrs =</code>
line like below:</p>
<pre><code>user_attrs = mail=master_user,mail=user,homeDirectory=home,=mail=maildir:~/Maildir/,mailQuota=quota_rule=*:bytes=%$
</code></pre>
<p>Please replace <code>maildir:</code> by <code>${ldap:mailboxFormat:maildir}</code>. After modified,
it looks like below:</p>
<pre><code>user_attrs = mail=master_user,mail=user,homeDirectory=home,=mail=${ldap:mailboxFormat:maildir}:~/Maildir/,mailQuota=quota_rule=*:bytes=%$
</code></pre>
<p>If attribute <code>mailboxFormat</code> doesn't present in user object, Dovecot will use
string <code>maildir</code> as default value.</p>
<h2 id="mysqlmariadb-special">MySQL/MariaDB special</h2>
<h3 id="sql-structure-changes-in-vmail-database">SQL structure changes in <code>vmail</code> database</h3>
<p>We've made some changes to <code>vmail</code> database:</p>
<ul>
<li>New SQL column <code>mailbox.mailboxformat</code>: used to store mailbox format.
All formats supported by Dovecot are ok. for example, <code>maildir</code>, <code>mdbox</code>.
<strong>Default value is <code>maildir</code>.</strong>
For more details, please check Dovecot document here:
<a href="https://wiki2.dovecot.org/MailboxFormat">https://wiki2.dovecot.org/MailboxFormat</a></li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>If you use different mailbox format, you need to set mailbox format to the
one you're using.</p>
</div>
<p>Download SQL template file used to update SQL database:</p>
<pre><code>cd /root/
wget https://bitbucket.org/zhb/iredmail/raw/default/extra/update/0.9.9/iredmail.pgsql
</code></pre>
<p>Connect to PostgreSQL server as <code>postgres</code> user and import the SQL file:
<em> on Linux, it's <code>postgres</code> user
</em> on FreeBSD, it's <code>pgsql</code> user
* on OpenBSD, it's <code>_postgresql</code> user</p>
<pre><code>mysql vmail &lt; /root/iredmail.pgsql
</code></pre>
<h3 id="dovecot-read-mailbox-format-from-sql">Dovecot: read mailbox format from SQL</h3>
<p>Please open file <code>/etc/dovecot/dovecot-mysql.conf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/dovecot/dovecot-mysql.conf</code> (FreeBSD), find the <code>user_attrs =</code>
line like below:</p>
<pre><code>user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
...
</code></pre>
<p>Add a new <code>CONCAT</code> line after above <code>CONCAT()</code> line:</p>
<pre><code>user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \
...
</code></pre>
<h2 id="postgresql-special">PostgreSQL special</h2>
<h3 id="sql-structure-changes-in-vmail-database_1">SQL structure changes in <code>vmail</code> database</h3>
<p>We've made some changes to <code>vmail</code> database:</p>
<ul>
<li>New SQL column <code>mailbox.mailboxformat</code>: used to store mailbox format.
All formats supported by Dovecot are ok. for example, <code>maildir</code>, <code>mdbox</code>.
<strong>Default value is <code>maildir</code>.</strong>
For more details, please check Dovecot document here:
<a href="https://wiki2.dovecot.org/MailboxFormat">https://wiki2.dovecot.org/MailboxFormat</a></li>
</ul>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<p>If you use different mailbox format, you need to set mailbox format to the
one you're using.</p>
</div>
<p>Download SQL template file used to update SQL database:</p>
<pre><code>cd /root/
wget https://bitbucket.org/zhb/iredmail/raw/default/extra/update/0.9.9/iredmail.mysql
</code></pre>
<ul>
<li>Run shell commands as root user below to connect to PostgreSQL server:</li>
</ul>
<pre><code># su - postgres
$ psql -d vmail
sql&gt; \i /tmp/mysql.pgsql
</code></pre>
<h3 id="dovecot-read-mailbox-format-from-sql_1">Dovecot: read mailbox format from SQL</h3>
<p>Please open file <code>/etc/dovecot/dovecot-pgsql.conf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/dovecot/dovecot-pgsql.conf</code> (FreeBSD), then</p>
<h4 id="postgresql-8x">PostgreSQL 8.x</h4>
<p>If you're running <strong>PostgreSQL 8.x</strong>, you can find the <code>user_attrs =</code> line like
below:</p>
<pre><code>user_query = SELECT \
mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS home, \
...
</code></pre>
<p>Please Add a line after above line:</p>
<pre><code>user_query = SELECT \
mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS home, \
mailbox.mailboxformat || ':' || mailbox.storagebasedirectory || '/' || mailbox.storagenode || '/' || mailbox.maildir AS mail, \
...
</code></pre>
<p>Restart Dovecot service is required.</p>
<h4 id="postgresql-9x-and-later-releases">PostgreSQL 9.x and later releases</h4>
<p>If you're running <strong>PostgreSQL 9.x</strong> and later releases, you can find the
<code>user_attrs =</code> line like below:</p>
<pre><code>user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
...
</code></pre>
<p>Add a new <code>CONCAT</code> line after above <code>CONCAT()</code> line:</p>
<pre><code>user_query = SELECT \
...
CONCAT(mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS home, \
CONCAT(mailbox.mailboxformat, ':', mailbox.storagebasedirectory, '/', mailbox.storagenode, '/', mailbox.maildir) AS mail, \
...
</code></pre>
<p>Restart Dovecot service is required.</p><div class="footer">
<p style="text-align: center; color: grey;">All documents are available in <a href="https://bitbucket.org/zhb/iredmail-docs/src">BitBucket repository</a>, and published under <a href="http://creativecommons.org/licenses/by-nd/3.0/us/" target="_blank">Creative Commons</a> license. You can <a href="https://bitbucket.org/zhb/iredmail-docs/get/tip.tar.bz2">download the latest version</a> for offline reading. If you found something wrong, please do <a href="https://www.iredmail.org/contact.html">contact us</a> to fix it.</p>
</div>
<!-- Global site tag (gtag.js) - Google Analytics -->