Steps to create users using mysql details where accounts accidently removed from the LDAP: Difference between revisions
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
== | {{BC|Certified}} | ||
__FORCETOC__ | |||
<div class="col-md-12 ibox-content"> | |||
=Create users using MySQL details where accounts accidently removed from the LDAP= | |||
<hr> | <hr> | ||
{{KB|{{ZC}}|{{ZCS 8.8}}|{{ZCS 8.7}}|{{ZCS 8.6}}|{{ZCS 8.5}}|}} | |||
{{WIP}} | |||
====Problem==== | |||
1st Scenario: LDAP got corrupt and we do not have latest LDAP backup. | |||
OR | |||
2nd Scenario: Somehow 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. | |||
'''1)'''. | After collecting all missing or removed account's details we will create the 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. | * Using the following command we can extract accounts' list from a particular domain. | ||
Line 38: | Line 45: | ||
'''2)'''. | '''2)'''. Now we have to re-create accounts on LDAP with the same zimbraId:- | ||
zmprov ca it@mytestdomain.com test1234 zimbraId 'ee4b049a-3d99-4908-b2b8-5cb069350ec8' | zmprov ca it@mytestdomain.com test1234 zimbraId 'ee4b049a-3d99-4908-b2b8-5cb069350ec8' | ||
Line 46: | Line 53: | ||
'''3)'''. After above steps we have to check and verify the mailbox id, quota details, folder and mail counts of created accounts:- | '''3)'''. After the 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 | zmprov gmi it@mytestdomain.com | ||
Line 55: | Line 62: | ||
{{Article Footer|ZCS 8.6|2018-08-13}} | |||
Revision as of 12:23, 13 August 2018
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: Somehow 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 account's details we will create the 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 the 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 the 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