Submitted by airshock on Sat, 05/31/2014 - 17:13
Hi,
I followed the instructions found at http://www.virtualmin.com/documentation/id,combining_virtualmin_and_ldap/ and was successfully able to set up LDAP on my server. However, I have a lot of existing virtual servers on this server, and am therefore wondering how to migrate my existing user accounts, mail aliases, virtual domains, etc. to LDAP.
Is this possible?
Thanks, -Logan
Status:
Active
Comments
Submitted by JamieCameron on Sun, 06/01/2014 - 16:09 Comment #1
We don't have any automation setup for user migration. However, one thing that should work is backing up your domains, deleting them, and then restoring on the same Virtualmin system. This should re-create the users and aliases in LDAP.
Try this one domain at a time though, to make sure it works!
Submitted by airshock on Sun, 06/01/2014 - 21:04 Comment #2
Hi Jamie,
Thanks for your response. After following the documentation linked to in my original post, I have the DN for users set to dc=clients,dc=airshock,dc=net and the DN for groups set to dc=groups,dc=airshock,dc=net.
My question is, when restoring virtual servers as you mentioned in your post, how can I tell Virtualmin to create users and groups in these respective DNs?
Thanks!
Submitted by JamieCameron on Sun, 06/01/2014 - 22:55 Comment #3
You need to configure this in the LDAP Users and Groups module, which is in Webmin under the System category. You can verify that the correct DN base is being used by creating a user and group in that module.
Submitted by airshock on Mon, 06/02/2014 - 10:56 Comment #4
So once I do this I just backup all virtual servers, delete them, and then re-create them and I should have LDAP users imported? Is there anything else I need to do, or any special options to check when backing up or restoring virtual servers?
Submitted by JamieCameron on Mon, 06/02/2014 - 13:43 Comment #5
Yes, that should work - assuming that your system is already configured to use LDAP for new domains.
But please try this one domain at a time though, in case it doesn't work.
Submitted by airshock on Mon, 06/02/2014 - 14:51 Comment #6
Just to be sure, when I try this on just one domain, how can I check to see if everything worked as it should? e.g. what are the steps to take to confirm LDAP is working after deleting and re-creating one domain?
Submitted by JamieCameron on Mon, 06/02/2014 - 16:26 Comment #7
I guess check if the domain's website still works, if you can login as the domain owner, and ensure that the user and group aren't in /etc/passwd and /etc/group respectively.
Submitted by airshock on Wed, 06/04/2014 - 12:30 Comment #8
So I've run into a little problem with LDAP. I went to the LDAP Client module in Webmin and hit Validate Configuration to test that everything works, and it is fine until it gets to the "Looking for Unix user example" step, where it says the user does not exist. But the LDAP Browser shows me that there is a user named example and it does exist in the right DN and etc. And when I created my DN for users, I did check the "Create Unix user object" box or whatever as indicated in the "Combining Virtualmin and LDAP" article. What could be the problem?
Submitted by JamieCameron on Wed, 06/04/2014 - 13:13 Comment #9
Make sure that your system is configured to fetch Unix users from the LDAP server - this can be done in the LDAP Client module, under "Services using LDAP"
Submitted by airshock on Wed, 06/04/2014 - 13:24 Comment #10
Already done, as per the documentation article. Here is the output from the validator:
Validating LDAP Configuration
Finding LDAP base for users .. .. found base dc=clients,dc=airshock,dc=net.
Connecting to LDAP server .. .. connected to 127.0.0.1
Searching for users .. .. found 1 users.
Checking Unix users service .. .. service is setup to query LDAP.
Looking for Unix user example .. . user does not exist.
I found a thread about creating /etc/nslcd.conf and I did that as per the comments in the file, and then started NSLCD with /etc/init.d/nslcd start, and it started OK but the validation is still failing.
Submitted by airshock on Wed, 06/04/2014 - 15:29 Comment #11
If you'd like, Jamie, I can send you login details for my server if you want to take a look at things. I am very new to LDAP and it seems the documentation on the Virtualmin site doesn't take into account CentOS 6 and its use of NSLCD, slap.conf, etc. (the article was apparently written in 2009). Thanks!
Submitted by JamieCameron on Thu, 06/05/2014 - 00:17 Comment #12
You can email me login details at jcameron@virtualmin.com
Submitted by airshock on Thu, 06/05/2014 - 01:08 Comment #13
Hi Jamie, I just sent login details. Thanks for taking a look at this. :)
Submitted by JamieCameron on Thu, 06/05/2014 - 12:56 Comment #14
Thanks, I see the problem and was able to fix it on your system.
Basically, in your
/etc/nslcd.conf
file the linescope base
had to be changed toscope sub
so that LDAP users in sub-"directories" could be found. Also, I had to run/etc/init.d/nslcd restart
.The deeper issue is that Virtualmin doesn't properly automatically configure LDAP on CentOS 6. I'll also work on fixing that.
Submitted by airshock on Thu, 06/05/2014 - 13:31 Comment #15
Thanks so much for fixing the issue, Jamie! I edited nslcd.conf manually yesterday following the comments in the file and didn't know what to do with the sub lines. But now the configuration validator works perfectly.
The only problem I am facing now is that when I go to restore my virtual servers, it throws an error because it's trying to create a Unix group but one with the same name already exists. I know how to fix it--just delete the group with the same name--but my concern is, why is it wanting to create Unix users and groups? It should be creating LDAP users and groups, right? I mean now that LDAP is set up properly.
Thanks, -Logan
Submitted by airshock on Thu, 06/05/2014 - 21:45 Comment #16
Another issue that I run into when restoring virtual servers is that the alias cannot be created because the error "no structural object class provided" shows up. I followed the instructions in the documentation about changing the LDAP schema for Postfix and etc. but that still doesn't fix the problem.
Submitted by JamieCameron on Fri, 06/06/2014 - 00:01 Comment #17
When you say the group already exists, do you mean that it exists in /etc/group on the system?
Or that it already exists in LDAP?
Submitted by airshock on Fri, 06/06/2014 - 13:07 Comment #18
It already existed in /etc/group. I went in and deleted all the stray users and groups left behind from when I used Virtualmin to backup the servers and then delete them, and now when I restore the servers it doesn't create users and groups in LDAP, but rather in /etc/passwd and /etc/group, and when it tries to create aliases and add domain mailboxes it fails with the "no structural object class provided" error mentioned above.
Submitted by JamieCameron on Sat, 06/07/2014 - 01:11 Comment #19
I can login to your system again and look into this - just let me know where the backups you are trying to restore are located.
Submitted by airshock on Mon, 06/09/2014 - 23:02 Comment #20
Good news - I was finally able to get LDAP support working after spending over a week on this. I ended up setting up LDAP on a new Ubuntu 14.04 cloud server instance because I kept getting stuck with problem after problem on my main CentOS dedicated server, plus I figured it would be a good idea to have LDAP off-site so that if the primary server goes down, the LDAP machine, which is on a popular cloud provider's network, will remain active. It was a lot easier to get LDAP running on Ubuntu, even by following the outdated documentation on the Virtualmin site, and my guess as to why is that CentOS and Ubuntu probably handle LDAP differently. Anyway, it would be nice to be able to get to the bottom of why I couldn't get LDAP support working on CentOS, so that if I ever want to get it going on CentOS, or if any other Virtualmin users wish to do so, it can be done cleanly. It would also help if the Virtualmin documentation on LDAP was updated as it seems like it hasn't been touched since 2009.
Jamie, thank you for all of your help on this issue. I appreciate all of the work you've done and suggestions/comments/tips/answers you've given. If you'd like to work with me to get LDAP running on CentOS and fix the remaining problems that were there I would be happy to try this with you.
Thanks!
Submitted by ashleydrees on Tue, 06/24/2014 - 11:32 Pro Licensee Comment #21
A very interesting thread. I too am about to set up LDAP on my fresh Ubuntu 14.04 LTS, but was worried that the how-to was a bit out of date..
Do you have any notes about issues you encountered with setting this up.
Submitted by airshock on Thu, 06/26/2014 - 10:53 Comment #22
Hi Ashley,
I apologize for not getting back to this thread sooner. Anyway, I am writing up a blog post now that details the steps I took to get LDAP working and should have that done in just a little bit, so I'll post a link here when done.
Thanks!
Submitted by ashleydrees on Thu, 06/26/2014 - 12:03 Pro Licensee Comment #23
airshock
Thanks in advance, i have been putting this one off till all the other bits are in place, will try and wait till you have it up as i do not want to go down any blind alleys.
Submitted by airshock on Thu, 06/26/2014 - 12:16 Comment #24
Here is a link to the blog post I just wrote up on this: https://blog.airshock.net/ah-ubuntuldap/
Please feel free to post in the comments of that blog or here in this issue if you have any problems or questions, or need me to walk you through something in more fine-grained detail (which I will be happy to do).
Thanks!
Submitted by ashleydrees on Sun, 07/13/2014 - 02:56 Pro Licensee Comment #25
Airshock.
Just wanted to say thanks as with the help of your blog and the various posts, i got it up and running very well.
Are you planning to set up replication to other LDAP servers at some point?
Submitted by airshock on Sat, 07/26/2014 - 16:16 Comment #26
My apologies for not getting back to your message in a timely manner. I'm glad that I and others were able to help you get your system configured.
I haven't thought about LDAP replication but now that you mention it I may want to replicate my user base to another server in the future. I don't know how to configure replication at this point though and would have to do research in order to figure out just how it's done.
Thanks, -Logan
Submitted by ashleydrees on Sat, 07/26/2014 - 18:53 Pro Licensee Comment #27
Re replication - There is a good write up in the Ubuntu 14.04LTS docs... the docs were very helpful in getting the schemas i wanted installed - would be good to have several copies of the main Ldap DB
However, i think i have to sort out my certs before i try the replication.
Submitted by JamieCameron on Sat, 08/09/2014 - 13:14 Comment #28
FYI, the upcoming 1.700 Webmin release will better support LDAP client setup on CentOS 7.