iredmail-doc/html/upgrade.iredmail.0.9.7-0.9....

589 lines
28 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Upgrade iRedMail from 0.9.7 to 0.9.8</title>
<link rel="stylesheet" type="text/css" href="./css/markdown.css" />
</head>
<body>
<div id="navigation">
2017-11-16 21:48:44 -06:00
<a href="https://www.iredmail.org" target="_blank">
<img alt="iRedMail web site"
src="./images/logo-iredmail.png"
style="vertical-align: middle; height: 30px;"
/>&nbsp;
<span>iRedMail</span>
</a>
&nbsp;&nbsp;//&nbsp;&nbsp;<a href="./index.html">Document Index</a></div><h1 id="upgrade-iredmail-from-097-to-098">Upgrade iRedMail from 0.9.7 to 0.9.8</h1>
<div class="toc">
<ul>
<li><a href="#upgrade-iredmail-from-097-to-098">Upgrade iRedMail from 0.9.7 to 0.9.8</a><ul>
<li><a href="#changelog">ChangeLog</a></li>
<li><a href="#general-all-backends-should-apply-these-steps">General (All backends should apply these steps)</a><ul>
<li><a href="#update-etciredmail-release-with-new-iredmail-version-number">Update /etc/iredmail-release with new iRedMail version number</a></li>
<li><a href="#upgrade-iredapd-postfix-policy-server-to-the-latest-stable-release-22">Upgrade iRedAPD (Postfix policy server) to the latest stable release (2.2)</a></li>
2017-10-18 09:23:43 -05:00
<li><a href="#fixed-sogo-backup-script-contains-3-issues">Fixed: SOGo backup script contains 3 issues</a></li>
2018-01-30 23:58:53 -06:00
<li><a href="#fail2ban-new-jail-postfix-pregreet">Fail2ban: new jail postfix-pregreet</a></li>
2017-12-23 21:11:15 -06:00
<li><a href="#fixed-nginx-snippet-file-hard-codes-static-file-types-for-iredadmin">Fixed: Nginx snippet file hard-codes static file types for iRedAdmin</a></li>
<li><a href="#fix-unexpected-dnsbl-query-result-for-site-bbarracudacentralorg">Fix unexpected DNSBL query result for site b.barracudacentral.org</a></li>
2017-10-05 19:05:42 -05:00
<li><a href="#optional-log-mail-subject-sender-size-in-mail-deliver-log">[OPTIONAL] Log mail subject, sender, size in mail deliver log</a></li>
</ul>
</li>
2017-11-24 08:55:36 -06:00
<li><a href="#openldap-backend">OpenLDAP backend</a><ul>
2018-01-19 02:26:46 -06:00
<li><a href="#update-openldap-config-file-to-index-new-attributes-and-fix-an-acl">Update OpenLDAP config file to index new attributes and fix an ACL</a></li>
<li><a href="#update-iredmail-ldap-schema-file">Update iRedMail LDAP schema file</a></li>
2017-11-24 08:55:36 -06:00
<li><a href="#amavisd-add-new-sql-column-maddremail_raw-to-store-mail-address-without-address-extension">Amavisd: Add new SQL column maddr.email_raw to store mail address without address extension</a></li>
2018-01-20 19:38:22 -06:00
<li><a href="#update-sogo-config-file-for-per-domain-global-address-book">Update SOGo config file for per-domain global address book</a></li>
2017-11-24 08:55:36 -06:00
</ul>
</li>
<li><a href="#mysqlmariadb-backends">MySQL/MariaDB backends</a><ul>
<li><a href="#fixed-user-under-disabled-domain-is-able-to-send-email-with-smtp-protocol">Fixed: User under disabled domain is able to send email with smtp protocol</a></li>
<li><a href="#fixed-improper-postfix-sql-queries-used-to-query-per-user-bcc-address">Fixed: Improper Postfix SQL queries used to query per-user bcc address.</a></li>
2017-11-24 08:55:36 -06:00
<li><a href="#amavisd-add-new-sql-column-maddremail_raw-to-store-mail-address-without-address-extension_1">Amavisd: Add new SQL column maddr.email_raw to store mail address without address extension</a></li>
</ul>
</li>
<li><a href="#postgresql-backend">PostgreSQL backend</a><ul>
<li><a href="#fixed-user-under-disabled-domain-is-able-to-send-email-with-smtp-protocol_1">Fixed: User under disabled domain is able to send email with smtp protocol</a></li>
<li><a href="#fixed-improper-postfix-sql-queries-used-to-query-per-user-bcc-address_1">Fixed: Improper Postfix SQL queries used to query per-user bcc address.</a></li>
2017-11-24 08:55:36 -06:00
<li><a href="#amavisd-add-new-sql-column-maddremail_raw-to-store-mail-address-without-address-extension_2">Amavisd: Add new SQL column maddr.email_raw to store mail address without address extension</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="admonition warning">
<p class="admonition-title">DO NOT APPLY THIS UPGRADE TUTORIAL</p>
<p>This document is still a <strong>DRAFT</strong>, do NOT apply it.</p>
</div>
<div class="admonition note">
<p class="admonition-title">Paid Remote Upgrade Support</p>
<p>We offer remote upgrade support if you don't want to get your hands dirty,
2017-11-16 21:48:44 -06:00
check <a href="https://www.iredmail.org/support.html">the details</a> and
<a href="https://www.iredmail.org/contact.html">contact us</a>.</p>
</div>
<h2 id="changelog">ChangeLog</h2>
<ul>
<li>TODO [SQL backends] Update SQL structure:<ul>
<li>New column: <code>domain.maillists</code></li>
<li>New column: <code>forwardings.is_maillist</code></li>
<li>New table: <code>vmail.maillists</code></li>
<li>New doc: how to add a standalone (mlmmj) mailing list account</li>
<li>New doc: how to deploy mlmmj + mlmmj-admin</li>
</ul>
</li>
2018-01-30 23:58:53 -06:00
<li>Jan 31, 2018: Fail2ban: new jail <code>postfix-pregreet</code>.</li>
2018-01-20 19:38:22 -06:00
<li>Jan 21, 2018: [LDAP] Update SOGo config file for per-domain global address book.</li>
2018-01-19 02:26:46 -06:00
<li>Jan 19, 2018: Update OpenLDAP config file to index new attributes and fix an ACL.</li>
<li>Jan 19, 2018: Update iRedMail LDAP schema file</li>
2017-12-23 21:11:15 -06:00
<li>Dec 18, 2017: Don't hard-code static file types in Nginx template for iRedAdmin.</li>
2017-11-24 08:55:36 -06:00
<li>Nov 24, 2017: Amavisd: Add new SQL column <code>maddr.email_raw</code> to store mail address without address extension.</li>
<li>Nov 17, 2017: Fixed: Improper Postfix SQL queries used to query per-user bcc address.</li>
2017-10-18 09:23:43 -05:00
<li>Oct 6, 2017: Fixed: SOGo backup script contains 3 issues</li>
2017-10-05 19:05:42 -05:00
<li>Oct 6, 2017: [OPTIONAL] Fix improper expected DNSBL filter for site <code>b.barracudacentral.org</code></li>
<li>Oct 6, 2017: [OPTIONAL] Log mail subject, sender, size in mail deliver log.</li>
</ul>
<h2 id="general-all-backends-should-apply-these-steps">General (All backends should apply these steps)</h2>
<h3 id="update-etciredmail-release-with-new-iredmail-version-number">Update <code>/etc/iredmail-release</code> with new iRedMail version number</h3>
<p>iRedMail stores the release version in <code>/etc/iredmail-release</code> after
installation, it's recommended to update this file after you upgraded iRedMail,
so that you can know which version of iRedMail you're running. For example:</p>
<pre><code>0.9.7
</code></pre>
<h3 id="upgrade-iredapd-postfix-policy-server-to-the-latest-stable-release-22">Upgrade iRedAPD (Postfix policy server) to the latest stable release (2.2)</h3>
<p>Please follow below tutorial to upgrade iRedAPD to the latest stable release:
<a href="./upgrade.iredapd.html">Upgrade iRedAPD to the latest stable release</a></p>
2017-10-18 09:23:43 -05:00
<h3 id="fixed-sogo-backup-script-contains-3-issues">Fixed: SOGo backup script contains 3 issues</h3>
2017-10-05 19:05:42 -05:00
<p>SOGo backup script <code>/var/vmail/backup/backup_sogo.sh</code> shipped in iRedMail-0.9.7
2017-10-18 21:44:14 -05:00
and earlier releases contains 3 issues:</p>
<ul>
<li>it cannot remove old backup files</li>
<li>it doesn't set correct owner and permission on backup files</li>
<li>it cannot find command <code>sogo-tool</code> on FreeBSD. This issue causes our script
didn't backup any sogo data on FreeBSD at all.</li>
2017-10-18 21:44:14 -05:00
</ul>
2017-10-05 19:05:42 -05:00
<p>To fix them, please download the latest version and override the one on your
system:</p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Script <code>backup_sogo.sh</code> uses <code>/var/vmail/backup</code> to store backup files by
default, if you use a different directory, please edit this file and modify
parameter <code>BACKUP_ROOTDIR=</code> to use the correct one.</p>
</div>
2017-10-05 19:05:42 -05:00
<pre><code>cd /var/vmail/backup/
wget https://bitbucket.org/zhb/iredmail/raw/default/iRedMail/tools/backup_sogo.sh
chown root backup_sogo.sh
chmod 0400 backup_sogo.sh
</code></pre>
2018-01-30 23:58:53 -06:00
<h3 id="fail2ban-new-jail-postfix-pregreet">Fail2ban: new jail <code>postfix-pregreet</code></h3>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>This is not applicable to OpenBSD because we don't have Fail2ban running on
OpenBSD.</p>
</div>
<p>Quote from <a href="http://www.postfix.org/POSTSCREEN_README.html#pregreet">Postfix website</a>:</p>
<blockquote>
<p>The SMTP protocol is a classic example of a protocol where the server speaks
before the client. postscreen(8) detects zombies that are in a hurry and that
speak before their turn.</p>
</blockquote>
2018-01-31 02:33:10 -06:00
<p>Many spammers are in a hurry to transfer message to your server, we'd
like to block them due to not follow RFC.</p>
<p>During mail server maintenance, we found many spammers from China mainland
cannot pass this pregreet test and all of them use <code>ylmf-pc</code> as HELO hostname.
it's very possible that they're running an illegal Windows XP system which were
installed with a malware Windows XP ISO image.</p>
<p>Steps to create this new Fail2ban jail:</p>
<ul>
<li>Create new file <code>/etc/fail2ban/filter.d/postfix-pregreet.conf</code> with content
below:</li>
</ul>
<pre><code>[Definition]
# Block clients which cannot pass Postfix postscreen pregreet test.
# FYI: http://www.postfix.org/POSTSCREEN_README.html#pregreet
#
# The SMTP protocol is a classic example of a protocol where the server speaks
# before the client. postscreen(8) detects zombies that are in a hurry and that
# speak before their turn.
failregex = postscreen\[\d+\]: PREGREET .* from \[&lt;HOST&gt;\]:\d+:
# while setting up new account, Thunderbird doesn't wait for server connection
# greeting/banner, this causes Thunderbird cannot pass the Postfix pregreet
# test and caught by `failregex` rules listed above (the rule contains
# 'PREGREET' line).
# FYI: https://bugzilla.mozilla.org/show_bug.cgi?id=538809#c41
ignoreregex = postscreen\[\d+\]: PREGREET .* from \[&lt;HOST&gt;\]:\d+: (EHLO|HELO) we-guess.mozilla.org
</code></pre>
<ul>
<li>
<p>Create new file <code>/etc/fail2ban/jail.d/postfix-pregreet.local</code> with content
below:</p>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>Please make sure you're using correct Postfix log file in <code>logpath =</code>
parameter. On RHEL/CentOS/FreeBSD, it's <code>/var/log/maillog</code>. On
Debian/Ubuntu, it's <code>/var/log/mail.log</code>.</p>
</div>
</li>
</ul>
<pre><code>[postfix-pregreet-iredmail]
enabled = true
filter = postfix-pregreet.iredmail
logpath = /var/log/maillog
maxretry = 1
action = iptables-multiports[name=postfix, port=&quot;25&quot;, protocol=tcp]
</code></pre>
2018-01-31 02:33:10 -06:00
<ul>
<li>Restarting Fail2ban service is required.</li>
</ul>
2017-12-23 21:11:15 -06:00
<h3 id="fixed-nginx-snippet-file-hard-codes-static-file-types-for-iredadmin">Fixed: Nginx snippet file hard-codes static file types for iRedAdmin</h3>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>This is only applicable to Nginx.</p>
</div>
<p>With default iRedMail settings, Nginx snippet file <code>/etc/nginx/templates/iredadmin.tmpl</code>
(on Linux/OpenBSD) or <code>/usr/local/etc/nginx/templates/iredadmin.tmpl</code> (on FreeBSD)
hard-codes static file types like below:</p>
<pre><code>location ~ ^/iredadmin/static/(.*)\.(png|jpg|gif|css|js) {
alias /var/www/iredadmin/static/$1.$2;
}
</code></pre>
<p>Note: The path in <code>alias</code> directive is different on different Linux/BSD distributions.</p>
<p>Please replace it by:</p>
<pre><code>location ~ ^/iredadmin/static/(.*) { # Remove file types
alias /var/www/iredadmin/static/$1; # Remove '.$2'
}
</code></pre>
<p>Reloading or restarting Nginx service is required.</p>
<h3 id="fix-unexpected-dnsbl-query-result-for-site-bbarracudacentralorg">Fix unexpected DNSBL query result for site <code>b.barracudacentral.org</code></h3>
2017-10-05 19:05:42 -05:00
<p>Postfix config file generated by iRedMail enables DNSBL service for postscreen
service like below:</p>
<pre><code>postscreen_dnsbl_sites =
zen.spamhaus.org=127.0.0.[2..11]*3
b.barracudacentral.org=127.0.0.[2..11]*2
</code></pre>
<p>but site <code>b.barracudacentral.org</code> returns only domain <code>127.0.0.2</code> (instead of
a range from <code>127.0.0.2</code> to <code>127.0.0.11</code>), so we should change the
<code>b.barracudacentral.org=127.0.0.[2..11]*2</code> line to:</p>
<pre><code>postscreen_dnsbl_sites =
zen.spamhaus.org=127.0.0.[2..11]*3
b.barracudacentral.org=127.0.0.2*2
</code></pre>
<p>Reloading or restarting Postfix is required.</p>
<h3 id="optional-log-mail-subject-sender-size-in-mail-deliver-log">[OPTIONAL] Log mail subject, sender, size in mail deliver log</h3>
<p>If you may need to get more info of (locally) delivered mail messages,
Dovecot setting <code>deliver_log_format</code> can log extra mail subject, sender, and
message size in mail deliver log. Please append this setting in Dovecot config
file <code>dovecot.conf</code>, then restart or reload Dovecot service.
<em> On Linux/OpenBSD, it's <code>/etc/dovecot/dovecot.conf</code>
</em> On FreeBSD, it's <code>/usr/local/etc/dovecot/dovecot.conf</code></p>
<pre><code>deliver_log_format = from=%{from}, envelope_sender=%{from_envelope}, subject=%{subject}, msgid=%m, size=%{size}, %$
</code></pre>
2017-11-24 08:55:36 -06:00
<h2 id="openldap-backend">OpenLDAP backend</h2>
2018-01-19 02:26:46 -06:00
<h3 id="update-openldap-config-file-to-index-new-attributes-and-fix-an-acl">Update OpenLDAP config file to index new attributes and fix an ACL</h3>
<ul>
<li>
<p>Please open OpenLDAP config file <code>slapd.conf</code>:</p>
<ul>
<li>On RHEL/CentOS, it's <code>/etc/openldap/slapd.conf</code></li>
<li>On Debian/Ubuntu, it's <code>/etc/ldap/slapd.conf</code></li>
<li>On FreeBSD, it's <code>/usr/local/etc/openldap/slapd.conf</code></li>
<li>On OpenBSD:<ul>
<li>if you're running OpenLDAP, it's <code>/etc/openldap/slapd.conf</code>.</li>
<li>if you're running <code>ldapd(8)</code> as LDAP server, no need to fix ACL
issue (<code>access to dn.subtree=</code>), but still need to index new
attributes.</li>
</ul>
</li>
</ul>
</li>
<li>
<p>find lines below:</p>
</li>
</ul>
<pre><code>access to dn.subtree=&quot;o=domains,dc=xxx,dc=xxx&quot;
by anonymous auth
by self write
by dn.exact=&quot;cn=vmail,dc=xxx,dc=xxx&quot; read
by dn.exact=&quot;cn=vmailadmin,dc=xxx,dc=xxx&quot; write
by users none
</code></pre>
<p>Replace the last line <code>by users none</code> by:</p>
<pre><code> by users read
</code></pre>
<ul>
<li>Append lines below to the end of OpenLDAP config file <code>slapd.conf</code>:</li>
</ul>
<pre><code>index member,uniqueMember eq,pres
index mailingListID eq
</code></pre>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>For OpenBSD <code>ldapd(8)</code> server, please add lines below inside the
<code>namespace xxx {}</code> block:</p>
<p><pre>
index member
index uniqueMember
index mailingListID
</pre></p>
</div>
<h3 id="update-iredmail-ldap-schema-file">Update iRedMail LDAP schema file</h3>
<p>iRedMail-0.9.8 introduces 1 new LDAP attribute for mailing list account:</p>
<ul>
<li><code>mailingListID</code>: used to store a server-wide unique id, currently is used
for mailing list subscription/unsubscription (a.k.a. newsletter).</li>
</ul>
<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/
</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/
</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/
</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/
</code></pre>
2017-11-24 08:55:36 -06:00
<h3 id="amavisd-add-new-sql-column-maddremail_raw-to-store-mail-address-without-address-extension">Amavisd: Add new SQL column <code>maddr.email_raw</code> to store mail address without address extension</h3>
<p>Many sender/recipient addresses contain address extension like
<code>user+extension@domain.com</code>, this is annoying if we try to get top 10
senders/recipients from Amavisd SQL database, because address
<code>user+ext1@domain.com</code> and <code>user+ext2@domain.com</code> are considered as different
user. To avoid this issue, we create a SQL trigger to store email address
without address extension in a new column <code>maddr.email_raw</code>. Please follow
steps below to apply the SQL structure change.</p>
<ul>
<li>Download SQL template file used to update SQL database:</li>
</ul>
<pre><code>cd /tmp/
wget https://bitbucket.org/zhb/iredmail/raw/default/extra/update/0.9.8-amavisd.mysql
</code></pre>
<ul>
<li>Connect to MySQL server as MySQL root user, and execute SQL commands:</li>
</ul>
<pre><code>$ mysql amavisd
mysql&gt; SOURCE /tmp/0.9.8-amavisd.mysql;
</code></pre>
2018-01-20 19:38:22 -06:00
<h3 id="update-sogo-config-file-for-per-domain-global-address-book">Update SOGo config file for per-domain global address book</h3>
<div class="admonition attention">
<p class="admonition-title">Attention</p>
<p>With this change, user can only see other users in same domain. If this is
<strong>NOT</strong> what you expect, you should <strong>NOT</strong> apply this change.</p>
</div>
<p>SOGo is configured by iRedMail to query all users on server while performing
account search (e.g. global address book, meeting attendees), this may be not
what you expect if you host multiple mail domains and they should not see
others on same server. Please follow steps below to fix it.</p>
<ul>
<li>Open SOGo config file <code>/etc/sogo/sogo.conf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/sogo/sogo.conf</code> (FreeBSD), find lines like below:</li>
</ul>
<pre><code> {
// Used for global address book
type = ldap;
id = global_addressbook;
canAuthenticate = NO;
isAddressBook = YES;
displayName = &quot;Global Address Book&quot;;
</code></pre>
<ul>
<li>Add one line after the <code>displayName =</code> line:</li>
</ul>
<pre><code> bindAsCurrentUser = YES;
</code></pre>
<ul>
<li>Restarting SOGo service is required to apply this change.</li>
</ul>
<h2 id="mysqlmariadb-backends">MySQL/MariaDB backends</h2>
<h3 id="fixed-user-under-disabled-domain-is-able-to-send-email-with-smtp-protocol">Fixed: User under disabled domain is able to send email with smtp protocol</h3>
<p>Dovecot is IMAP/POP3/Managesieve server, also a SASL auth server for Postfix.
If mail domain is disabled, users under this domain are not able to use
IMAP/POP3/Managesieve services, but there's a bug in Dovecot SQL query
configured by iRedMail, it doesn't check domain status while performing smtp
sasl auth. Please follow steps below to fix it.</p>
<ul>
<li>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>password_query</code> line like below:</li>
</ul>
<pre><code>password_query = SELECT password, allow_nets FROM mailbox WHERE username='%u' AND enable%Ls%Lc=1 AND active=1
</code></pre>
<ul>
<li>Replace it by lines below:</li>
</ul>
<pre><code>password_query = SELECT mailbox.password, mailbox.allow_nets \
FROM mailbox,domain \
WHERE mailbox.username='%u' \
AND mailbox.`enable%Ls%Lc`=1 \
AND mailbox.active=1 \
AND mailbox.domain=domain.domain \
AND domain.backupmx=0 \
AND domain.active=1
</code></pre>
<ul>
<li>Save your change and restart Dovecot service.</li>
</ul>
<h3 id="fixed-improper-postfix-sql-queries-used-to-query-per-user-bcc-address">Fixed: Improper Postfix SQL queries used to query per-user bcc address.</h3>
<p>There're 2 Postfix SQL queries configured by iRedMail are improper, they won't
return per-user bcc address. Please follow steps below to fix it:</p>
<ul>
<li>Open file <code>/etc/postfix/mysql/recipient_bcc_maps_user.cf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/postfix/mysql/recipient_bcc_maps_user.cf</code> (FreeBSD),
<strong>REPLACE</strong> the <code>query =</code> line by lines below:</li>
</ul>
<pre><code>query = SELECT recipient_bcc_user.bcc_address
FROM recipient_bcc_user,domain,alias_domain
WHERE recipient_bcc_user.username='%s'
AND recipient_bcc_user.domain='%d'
AND ((recipient_bcc_user.domain=domain.domain)
OR (recipient_bcc_user.domain=alias_domain.alias_domain AND domain.domain = alias_domain.target_domain))
AND domain.backupmx=0
AND domain.active=1
AND recipient_bcc_user.active=1
</code></pre>
<ul>
<li>Open file <code>/etc/postfix/mysql/sender_bcc_maps_user.cf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/postfix/mysql/sender_bcc_maps_user.cf</code> (FreeBSD),
<strong>REPLACE</strong> the <code>query =</code> line by lines below:</li>
</ul>
<pre><code>query = SELECT sender_bcc_user.bcc_address
FROM sender_bcc_user,domain,alias_domain
WHERE sender_bcc_user.username='%s'
AND sender_bcc_user.domain='%d'
AND ((sender_bcc_user.domain=domain.domain)
OR (sender_bcc_user.domain=alias_domain.alias_domain AND domain.domain = alias_domain.target_domain))
AND domain.backupmx=0
AND domain.active=1
AND sender_bcc_user.active=1
</code></pre>
<ul>
<li>Save your changes and restart Postfix service.</li>
</ul>
2017-11-24 08:55:36 -06:00
<h3 id="amavisd-add-new-sql-column-maddremail_raw-to-store-mail-address-without-address-extension_1">Amavisd: Add new SQL column <code>maddr.email_raw</code> to store mail address without address extension</h3>
<p>Many sender/recipient addresses contain address extension like
<code>user+extension@domain.com</code>, this is annoying if we try to get top 10
senders/recipients from Amavisd SQL database, because address
<code>user+ext1@domain.com</code> and <code>user+ext2@domain.com</code> should be considered as same
user, but it's not. To avoid this issue, we create a SQL trigger to store email
address without address extension in a new column <code>maddr.email_raw</code>. Steps:</p>
<ul>
<li>Download SQL template file used to update SQL database:</li>
</ul>
<pre><code>cd /tmp/
wget https://bitbucket.org/zhb/iredmail/raw/default/extra/update/0.9.8-amavisd.mysql
</code></pre>
<ul>
<li>Connect to MySQL server as MySQL root user, and execute SQL commands:</li>
</ul>
<pre><code># mysql amavisd
sql&gt; SOURCE /tmp/0.9.8-amavisd.mysql;
</code></pre>
<h2 id="postgresql-backend">PostgreSQL backend</h2>
<h3 id="fixed-user-under-disabled-domain-is-able-to-send-email-with-smtp-protocol_1">Fixed: User under disabled domain is able to send email with smtp protocol</h3>
<p>Dovecot is IMAP/POP3/Managesieve server, also a SASL auth server for Postfix.
If mail domain is disabled, users under this domain are not able to use
IMAP/POP3/Managesieve services, but there's a bug in Dovecot SQL query
configured by iRedMail, it doesn't check domain status while performing smtp
sasl auth. Please follow steps below to fix it.</p>
<ul>
<li>Open file <code>/etc/dovecot/dovecot-pgsql.conf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/dovecot/dovecot-pgsql.conf</code> (FreeBSD), find the
<code>password_query</code> line like below:</li>
</ul>
<pre><code>password_query = SELECT password, allow_nets FROM mailbox WHERE username='%u' AND enable%Ls%Lc=1 AND active=1
</code></pre>
<ul>
<li>Replace it by lines below:</li>
</ul>
<pre><code>password_query = SELECT mailbox.password, mailbox.allow_nets \
FROM mailbox,domain \
WHERE mailbox.username='%u' \
AND mailbox.&quot;enable%Ls%Lc&quot;=1 \
AND mailbox.active=1 \
AND mailbox.domain=domain.domain \
AND domain.backupmx=0 \
AND domain.active=1
</code></pre>
<ul>
<li>Save your change and restart Dovecot service.</li>
</ul>
<h3 id="fixed-improper-postfix-sql-queries-used-to-query-per-user-bcc-address_1">Fixed: Improper Postfix SQL queries used to query per-user bcc address.</h3>
<p>There're 2 Postfix SQL queries configured by iRedMail are improper, they won't
return per-user bcc address. Please follow steps below to fix it:</p>
<ul>
<li>Open file <code>/etc/postfix/pgsql/recipient_bcc_maps_user.cf</code> (Linux/OpenBSD) or
<code>/usr/local/etc/postfix/pgsql/recipient_bcc_maps_user.cf</code> (FreeBSD),
<strong>REPLACE</strong> the <code>query =</code> line by lines below:</li>
</ul>
<pre><code>query = SELECT recipient_bcc_user.bcc_address
FROM recipient_bcc_user,domain,alias_domain
WHERE recipient_bcc_user.username='%s'
AND recipient_bcc_user.domain='%d'
AND ((recipient_bcc_user.domain=domain.domain)
OR (recipient_bcc_user.domain=alias_domain.alias_domain AND domain.domain = alias_domain.target_domain))
AND domain.backupmx=0
AND domain.active=1
AND recipient_bcc_user.active=1
</code></pre>
<ul>
<li>Open file <code>/etc/postfix/pgsql/sender_bcc_maps_user.cf</code>, REPLACE the
<code>query =</code> line by lines below:</li>
</ul>
<pre><code>query = SELECT sender_bcc_user.bcc_address
FROM sender_bcc_user,domain,alias_domain
WHERE sender_bcc_user.username='%s'
AND sender_bcc_user.domain='%d'
AND ((sender_bcc_user.domain=domain.domain)
OR (sender_bcc_user.domain=alias_domain.alias_domain AND domain.domain = alias_domain.target_domain))
AND domain.backupmx=0
AND domain.active=1
AND sender_bcc_user.active=1
</code></pre>
<ul>
<li>Save your changes and restart Postfix service.</li>
2017-11-24 08:55:36 -06:00
</ul>
<h3 id="amavisd-add-new-sql-column-maddremail_raw-to-store-mail-address-without-address-extension_2">Amavisd: Add new SQL column <code>maddr.email_raw</code> to store mail address without address extension</h3>
<p>Many sender/recipient addresses contain address extension like
<code>user+extension@domain.com</code>, this is annoying if we try to get top 10
senders/recipients from Amavisd SQL database, because address
<code>user+ext1@domain.com</code> and <code>user+ext2@domain.com</code> should be considered as same
user, but it's not. To avoid this issue, we create a SQL trigger to store email
address without address extension in a new column <code>maddr.email_raw</code>. Steps:</p>
<ul>
<li>Download SQL template file used to update SQL database:</li>
</ul>
<pre><code>cd /tmp/
wget https://bitbucket.org/zhb/iredmail/raw/default/extra/update/0.9.8-amavisd.pgsql
</code></pre>
<ul>
<li>Run shell commands as root user below to connect to PostgreSQL server:</li>
</ul>
<pre><code># su - postgres
$ psql -U amavisd -d vmail
sql&gt; \i /tmp/0.9.8-amavisd.pgsql
</code></pre><div class="footer">
2017-11-16 21:48:44 -06:00
<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>
2017-11-05 02:33:58 -06:00
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-3293801-21"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
2017-11-05 02:33:58 -06:00
gtag('config', 'UA-3293801-21');
</script>
</body></html>