The script takes 4 values from CGI:
Code:
cgi['user'], cgi['pass'], cgi['fname'], cgi['lname']
username, password, first name, last name (just to keep with proper SN syntax)
The if clause is if it finds the user already in ldap. The else if it's not. All the
Code:
ldapfile.write ".....
are the LDIF information written to the file, and the file is called using ldapadd / ldapmodify.
After the if/else is the zimbra shell script. Just 2 lines, the "scriptfile.puts", and the file is scp'd to the Zimbra server, under the zimbra user, and I run and delete the script over ssh. I set up ssh keys between the web interface server and the zimbra user.
I had a migration script that used part of this too. There may be better ways to do this than using command line utilities, but this was quick and easy. My web interface for this little script is just a form with 4 boxes. I haven't written anything fancy for it yet. At some point I'll probably make a LDAP manager, since I use the LDAP for my *nix authentication as well.