Results 1 to 3 of 3

Thread: Qmail-ldap addresses to Zimbra

  1. #1
    Join Date
    Dec 2006
    Posts
    3
    Rep Power
    9

    Default 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,

  2. #2
    Join Date
    Aug 2005
    Posts
    228
    Rep Power
    10

    Default

    Your easiest route is to take your ldif and convert it into zmprov commands, which is the Zimbra CLI for provisioning accounts, domains, etc.

    You should be able to do something like:

    Code:
    zmprov 
    prov> createDomain dazlama.com.tr # if the domain hasn't been created yet
    
    # then for each account:
    
    prov> createAccount obalta@dazlama.com.tr "" \
        userPassword e2NyeXB0fWVWM2o3Yjg2dXh2NU0= \
        givenName "first" sn "last"
    Using createAccount will properly create the LDAP entry, populate required fields, etc. The easiest way to find out the other attributes you can pass in is to either look in zimbra.schema (do a find under /opt/zimbra), or to create an account in the admin console GUI and set all the fields, then use an LDAP browser or "zmprov getAccount {name}" to dump it.

    Don't forget the "" after the account name, it means to not give the account password (it is normally the cleartext password), since we are passing in an existing hashed password in userPassword.
    Bugzilla - Wiki - Downloads - Before posting... Search!

  3. #3
    Join Date
    Dec 2006
    Posts
    3
    Rep Power
    9

    Default 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

Similar Threads

  1. Zimbra Install Problem - getDirectContext
    By bsimzer in forum Installation
    Replies: 27
    Last Post: 07-19-2007, 11:12 AM
  2. Post instsallation problems
    By Assaf in forum Installation
    Replies: 14
    Last Post: 01-29-2007, 11:38 AM
  3. huge log size
    By rmvg in forum Administrators
    Replies: 5
    Last Post: 01-02-2007, 10:39 AM
  4. Unable to start tomcat
    By chanck in forum Administrators
    Replies: 11
    Last Post: 06-11-2006, 01:58 AM
  5. port 7071 not listening OS X install
    By leeimber in forum Installation
    Replies: 7
    Last Post: 03-21-2006, 10:47 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •