Steps to create users using mysql details where accounts accidently removed from the LDAP

Revision as of 06:09, 17 August 2017 by Nbhagwat (talk | contribs) (Created page with "=== <h1>Steps_to_create_users_using_mysql_details_where_accounts_accidently_removed_from_the_LDAP</h1> === <hr> <br> <h2>Problem: </h2> <p>1st Scenario: LDAP got corrupt and...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Steps_to_create_users_using_mysql_details_where_accounts_accidently_removed_from_the_LDAP



Problem:

1st Scenario: LDAP got corrupt and we do not have latest LDAP backup. OR
2nd Scenario: Some how users removed from LDAP and we still have account entries in MySQL db. .

Solution:

In this situation we have to restore LDAP with available backup and then we will extract accounts' entry from MySQL db. From MySQL we have to extract mailbox id, account id, and email-addresses of missing accounts.

After collecting all missing or removed accounts' details we will create account with the zimbra id.


This is the complete description of activity which we have to perform:-

============================================================================================

1). Missing accounts' list extract from MySQL database:-

  • Using the following command we can extract accounts' list from a particular domain.
$ mysql -e 'select id, account_id, comment from zimbra.mailbox where comment regexp "@mytestdomain.com";'
+-----+--------------------------------------+----------------------------------+
| id  | account_id                           | comment                          |
+-----+--------------------------------------+----------------------------------+
| 771 | ee4b049a-3d99-4908-b2b8-5cb069350ec8 | it@mytestdomain.com              |
| 773 | c01cfd8d-69d9-44c8-8234-99371fd19205 | testadmin@mytestdomain.com       |
| 774 | 1e4645e8-2e37-48be-ac71-34bd144850f6 | test1pop@mytestdomain.com        |
| 775 | d2a8b102-76df-4b99-a06a-ca64be3eae5d | testuser@mytestdomain.com        |
+-----+--------------------------------------+----------------------------------+
  • If we have only one domain then we can run MySQL query without where clause.
$ mysql -e 'select id, account_id, comment from zimbra.mailbox;'


2). Now we have to re-create accounts on LDAP with same zimbraId:-

$ zmprov ca it@mytestdomain.com test1234 zimbraId 'ee4b049a-3d99-4908-b2b8-5cb069350ec8'
$ zmprov ca testadmin@mytestdomain.com test1234 zimbraId 'c01cfd8d-69d9-44c8-8234-99371fd19205'
$ zmprov ca test1pop@mytestdomain.com test1234 zimbraId '1e4645e8-2e37-48be-ac71-34bd144850f6'
$ zmprov ca testuser@mytestdomain.com test1234 zimbraId 'd2a8b102-76df-4b99-a06a-ca64be3eae5d'


3). After above steps we have to check and verify the mailbox id, quota details, folder and mail counts of created accounts:-

$ zmprov gmi it@mytestdomain.com
mailboxId: 771
quotaUsed: 5668
$ zmmailbox -z -m it@mytestdomain.com gaf 

Regards,
Heera Singh Koranga

Jump to: navigation, search