setting up ldap in offline environment

setting up ldap in offline environment

by Jeannie Colson -
Number of replies: 24

I'm afraid I need hand holding here, so I apologize in advance. We're setting up an offline web-like environment in prison classrooms/labs where we teach. We have a server that has MS-AD functioning. We have another "box" that provides the content, which includes Moodle. I want to set up moodle to use AD to obtain and authenticate users. I've been reading https://docs.moodle.org/31/en/LDAP_authentication and am such a newbie that I'm not sure if the directions in blocks such as "distinguished name" are capable of copy/paste or if I'm supposed to be putting localized info in place rather than dc=my,dc=organization.... If localized, do I create what I need within this segment of Moodle, or is it something that I need to get from elsewhere? 


Thanks for helping!


Average of ratings: -
In reply to Jeannie Colson

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

I am really not sure what you are asking - copy paste?  What from where?

Your moodle server needs to be able to access your AD.  

I have attached two screenshots showing basic settings.  The host url should be the ip or the dns name of the AD server.

You should create a user in AD that has permissions to read and write on the user directory.  The context needs to point to the OU that your Moodle users are listed in.

The user attribute should be set to samaccountname.  This will link the moodle users and the AD users by username.

Set it up and then come back if it doesn't work with any error messages.

  

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Jeannie Colson -

I'm sorry for not being clearer. I understand the need to locate the url.  At the link in my post, in the section on distinguished user, the author wrote: <snip>Just type "cn=ldap-user,dc=my,dc=organization,dc=domain" (without the quotes).</snip> My question is along the lines of whether "ldap-user," "my," "organization," etc., from that snippet are placeholders for my terms (I'm in a college in a prison. So, i'm thinking our ldap-user would be student, instructor, monitor, or admin. dc would be...name of school?, dc is lee.edu (we're lee college, www.lee.edu).) OR whether the author really wants me to copy/paste without editing at all.


Would you point me to the documentation that will define the abbreviations we're using here? Please?

In reply to Jeannie Colson

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

They need to specify the location of the user in your ad scenario.  cn is the distinguished name of the ldap user.  ou is for the organizational unit that the user is in (sometimes there are two or three levels), then you split your domain so yours would be something like: cn=yourspecificuserdistinguished name,ou=the folder that your user is in,ou=any folder above that,dc=lee,dc=edu

If you look at my attached screenshot from the Active Directory, my bind user is in the MoodleUsers folder, so my bind user setting in moodle would be cn=Moodle Bind User,ou=MoodleUsers,ou=People,dc=mydomain,dc=com


In reply to Emma Richardson

Re: setting up ldap in offline environment

by Jeannie Colson -

Thanks so much! This helps a great deal. 

About your specific example: MoodleUsers = the directory Moodle Students? So, where the students are listed is always moodleusers?

Bind: is that a particular student? Particular setup?

In reply to Jeannie Colson

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Sorry that was probably confusing.  I happened to have the Moodle Students highlighted but my bind user is actually in the MoodleUsers folder.  It is the folder below.  Ignore the fact that Moodle students is highlighted.

The bind user is a user that you create specifically to connect moodle to your ad.  The user has to be able to read the user information from your AD and write and delete if you want to be able to update from moodle.

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Jeannie Colson -

Thanks. That makes sense. Now, one more, and I may be done! Same person, the distinguished name: any reason to NOT do ldap-user (literally) rather than a human? kind of like we use admin?

In reply to Jeannie Colson

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You can call it purple unicorn if you want - as long as moodle knows what the name is, it does not matter what the name is.  The distinguished name is what it will look for in AD, not the username, btw.

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Jeannie Colson -

oooh!  I like purple unicorn much better than ldap-user! 


thank you very, very much for all the help. I am fairly confident I can do this...fairly....

In reply to Jeannie Colson

Re: setting up ldap in offline environment

by Melanie Scott -
Picture of Particularly helpful Moodlers

I wonder if I can get my back-end admin to call ldap purple unicorn...We're moving to Office 365 soon, and I suspect I'll want to call it something else (probably not appropriate in a polite forum) soon.

Curiosity is eating at me...is it a moodle site for teaching offenders or for teaching staff?  It kind of matters.  I run a moodle site for correctional staff.

In reply to Melanie Scott

Re: setting up ldap in offline environment

by Jeannie Colson -

That's my context... I"m in TX. You?

In reply to Jeannie Colson

Re: setting up ldap in offline environment

by Melanie Scott -
Picture of Particularly helpful Moodlers

Kansas.  We've been running moodle for...well, since 1.4.  Which was a long time ago.  2 was such a tremendous leap.  We actually have 3 sites...one for staff, one for very specific contractors and one for inmates completing college coursework.  I run the staff one and consult on the contractors site.  I stay away from the inmate site.

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Maverick IT -

followed the same process but getting this error . I am using standalone version 3.1 of moodle. Help will be highly appreciated



Attachment LDAP moodle error.jpg
In reply to Maverick IT

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Bind result normally means that your bind user credentials are wrong or you have it listed wrong in your moodle settings.  You did create the user in AD first right?  Can you post a screenshot of your settings (black out any sensitive material)?

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Maverick IT -

Thnq for the quick response. I am in windows 2012 AD environment  and the moodle is standalone installer installed on windows 7 .I strongly believe that , this should not be any cause of LDAP authentication error, please find below the snapshots.There is no settings related issue on DC/AD for LDAP.


Pls revert.



Attachment AD snapshot.jpg
Attachment LDAP.jpg
In reply to Maverick IT

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

You have a space in the distinguished name for moodle user that is not in your bind user setting in Moodle.  Try adding the space and see if that helps.  The rest seems ok as long as your moodleusers ou is a top level ou and not under anything else like users or people.

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Maverick IT -

