Upgrade iRedMail from 0.8.3 to 0.8.4

Attention

Check out the lightweight on-premises email archiving software developed by iRedMail team: Spider Email Archiver.

Paid Remote Upgrade Support

We offer remote upgrade support if you don't want to get your hands dirty, check the details and contact us.

ChangeLog

General (All backends should apply these steps)

Update /etc/iredmail-release with iRedMail version number

iRedMail stores the release version in /etc/iredmail-release 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:

# File: /etc/iredmail-release

0.8.4

Upgrade Roundcube webmail to the latest stable release

Please follow Roundcube official tutorial to upgrade Roundcube webmail to the latest stable release immediately: How to upgrade Roundcube.

Upgrade iRedAPD (Postfix policy server) to the latest stable release

Please follow below tutorial to upgrade iRedAPD to the latest stable release: Upgrade iRedAPD to the latest stable release

Upgrade iRedAdmin (open source edition) to the latest stable release

Please follow this tutorial to upgrade iRedAdmin open source edition to the latest stable release: Upgrade iRedAdmin to the latest stable release

Add new alias virusalert in Postfix for Amavisd

Amavisd will send an email notification to address virusalert@[YOUR_HOSTNAME] by default, but we don't have this user in Postfix alias file /etc/postfix/aliases (on Linux/OpenBSD), or /usr/local/etc/postfix/aliases (on FreeBSD) or SQL/LDAP database, so emails cannot be delivered. Below steps add an alias in Postfix alias file, and it will be forwarded to root user by default.

Add new alias (Note, use '/usr/local/etc/postfix/aliases' on FreeBSD instead), and update the database:

# echo 'virusalert: root' >> /etc/postfix/aliases
# postalias /etc/postfix/aliases

OpenLDAP backend special

Fix incorrect LDAP query filter in Postfix

If you add external email addresses as mail list members, iRedAdmin-Pro will store them in attribute memberOfGroup, this will cause exported LDIF data cannot be restored. Below are steps to fix this issue.

To fix this issue, we need the latest LDAP schema file provided by iRedMail. Steps are:

Here we go:

Use the latest LDAP schema file provided by iRedMail

# cd /tmp
# wget https://github.com/iredmail/iRedMail/raw/1.0/samples/iredmail/iredmail.schema

# cd /etc/openldap/schema/
# cp iredmail.schema iredmail.schema.bak

# cp -f /tmp/iredmail.schema /etc/openldap/schema/
# /etc/init.d/slapd restart       # <-- Or: /etc/init.d/ldap restart
# cd /tmp
# wget https://github.com/iredmail/iRedMail/raw/1.0/samples/iredmail/iredmail.schema

# cd /etc/ldap/schema/
# cp iredmail.schema iredmail.schema.bak

# cp -f /tmp/iredmail.schema /etc/ldap/schema/
# /etc/init.d/slapd restart
# cd /tmp
# wget https://github.com/iredmail/iRedMail/raw/1.0/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

Update existing accounts

# cd /root/
# wget https://github.com/iredmail/iRedMail/raw/1.0/update/ldap/updateLDAPValues_083_to_084.py

Open downloaded file updateLDAPValues_083_to_084.py, set LDAP server related settings in file head. for example,

# Part of file: updateLDAPValues_083_to_084.py

uri = 'ldap://127.0.0.1:389'
basedn = 'o=domains,dc=example,dc=com'
bind_dn = 'cn=vmailadmin,dc=example,dc=com'
bind_pw = 'passwd'

You can find required LDAP credential in iRedAdmin config file or iRedMail.tips file under your iRedMail installation directory. Using either cn=Manager,dc=xx,dc=xx or cn=vmailadmin,dc=xx,dc=xx as bind dn is ok.

Execute this script, it will fix incorrect values and add correct ones:

# python updateLDAPValues_083_to_084.py

Fix incorrect LDAP query filter in Postfix

# Part of file: ldap/virtual_group_maps.cf

# OLD setting
#query_filter    = (&(memberOfGroup=%s)(accountStatus=active)(enabledService=mail)(enabledService=deliver)(|(objectClass=mailUser)(objectClass=mailExternalUser)))

# New setting
query_filter    = (&(accountStatus=active)(enabledService=mail)(enabledService=deliver)(|(memberOfGroup=%s)(shadowAddress=%s))(|(objectClass=mailUser)(objectClass=mailExternalUser)))

Restarting Postfix service is required.

Supports alias domains in Postfix per-user bcc lookup files

# Part of file: ldap/sender_bcc_maps_user.cf

query_filter    = (&(|(mail=%s)(&(enabledService=shadowaddress)(shadowAddress=%s)))(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=senderbcc))
# Part of file: ldap/recipient_bcc_maps_user.cf

query_filter    = (&(|(mail=%s)(&(enabledService=shadowaddress)(shadowAddress=%s)))(objectClass=mailUser)(accountStatus=active)(enabledService=mail)(enabledService=recipientbcc))

Restarting Postfix service is required.

Create additional SQL index for Amavisd database

We need one new SQL index for Amavisd database, it's used to speed up performance of viewing quarantined mails.

Note: It may take long time if you have many records in sql table amavisd.msgs.

$ mysql -uroot -p
mysql> USE amavisd;
mysql> ALTER TABLE msgs ADD INDEX (quar_type);

MySQL backend special

Add 4 new columns used for per-user restriction

New version of iRedAPD (Postfix policy daemon) requires 4 new columns in table vmail.mailbox:

They're used for per-user restriction. For example, you can now define who can send email to your local user, or your user can send email to which external domains or users.

Please login to MySQL server as root user, execute SQL commands to add required columns and indexes.

# mysql -uroot -p
mysql> USE vmail;
mysql> ALTER TABLE mailbox ADD COLUMN allowedsenders TEXT NOT NULL DEFAULT '';
mysql> ALTER TABLE mailbox ADD COLUMN rejectedsenders TEXT NOT NULL DEFAULT '';
mysql> ALTER TABLE mailbox ADD COLUMN allowedrecipients TEXT NOT NULL DEFAULT '';
mysql> ALTER TABLE mailbox ADD COLUMN rejectedrecipients TEXT NOT NULL DEFAULT '';

Supported formats of sender/recipients are:

Multiple senders/recipients must be separated by comma, for example:

sql> INSERT INTO mailbox SET allowedsenders='@gmail.com,user@example.com';

Create additional SQL index for Amavisd database

We need one new SQL index for Amavisd database, it's used to speed up performance of viewing quarantined mails.

Note: It may take long time if you have many records in sql table amavisd.msgs.

$ mysql -uroot -p
mysql> USE amavisd;
mysql> ALTER TABLE msgs ADD INDEX (quar_type);

PostgreSQL backend special

Add 4 new columns used for per-user restriction

New version of iRedAPD (Postfix policy daemon) requires 4 new columns in table vmail.mailbox:

They're used for per-user restriction. For example, you can now define who can send email to your local user, or your user can send email to which external domains or users.

Please switch to PostgreSQL daemon user, then execute SQL commands to add required new columns and indexes:

# su - postgres
$ psql -d vmail
sql> ALTER TABLE mailbox ADD COLUMN allowedsenders TEXT NOT NULL DEFAULT '';
sql> ALTER TABLE mailbox ADD COLUMN rejectedsenders TEXT NOT NULL DEFAULT '';
sql> ALTER TABLE mailbox ADD COLUMN allowedrecipients TEXT NOT NULL DEFAULT '';
sql> ALTER TABLE mailbox ADD COLUMN rejectedrecipients TEXT NOT NULL DEFAULT '';

Supported formats of sender/recipients are:

Multiple senders/recipients must be separated by comma, for example:

sql> INSERT INTO mailbox SET allowedsenders='@gmail.com,user@example.com';

Create additional SQL index for Amavisd database

We need one new SQL index for Amavisd database, it's used to speed up performance of viewing quarantined mails.

Note: It may take long time if you have many records in sql table amavisd.msgs.

Please switch to PostgreSQL daemon user, then execute SQL commands to add required columns and indexes:

# su - postgres
$ psql -d amavisd
sql> CREATE INDEX idx_msgs_quar_type ON msgs (quar_type);