hi,

i.m using mysql+vpopmail configuration and export users with scripts

i have created 3 scripts in sequence for export users of vpopmail to LDAP

1- LDAP REMOVE - Execute the command (ldap_remove.sh > remove.ldif)
2- LDAP CREATE OU - Execute the command (ldap_create_ou.sh > ou.ldif)
3- LDAP IMPORT USERS - Execure the comand (ldap_create.sh > users.ldif)

After the files .ldif created, import to LDAP using ldapadd.

OBS: config the outlook and webmail to access the base for LDAP
(ou=Addressbook,dc=teste)

Verify the scripts bellow:

##### ldap_remove.sh ###################
date > /usr/util/Gerar_OU_Lista_Remocao.log
for domains in `ls ~vpopmail/domains`
do
                        OU="$domains"
                        OBJCLASS1="objectClass: top"
                        OBJCLASS2="objectClass: organizationalUnit"
                        DN="ou=$domains,ou=AddressBook,dc=test"

                        printf "$DN\n"

done

date >> /usr/util/Gerar_OU_Lista_Remocao.log
exit 1

##### ldap_rcreate_ou.sh ###################
#!/bin/bash

date > /usr/util/Gerar_OU_Lista.log
for domains in `ls ~vpopmail/domains`
do
                        OU="$domains"
                        OBJCLASS1="objectClass: top"
                        OBJCLASS2="objectClass: organizationalUnit"
                        DN="ou=$domains,ou=AddressBook,dc=test"

                        printf "dn: $DN\n"
                        printf "ou: $domains\n"
                        printf "$OBJCLASS1\n"
                        printf "$OBJCLASS2\n\n"
done

date >> /usr/util/Gerar_OU_Lista.log
exit 1
##### ldap_create_ou.sh ###################

##### ldap_create.sh ###################
#!/bin/bash

date > /usr/util/Gerar_Lista.log
for domains in `ls ~vpopmail/domains`
do
                    OBJO=`echo $domains|cut -d. -f1`

                for NOME in `/home/vpopmail/bin/vuserinfo -D "$domains" -n`
                do
                        MAIL="[EMAIL PROTECTED]"
                        CN=`~vpopmail/bin/vuserinfo -c $MAIL`
                        OBJCLASS1="objectClass: top"
                        OBJCLASS2="objectClass: inetOrgPerson"
                        DN="$CN,OU=$domains,OU=AddressBook,dc=test"

                        printf "dn: cn=$DN\n"
                        printf "mail: $MAIL\n"
                        printf "cn: $CN\n"
                        printf "sn: $CN\n"
                        printf "o: $OBJO\n"
                        printf "$OBJCLASS1\n"
                        printf "$OBJCLASS2\n"
                        printf "\n"
                done
done
date >> /usr/util/Gerar_Lista.log
exit 1
##### ldap_create.sh ###################



> I have successfully setup the LDAP authentication backend for vpopmail
> without too many problems, and it is working.  What I would like to do now
> is integrate this with an LDAP addressbook for my corporate users.  I
> haven't had much luck in finding definate solutions for this yet, so I'm
> hoping someone here has done this before.
>
> --
> Will
>


Reply via email to