Qmail-ldap addresses to Zimbra
Hi all,
I have qmail-ldap users data in ldif format. I don't migrate any data but only the mail addresses. We are currently using pop accounts an pop will be used with Zimbra too. Anyone can show how i can inject this user data to Zimbra ldap user data?
Ther will be no qmail-ldap running server, i just need to transfer all userbase from qmail-ldap to Zimbra platform. If i could achieve this, we will decide to go with Zimbra Network Edition. Since we have around 5000 users, i really must complete this transfer.
Check sample below;
-----------------------------------------
dn: cn=osman balta,ou=dazlama.com.tr,dc=mail.kazma,dc=com
objectClass: top
objectClass: person
objectClass: qmailUser
cn: osman balta
sn: osman balta
mail: obalta@dazlama.com.tr
uid: obalta
accountStatus: active
userPassword:: e2NyeXB0fWVWM2o3Yjg2dXh2NU0=
mailHost: mail.dazlama.com.tr
mailMessageStore: dazlama.com.tr/obalta
deliveryMode: localdelivery
creatorsName: cn=Manager,dc=mail.kazma,dc=com
createTimestamp: 20041230224830Z
modifiersName: cn=Manager,dc=mail.kazma,dc=com
modifyTimestamp: 20041230224830Z
structuralObjectClass: person
entryUUID: 252c8bea-3763-102a-8c62-a57cced4ec9e
entryCSN: 20060221201946Z#000000#00#000000
-----------------------------------------
Thank you to all fellow coders,
Cheers,
Qmail-ldap conversion script
Hope someone could use this little script;
PHP Code:
<?
$fx = fopen("result.sh", "w");
$fd = fopen("test.ldif", "r");
$name_pattern = "/sn:/";
$mail_pattern = "/mail: /";
while(!feof($fd)) {
$line = fgets($fd, 4096);
if(preg_match($name_pattern, $line)) {
$splitdata = explode(':',$line);
$name_tmp = trim("$splitdata[1]");
$nsp = explode(" ", $name_tmp,2);
$name = $nsp[0];
$surname = $nsp[1];
}
if(preg_match($mail_pattern, $line)) {
$splitdata = explode(':',$line);
$mail_tmp = trim("$splitdata[1]");
$write_line = "zmprov createAccount " . $mail_tmp . " \"\" userPassword 12345 givenName \"" . $name . "\" sn \"" . $surname . "\" zimbraPasswordMustChange TRUE \n";
fwrite($fx, $write_line);
}
}// while end
fclose($fd);
fclose($fx);
?>
Conditions;
1. As you can imagine this script is NOT FOR BEGINNERS. Please check the code and then use it.
2. qmail-ldap uses MD5 and Zimbra uses SSHA for encryption password area. I had to reset password to 12345 value, you can change or can find a better way to integrate. Please let me know for any solution.
3. All users forcing to change their password at first login
4. Please create result.sh before run this script, please rename qmail-ldap ldif file to test.ldif and put the same directory.
5. Take result.sh copy to the /opt/zimbra/backup (create this dir as zimbra user)
6. su - zimbra
7. sh result.sh
You should wait a little while according to amount of users.
Take care all, thank you Zimbra creators and all fellows