Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    zaraf2kopano ldap-script

    Scripting
    3
    8
    889
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • rseir
      rseir last edited by fbartels

      Hi!

      I used your script (look below) from https://documentation.kopano.io/kopano_migration_manual/zcp_migration.html and everything works fine!
      The only problem is, that the selection hook (kopanAccount=1) ist NOT checkt like zarafaAccount=1.
      That doesn’t matter for 10 Users but for 500… Just a little irritating!!

      Regards
      Rainer

      #!/bin/bash
      
      LDAP_HOST="localhost"
      LDAP_USER="cn=root,dc=kopano,dc=com"
      LDAP_PASSWORD="ThisIsMySecretPassword"
      LDAP_LDIF="/tmp/zarafa2kopano.ldif"
      
      grep ^attributetype /usr/share/doc/packages/zarafa/zarafa.schema -A1 | grep NAME | sed -e 's#.*NAME..##g' -e 's#.$##' | while read line; do
              new_attrib="`echo $line | sed 's#zarafa#kopano#'`"
              ldapsearch -o ldif-wrap=no -LLL -x $line=* dn $line | sed "s#$line: \(.*\)#changetype: modify\nadd: $new_attrib\n$new_attrib: \1\n-\ndelete: $line\n$line: \1\n-#" >> "$LDAP_LDIF".step2_attribute_data
      done
      
      
      # We now have the LDIF, we now need to extend the objects with the new objectClass.
      grep ^dn "$LDAP_LDIF".step2_attribute_data | sort | uniq | sed 's#dn: ##' | while read dn; do ldapsearch -o ldif-wrap=no -LLL -x -s base -b "$dn" objectclass | egrep '(^dn|zarafa)' | sed -e '/^objectClass/  s#zarafa#kopano#' | sed 's#objectClass:\(.*\)#changetype: modify\nadd: objectClass\nobjectClass:\1\n#'; done >> "$LDAP_LDIF".step1_objectclass_extend
      ldapmodify -h "$LDAP_HOST" -D "$LDAP_USER" -w "$LDAP_PASSWORD" -f "$LDAP_LDIF".step1_objectclass_extend
      
      # We are done with the LDIF, now lets do it.
      ldapmodify -h "$LDAP_HOST" -D "$LDAP_USER" -w "$LDAP_PASSWORD" -f "$LDAP_LDIF".step2_attribute_data
      
      grep ^dn "$LDAP_LDIF".step2_attribute_data | sort | uniq | sed 's#dn: ##' | while read dn; do ldapsearch -o ldif-wrap=no -LLL -x -s base -b "$dn" objectclass | egrep '(^dn|zarafa)' | sed 's#objectClass:\(.*\)#changetype: modify\ndelete: objectClass\nobjectClass:\1\n#'; done >> "$LDAP_LDIF".step3_objectclass_remove
      ldapmodify -h "$LDAP_HOST" -D "$LDAP_USER" -w "$LDAP_PASSWORD" -f "$LDAP_LDIF".step3_objectclass_remove
      
      # Clean up
      rm -f "$LDAP_LDIF.step1_objectclass_extend"
      rm -f "$LDAP_LDIF.step2_attribute_data"
      rm -f "$LDAP_LDIF.step3_objectclass_remove"
      
      1 Reply Last reply Reply Quote 0
      • fbartels
        fbartels Kopano last edited by

        Hi @rseir,

        as far as I can see the script you posted is identical to the one in the wiki. What is your question exactly?

        Regards Felix

        Resources:
        https://kopano.com/blog/how-to-get-kopano/
        https://documentation.kopano.io/
        https://kb.kopano.io/

        Support overview:
        https://kopano.com/support/

        1 Reply Last reply Reply Quote 0
        • rseir
          rseir last edited by rseir

          After running the script (of course adapted) everything but the Checkbox for kopanoAccount=1 Attribute was ok!
          So you have to edit each user to klick the selection hook!
          Not funny with 100 and more accounts!

          Regards Rainer

          fbartels 1 Reply Last reply Reply Quote 0
          • fbartels
            fbartels Kopano @rseir last edited by

            @rseir said in zaraf2kopano ldap-script:

            So you have to edit each user to klick the selection hook

            What is a “selection hook”?

            @rseir said in zaraf2kopano ldap-script:

            everything but the Checkbox for kopanoAccount=1 Attribute was ok

            then what did it show?

            The beauty of a bash script such as the one above is that you can easily dissect what it does. For example when removing the last three rm commands you can see which ldap files he was importing. so you could for example comment all the ldapmodify commands, have a look at the generated ldif files. fix whatever you think is necessary in them (this can then for example also be done with sed & co) and the run the ldapmodify commands separately.

            No need edit account manually after import (and no need for exclamation marks after each sentence).

            Regards Felix

            Resources:
            https://kopano.com/blog/how-to-get-kopano/
            https://documentation.kopano.io/
            https://kb.kopano.io/

            Support overview:
            https://kopano.com/support/

            1 Reply Last reply Reply Quote 0
            • rseir
              rseir last edited by

              The Checkbox was empty!
              Everything else worked fine!

              fbartels 1 Reply Last reply Reply Quote 0
              • fbartels
                fbartels Kopano @rseir last edited by

                @rseir said in zaraf2kopano ldap-script:

                The Checkbox was empty

                kopanoAccount=1 is not really a checkbox, it’s a simple variable=value paring. In your source data this should have been zarafaAccount=1.

                I still do not understand what your question/intent is.

                Regards Felix

                Resources:
                https://kopano.com/blog/how-to-get-kopano/
                https://documentation.kopano.io/
                https://kb.kopano.io/

                Support overview:
                https://kopano.com/support/

                1 Reply Last reply Reply Quote 0
                • itserv
                  itserv last edited by

                  I think, Rainer means the checkbox is unchecked. “Die Checkbox ist nicht abgehakt”

                  1 Reply Last reply Reply Quote 0
                  • rseir
                    rseir last edited by

                    Yes! Indeed!
                    Variable, checkbox or whatever!
                    Seems to be excluded from migration…

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post