From iRedMail
THIS IS STILL A DRAFT, DO NOT APPLY BELOW STEPS.
General (All backends should apply these upgrade steps)
Add missing auth service in Dovecot for Dovecot-2
WARNING: This is applicable to only Dovecot-2.x. You can check Dovecot version and its main config file with command:
| Terminal:
|
# dovecot -n | head -1
2.0.17 (684381041dc4+): /etc/dovecot/dovecot.conf
|
- Edit /etc/dovecot/dovecot.conf, add service auth-userdb in section service auth {}:
| File: dovecot.conf
|
service auth {
...
unix_listener auth-userdb {
user = vmail
group = vmail
mode = 0660
}
}
|
- Restarting Dovecot service is required.
Add missing config for IMAP share folder in Dovecot
This is applicable to both Dovecot-1.2 and Dovecot-2.
- Edit /etc/dovecot/dovecot-share-folder.conf, append below lines:
- NOTE: The config file is /etc/dovecot/share-folder.conf if you're running old iRedMail versions, and it's /usr/local/etc/dovecot/dovecot-share-folder.conf on FreeBSD.
| File: dovecot-share-folder.conf
|
# To share mailbox to anyone, please uncomment 'acl_anyone = allow' in
# dovecot.conf
map {
pattern = shared/shared-boxes/anyone/$from
table = anyone_shares
value_field = dummy
fields {
from_user = $from
}
}
|
- Restarting Dovecot service is required.
Note: We will mention how to create required SQL table later in this upgrade tutorial.
OpenLDAP backend special
Deliver emails to mail list members without enabledService=smtp
With default Postfix settings in iRedMail-0.7.4 and earlier versions, if a mail user is not allowed to use SMTP service to send out email (without enabledService=smtp), he/she cannot receive emails which delivered to the mail lists which he/she is belong to. Below steps fix this issue.
- Edit Postfix config file, main.cf, update virtual_alias_maps to replace sender_login_maps.cf by virtual_group_members_maps.cf:
- On Linux and OpenBSD, it's /etc/postfix/main.cf.
- On FreeBSD, it's /usr/local/etc/postfix/main.cf. And you should use /usr/local/etc/postfix/ldap/virtual_group_members_maps.cf in Postfix setting described below.
| File: main.cf
|
# OLD SETTING
#virtual_alias_maps = ..., proxy:ldap:/etc/postfix/ldap/sender_login_maps.cf, ...
# NEW SETTING
virtual_alias_maps = ..., proxy:ldap:/etc/postfix/ldap/virtual_group_members_maps.cf, ...
|
- Create new file virtual_group_members_maps.cf:
- Copy sender_login_maps.cf to virtual_group_members_maps.cf.
- Edit virtual_group_members_maps.cf, remove (enabledService=smtp) (with brackets, yes) and save it.
- Fix file permission:
| Terminal:
|
# ---- On Linux and FreeBSD ----
# chown root:postfix virtual_group_members_maps.cf
# chmod 0640 virtual_group_members_maps.cf
# ---- On OpenBSD ----
# chown root:_postfix virtual_group_members_maps.cf
# chmod 0640 virtual_group_members_maps.cf
|
- Restarting Postfix service is required.
Add new attribute/value required by IMAP share folder in Dovecot-2: enabledService=lib-storage
Dovecot-2.x requires enabledService=lib-storage for IMAP folder sharing. Below steps are used to add it for all mail users.
Steps:
- Download python script used to adding missing values.
| Terminal:
|
# cd /root/
# wget https://bitbucket.org/zhb/iredmail/raw/cb7d2492563d/extra/update/updateLDAPValues_080_to_081.py
|
- Open updateLDAPValues_080_to_081.py, config LDAP server related settings in file head. e.g.
| File: updateLDAPValues_080_to_081.py
|
uri = 'ldap://127.0.0.1:389'
basedn = 'o=domains,dc=iredmail,dc=org'
bind_dn = 'cn=vmailadmin,dc=iredmail,dc=org'
bind_pw = 'passwd'
|
Tip:
- You can find them in iRedAdmin config file or iRedMail.tips file under your iRedMail installation directory.
- Use 'cn=Manager' instead of 'cn=vmailadmin' here is ok too.
- Execute this script, it will add missing values for mail accounts:
| Terminal:
|
# python updateLDAPValues_080_to_081.py
|
Add missing SQL table anyone_shares in MySQL database iredadmin
If you want to share IMAP folder to anyone, you have to create new SQL table anyone_shares in MySQL database iredadmin. Steps:
| Terminal:
|
# mysql -uroot -p
sql> USE iredadmin;
sql> CREATE TABLE IF NOT EXISTS anyone_shares (
from_user VARCHAR(255) NOT NULL,
dummy CHAR(1) DEFAULT '1',
PRIMARY KEY (from_user)
);
|
MySQL backend special
Fix incorrect maildir path with 'virtual' transport
iRedMail uses Dovecot LDA as transport by default, but if you use transport virtual, the Postfix built-in transport, it will use different maildir path from Dovecot LDA. Below step is used to fix it.
- Edit /etc/postfix/mysql/virtual_mailbox_maps.cf, update query =:
| File: mysql/virtual_mailbox_maps.cf
|
# OLD SETTING
#query = SELECT CONCAT(mailbox.storagenode, '/', mailbox.maildir) FROM ...
# NEW SETTING
query = SELECT CONCAT(mailbox.storagenode, '/', mailbox.maildir, '/Maildir/') FROM ...
|
- Restart Postfix service to make it use new setting.
Add new column required by IMAP share folder in Dovecot-2: enablelib-storage=1
Dovecot-2.x requires mailbox.enablelib-storage=1 for IMAP folder sharing. Below steps are used to add it for all mail users.
- Please login to MySQL server as root user, execute SQL commands to add required column mailbox.enablelib-storage:
| Terminal:
|
# mysql -uroot -p
sql> USE vmail;
sql> ALTER TABLE mailbox ADD COLUMN `enablelib-storage` TINYINT(1) NOT NULL DEFAULT 1;
sql> CREATE INDEX idx_mailbox_lib_storage ON mailbox (`enablelib-storage`);
-- Add missing index
sql> CREATE INDEX idx_mailbox_enabledoveadm ON mailbox (enabledoveadm);
|
- Update /etc/dovecot/dovecot-mysql.conf, add ` (not single quote) around enable%Ls%Lc.
| File: dovecot-XXsql.conf
|
# OLD SETTING
# AND mailbox.enable%Ls%Lc=1 \
# NEW SETTING
AND mailbox.`enable%Ls%Lc`=1 \
|
Add missing SQL table anyone_shares in MySQL database vmail
If you want to share IMAP folder to anyone, you have to create new SQL table anyone_shares in MySQL database vmail. Steps:
| Terminal:
|
# mysql -uroot -p
sql> USE vmail;
sql> CREATE TABLE IF NOT EXISTS anyone_shares (
from_user VARCHAR(255) NOT NULL,
dummy CHAR(1) DEFAULT '1',
PRIMARY KEY (from_user)
);
|
PostgreSQL backend special
Fix incorrect maildir path with 'virtual' transport
iRedMail uses Dovecot LDA as transport by default, but if you use transport virtual, the Postfix built-in transport, it will use different maildir path from Dovecot LDA. Below step is used to fix it.
- Edit /etc/postfix/mysql/virtual_mailbox_maps.cf, update query =:
| File: mysql/virtual_mailbox_maps.cf
|
# OLD SETTING
#query = SELECT (mailbox.storagenode || '/' || mailbox.maildir) FROM ...
# NEW SETTING
query = SELECT CONCAT(mailbox.storagenode, '/', mailbox.maildir, '/Maildir/') FROM ...
|
- Restart Postfix service to make it use new setting.
Add new column required by IMAP share folder in Dovecot-2: enablelib-storage=1
Dovecot-2.x requires mailbox.enablelib-storage=1 for IMAP folder sharing. Below steps are used to add it for all mail users.
- Please switch to PostgreSQL daemon user, and execute SQL commands to add required column mailbox.enablelib-storage:
- On FreeBSD, the daemon user of PostgreSQL is pgsql.
- On OpenBSD, the daemon user of PostgreSQL is _postgresql.
- On Linux, the daemon user of PostgreSQL is postgre.
| Terminal:
|
# su - postgres
# psql -d vmail
sql> ALTER TABLE mailbox ADD COLUMN "enablelib-storage" INT2 NOT NULL DEFAULT 1;
sql> CREATE INDEX idx_mailbox_lib_storage ON mailbox ("enablelib-storage");
-- Add missing index
sql> CREATE INDEX idx_mailbox_enabledoveadm ON mailbox (enabledoveadm);
sql> GRANT SELECT ON mailbox TO vmail;
sql> GRANT SELECT,UPDATE,INSERT,DELETE ON mailbox to vmailadmin;
|
- Update /etc/dovecot/dovecot-pgsql.conf, add quotes for column mailbox.enable%Ls%Lc:
| File: dovecot-XXsql.conf
|
# OLD SETTING
# AND mailbox.enable%Ls%Lc=1 \
# NEW SETTING
AND mailbox."enable%Ls%Lc"=1 \
|
Add missing SQL table anyone_shares in PostgreSQL database vmail
If you want to share IMAP folder to anyone, you have to create new SQL table anyone_shares in PostgreSQL database vmail. Steps:
- On FreeBSD, the daemon user of PostgreSQL is pgsql.
- On OpenBSD, the daemon user of PostgreSQL is _postgresql.
- On Linux, the daemon user of PostgreSQL is postgre.
| Terminal:
|
# su - postgres
# psql -d vmail
sql> CREATE TABLE anyone_shares (
from_user VARCHAR(255) NOT NULL,
dummy CHAR(1),
PRIMARY KEY (from_user)
);
|
ChangeLog
- 2012-05-20: Add Dovecot share folder: anyone_shares.