.oO  |  List directory  |  History  |  Similar  |  Print version
Home 
Main 
   Databases 
   qmail 
   Old Braindump Pages 
Linux 
FreeBSD 

Main > qmail > Migrate vpopmail accounts to ldap

 
rw-rw-r--   ian   linux

Migrate vpopmail accounts to ldap

1. Dump the accounts from MySQL

mysqldump -u root -p vpopmail vpopmail > vpopmail.mydump

2. Convert mysql dump to LDIF with reformatting

awk -F\' 'BEGIN {OFS="\n";} NF==15 {print "dn: cn="$8",ou="$4",ou=qmail,o=company","cn: "$8,"objectClass: top","objectClass: person","objectClass: qmailUser","mail: "$2"@"$4,"sn: "$8,"uid: "$2"@"$4,"mailMessageStore: "$10,"userPassword: {CRYPT}"$6,""}' vpopmail.mydump > qmail-ldap.ldif

Accounts which contain an apostrophe will be missing (O'Reilly) because that is what we're using for delimeters. Find offenders with:

awk -F\' 'NF > 15' vpopmail.mydump

3. Manually add a section to the top of the LDIF file to create each domain OU. You should also clean up any records which are obviously invalid.

dn: ou=domain.com,ou=qmail,o=company
objectClass: top
objectClass: organizationalUnit
ou: domain.com
description: domain.com

4. Import the LDIF file into the LDAP directory

ldapadd -vx -h localhost -D "cn=manager,o=company" -W -f qmail-ldap.ldif


Reference http://braindump.mrzesty.net/Main/MigrateVpopmailAccountsToLdap

Comments: 0 New comment

Prev. qmail-ldap with Simscan   dspam v3.0 for qmail Next


Home | Main | Linux | FreeBSD