Still the error :


LDAP-module cannot connect to any servers: Server: '192.168.0.3', Connection: 'Resource id #13', Bind result: ''


Do i need to give any special permissions to the "moodleuser" (which i m using for ldap )authentication??

In reply to Maverick IT

Re: setting up ldap in offline environment

by Maverick IT -
Thnx a lot...it started working now...But after entering user credentials it is getting authenticated but the data from AD is not getting imported.. It is showing the below mentioned screen.


 


Attachment ldap users.jpg
In reply to Maverick IT

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Do you have the data mapping set up correctly at the bottom of the screen?

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Maverick IT -
  Bingo ..its fixed now ..

I just hve one sentence for you..  " May u b blessed forever with health wealth happiness ""... You truly helped me a lottt...Would like to hve ur personal FB ID.
Had I been in ur city thn I wud hv given u d best treat ..    !! smile
In reply to Maverick IT

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Happy to help!  LDAP can tricky to set up - I got a lot of help when I first attempted it too!

In reply to Emma Richardson

Re: setting up ldap in offline environment

by Maverick IT -

what is the disadvantages of using moodle full windows installer?. Since I hve installed windows full moodle package 3.1 , is it possible for me to migrate this moodle to normal moodle (which includes spearate installation of apache/sql etc)>? pls help..Precisely , let me know the advantages of single moodle complete installer over the other moodle which requires all other things to be installed speparately

In reply to Maverick IT

Re: setting up ldap in offline environment

by john attwood -

Not many disadvantages on Windows for  Development Environment  just depends on which WAMP stack you  want to use. Definitely not all WAMP stacks are equal.  I like XAMPP and Bitnami.  I personally use Bitnami of late. 


On Windows I cannot imagine a situation where you would want to separately install those elements since they are all native to a Linux environment.  You would just be making a lot of work for yourself.  Tweeking is one thing but install separately is not necessary because your just reinventing the wheel. 


By "normal moodle" did you mean install on Linux ?   You can still use the packaged installers and if you are going to roll out a number of servers you'll want the file structure to be the same which I like Bitnami for this as well. Also if your not experienced with Linux the packaged installers are the only way to go. There are many  "CLI" syntactical issues you will be forced to deal with especially if you come from the Windows world. Some of those are no fun at all especially if you have a limited amount of time. The packaged installers give you a basic security model to work from you can tweek as you gain familiarity with the issues. 


So if your migrating from Windows to Linux here are my tips if your not familiar with Linux:

*If either one has active users put into Moodle into "Maintenance Mode".

1.  Identify your WAMP stack versions; Apache, MySql and PHP.  

2. Find a LAMP stack with equal or newer versions. This might be available from your hosting solution, otherwise find one yourself. XAMPP or Bitnami. I'd go with the all in one. But if you "must" just install the Moodle module separately. (not covered here) follow stack instructions or manual moodle install instructions. 

3. Match your Moodle version or go with newer if you must on the Linux server. 

4.  Once you've got everything installed and your "blank Moodle" up and running on the new Linux Server. You can access it from browser. Make sure you can  login and everything is working click around inside your Moodle. 

5 Go back to your WAMP server and backup the Moodle MySql database. You can use phpmyadmin  you should get a XXXX.sql file 

6. Go to your Linux server copy the XXXX.sql file to it. You can use some type of GUI manager like; Control Panel, Plesk or Webmin.

7. Restore the XXXX. sql file to the Moodle MySql database that's sitting on your Linux server. 

8. Copy over the "contents" of your moodledata folder from WAMP server to .../moodledata  on Linux Server. 

9. Login to Linux Server Moodle Course check your links check your user created data like something uploaded pic or word doc. Make sure they work. If they don't go back to moodledata folder check Linux permissions. 

8. Set permissions on your moodledata folder to 755 (recursive)  you can do this in Control Panel-File Manager, Plesk File Manager or Webmin File Manager whatever is available. Go back reload the page and check links again.  IF this doesn't work go back a second time set your permissions to 777 (recursive)...repeat. If it still doesn't work...Welcome to Linux.

9.  FFR (FDISK, FORMAT, REINSTALL)......or another way to say it delete start over from beginning or try your hosting service they might be able to help (don't get your hopes up) or  find an experienced Linux admin to help you out. Or do a buttload of reading/tbshoot and figure it out yourself. 


End Note:

Cutting and Pasting Linux Commands. This can work if your matched on Linux flavor (very important) and version (less important). I wouldn't do it on a production server because you can wind up hosing your server before you know it especially concerning Permissions. Permissions in Linux can really put the hurt on ya if you start getting slap happy and after you read though a few man pages and google articles on these type things, you will become....slap happy. 


Hope this helps.

John




In reply to john attwood

Re: setting up ldap in offline environment

by Maverick IT -

thnQ john for the reply.. I m 4m windows world Linux is greek/latin/mandarin for me ..I wanted to know that , since I am installing windows packaged isntaller of moodle on my windows 7(host). I made all the necesary chnges in DNS /AD/LDAP  to ensure smooth use of moodle by the users. My only concern is will there be any difficulty of managing data inside the moodle. I m planning to take a backup of moodle on regular basis(moodle backup and host backup as well)..In future , if req , can i migrate non packagaed moodle isntallation on windows platform only with IIS SQL server .I hve approx 1500 users who will b using this moodle as of now.but the hsot is very strong with 32GB & xeon processors (virtual). Am i doing anything wrng here which may mess up the moodle in future?is my setup fine?,=users will be authenticated via LDAP

In reply to Maverick IT

Re: setting up ldap in offline environment

by Emma Richardson -
Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers

Moderator, this discussion needs split and moved to installation forum.