From 23cac8fdc8ff9bd9404de748f2ca1d7604078366 Mon Sep 17 00:00:00 2001 From: Zhang Huangbin Date: Tue, 2 Oct 2018 12:02:22 +0200 Subject: [PATCH] Cleanup migrate.to.new.iredmail.server.html. New: openldap.structure.html. --- en_US/faq/openldap.structure.md | 56 ++++++++++++ .../1-migrate.to.new.iredmail.server.md | 63 ++------------ html/index.html | 1 + html/migrate.to.new.iredmail.server.html | 66 ++++---------- html/openldap.structure.html | 85 +++++++++++++++++++ 5 files changed, 166 insertions(+), 105 deletions(-) create mode 100644 en_US/faq/openldap.structure.md create mode 100644 html/openldap.structure.html diff --git a/en_US/faq/openldap.structure.md b/en_US/faq/openldap.structure.md new file mode 100644 index 00000000..83594868 --- /dev/null +++ b/en_US/faq/openldap.structure.md @@ -0,0 +1,56 @@ +# OpenLDAP data structure configured by iRedMail + +This is a brief introduction of the OpenLDAP data structure configured by +iRedMail. It may help a little if you want to migrate from/to other LDAP server. + +## LDAP schema files + +iRedMail requires 7 LDAP schema files listed below, 5 are shipped by OpenLDAP, +1 shipped by Amavisd, one by iRedMail: + +* core.schema +* corba.schema +* cosine.schema +* inetorgperson.schema +* nis.schema +* amavisd.schema (names are different on different linux/bsd distros) +* iredmail.schema + +If you're migrating to other LDAP server, it must include them all, otherwise +you may not be able to add or update mail accounts. + +## Data structure + +OpenLDAP configured by iRedMail has hard-coded / predictable structure, and +Postfix / Dovecot / iRedAPD /... are configured to query LDAP based on this +structure. + +``` +dc=xx,dc=xx + |- o=domains + |- domainName=example.com + |- ou=Aliases + |- ou=Groups + |- ... + |- ou=Users + |- mail=postmaster@example.com + |- mail=xxx + |- ... +``` + +With this predictable structure: + +* it's easy to narrow down the query scope, the narrower the scope is, the + better performance you gain. + +* no need to performing a query first to get the full dn of ldap object you're + going to modify. + +If you don't use this structure: + +* you have to update Postfix/Dovecot/iRedAPD/... config files to use different + query scopes and filters. + +* The web-based admin panel - iRedAdmin(-Pro) - heavily relies on the + predictable structure, if you use different structure, you cannot manage mail + accounts with iRedAdmin(-Pro). diff --git a/en_US/migrations/1-migrate.to.new.iredmail.server.md b/en_US/migrations/1-migrate.to.new.iredmail.server.md index 3e0377e0..d69ac4f0 100644 --- a/en_US/migrations/1-migrate.to.new.iredmail.server.md +++ b/en_US/migrations/1-migrate.to.new.iredmail.server.md @@ -61,62 +61,17 @@ Notes: ## MySQL/PostgreSQL: Migrate mail accounts -All mail accounts are stored in database `vmail` by default, to migrate mail -accounts, you can simply export this database on old server, then import it -on new server. +All mail accounts are stored in database `vmail`. -__IMPORTANT NOTE__: iRedMail-0.8.7 drops several SQL columns, so before you -import backup SQL database, please add them first. It's safe to drop them -after you imported old database on new server. +* If both old and new servers are running same iRedMail version, you can simply + export `vmail` database on old server, then import it on new server. -```mysql -mysql> USE vmail; - -mysql> ALTER TABLE mailbox ADD COLUMN bytes BIGINT(20) NOT NULL DEFAULT 0; -mysql> ALTER TABLE mailbox ADD COLUMN messages BIGINT(20) NOT NULL DEFAULT 0; - -mysql> ALTER TABLE domain ADD COLUMN defaultlanguage VARCHAR(5) NOT NULL DEFAULT 'en_US'; -mysql> ALTER TABLE domain ADD COLUMN defaultuserquota BIGINT(20) NOT NULL DEFAULT '1024'; -mysql> ALTER TABLE domain ADD COLUMN defaultuseraliases TEXT; -mysql> ALTER TABLE domain ADD COLUMN disableddomainprofiles VARCHAR(255) NOT NULL DEFAULT ''; -mysql> ALTER TABLE domain ADD COLUMN disableduserprofiles VARCHAR(255) NOT NULL DEFAULT ''; -mysql> ALTER TABLE domain ADD COLUMN defaultpasswordscheme VARCHAR(10) NOT NULL DEFAULT ''; -mysql> ALTER TABLE domain ADD COLUMN minpasswordlength INT(10) NOT NULL DEFAULT 0; -mysql> ALTER TABLE domain ADD COLUMN maxpasswordlength INT(10) NOT NULL DEFAULT 0; - -mysql> ALTER TABLE alias ADD COLUMN islist TINYINT(1) NOT NULL DEFAULT 0; -``` - -After imported backup SQL databases, please execute below commands to mark -mail alias accounts and drop above newly created columns: - -```mysql -mysql> USE vmail; -mysql> UPDATE alias SET islist=1 WHERE address NOT IN (SELECT username FROM mailbox); -mysql> UPDATE alias SET islist=0 WHERE address=domain; -- domain catch-all account - --- Store values into new column: domain.settings and drop them -mysql> UPDATE domain SET settings=''; -mysql> UPDATE domain SET settings=CONCAT(settings, IF(defaultlanguage IS NULL OR defaultlanguage='', '', CONCAT('default_language:', defaultlanguage, ';'))); -mysql> UPDATE domain SET settings=CONCAT(settings, IF(defaultuserquota IS NULL OR defaultuserquota=0, '', CONCAT('default_user_quota:', defaultuserquota, ';'))); -mysql> UPDATE domain SET settings=CONCAT(settings, IF(defaultuseraliases IS NULL OR defaultuseraliases='', '', CONCAT('default_groups:', defaultuseraliases, ';'))); -mysql> UPDATE domain SET settings=CONCAT(settings, IF(minpasswordlength IS NULL OR minpasswordlength=0, '', CONCAT('min_passwd_length:', minpasswordlength, ';'))); -mysql> UPDATE domain SET settings=CONCAT(settings, IF(maxpasswordlength IS NULL OR maxpasswordlength=0, '', CONCAT('max_passwd_length:', maxpasswordlength, ';'))); -mysql> UPDATE domain SET settings=CONCAT(settings, IF(disableddomainprofiles IS NULL OR disableddomainprofiles='', '', CONCAT('disabled_domain_profiles:', disableddomainprofiles, ';'))); -mysql> UPDATE domain SET settings=CONCAT(settings, IF(disableduserprofiles IS NULL OR disableduserprofiles='', '', CONCAT('disabled_user_profiles:', disableduserprofiles, ';'))); - -mysql> ALTER TABLE domain DROP defaultlanguage; -mysql> ALTER TABLE domain DROP defaultuserquota; -mysql> ALTER TABLE domain DROP defaultuseraliases; -mysql> ALTER TABLE domain DROP minpasswordlength; -mysql> ALTER TABLE domain DROP maxpasswordlength; -mysql> ALTER TABLE domain DROP disableddomainprofiles; -mysql> ALTER TABLE domain DROP disableduserprofiles; -``` - -__IMPORTANT NOTE__: There might be some changes in SQL structure, please read -all upgrade tutorials for your current iRedMail release, then apply SQL -structure related changes. Check [upgrade tutorials for iRedMail](./iredmail.releases.html). +* If old server is running an old iRedMail version, there might be some changes + in SQL structure, please read all upgrade tutorials for the old iRedMail + release, then apply SQL structure related changes to make sure old server + has same SQL structure. After you have same SQL structure on both servers, + you can simply export `vmail` database on old server, then import it on new + server. Check [upgrade tutorials for iRedMail](./iredmail.releases.html). ## Migrate mailboxes (Maildir format) diff --git a/html/index.html b/html/index.html index 40b88c04..fa5c95b9 100644 --- a/html/index.html +++ b/html/index.html @@ -234,6 +234,7 @@
  • Explanation of Amavisd SQL database
  • Backup and restore
  • Locations of configuration and log files of major components
  • +
  • OpenLDAP data structure configured by iRedMail
  • Why no sieve support (Vacation, Forwarding) in SOGo Groupware