First time here? Check out the FAQ!
3

Configure LDAP authentication
 

I can see a few people seem to have had success setting up askbot to authenticate against active directory but I'm having trouble with it, could anyone clarify how these fields should be used:

LDAP service provider name: I tried "Active Directory"

URL for LPAP service: I tried "ldap://10.23.2.1:389"

Explain how to change pwd: left blank

With these settings I get an Internal Server Error, and nothing inserted into the log.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
benstokes's avatar
31
benstokes
asked 13 years ago
Evgeny's avatar
13.2k
Evgeny
updated 13 years ago

Comments

see more comments

6 Answers

1

I've been fighting LDAP for a bit here, and found a couple tricks that helped me out.

First, if your LDAP requires authentication, just add this to your settings.py:

LDAP_LOGIN_DN = 'someldapuser'

LDAP_PASSWORD = 'somepassword'

Fill in the ldap read username/password.

Also, make sure to use the current git repository instead of the PyPi build, as it is out of date. Make sure that your external_keys.py has ldap, for me even when using git to build I had the out of date version. You can tell as the final setting will be indentica.

After that, go ahead and login with your admin user. Go into settings and configure your LDAP settings, then configure it again under external keys... I'm not sure which takes precedence. Finally, go into login providers and uncheck everything. Then recheck "Always display local login form" and "Activate Local Password Login". Don't worry, that's just going to force it to only use LDAP.

From there, you should be ok. I edited the log level in settings.py to be info for the purpose of getting all configs set correctly.

Hope this helps some others!

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
dreadpirate15's avatar
11
dreadpirate15
answered 10 years ago
link

Comments

see more comments
1

Koni's answer does not solve the problem because it does local login, not ldap.

I can't find any good explanation of the use of ldap on the site. Does it work or not? (I think not)

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
enrique's avatar
11
enrique
answered 12 years ago
link

Comments

Which version of LDAP protocol are you using? Askbot is hardcoded to work with v3. LDAP support was contributed by somebody else and we have not tested it thoroughly yet. If you have ability to test and debug - please look at the module askbot.deps.django_authopenid.backends.

Evgeny's avatar Evgeny (12 years ago)

Looked at the protocol again - it turns out we connect to LDAP without authentication, and if your directory does not allow anonymous lookup of data - it won't work. Also - please do check your log/askbot.log all LDAP errors are logged. Please tell me which one do you have?

Evgeny's avatar Evgeny (12 years ago)

I can connect with jxplorer using v3. But I can't make it work with askbot. We have authentication as mandatory, so we can't use it anonymously. There are no logs on the log folder. I am going to debug backends to see what happens

enrique's avatar enrique (12 years ago)

What is the point of using ldap on the login system if you dont use authentication?

enrique's avatar enrique (12 years ago)

On askbot.deps.django_authopenid.backends.py, on the method "ldap_authenticate", I connect to the ldap server and on the line "res = ldap_session.search_s(askbot_settings.LDAP_BASEDN, ldap.SCOPE_SUBTREE, user_filter, None)" fails throwing an exception "{'desc' : 'Bad search filter'}" It looks like its searching on a field called desc which does not exists. It should be "cn" not "desc"

enrique's avatar enrique (12 years ago)
see more comments
1

I got it working here: https://github.com/monkut/askbot-devel

I'm not sure if this will cover all LDAP configurations, but it's working for me now. You'll need to adjust the appropriate login configuration items so that the openauth items do NOT display, and to setup the ldap configuration values in settings/EXTERNAL_KEYS.

Only three files need to be updated:

  • deps.django_authopenid.views
  • deps.django_authopenid.backends
  • conf.external_keys

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
monkut's avatar
21
monkut
answered 13 years ago, updated 13 years ago
link

Comments

see more comments
1

I am using the 3 files from above, but I get: NameError at /account/signin/ global name 'ldap_provider_name' is not defined

Did install pip install python-ldap

Any ideas?

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
koni's avatar
11
koni
answered 13 years ago
link

Comments

1

Found the problem! Error in line 329: change to: login_provider_name = provider_name,

koni's avatar koni (13 years ago)
see more comments
0

I am sorry, LDAP authentication is broken. Marking as bug.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 13 years ago
link

Comments

Thanks for the update.

benstokes's avatar benstokes (13 years ago)

I'm trying to getting it working here, what area of code needs work?

monkut's avatar monkut (13 years ago)

any update here? is ldap authentication still broken?

anarcat's avatar anarcat (12 years ago)

There is an updated version in the repository which works for us.

Evgeny's avatar Evgeny (12 years ago)

@Evgeny: can you please suggest me which latest version of askbot supports LDAP and is bug free?

shubhamt's avatar shubhamt (5 years ago)
see more comments
0

Hi, I'm having trouble with LDAP auth. I'm geting this error:

/usr/local/lib/python2.7/dist-packages/askbot-0.7.43-py2.7.egg/askbot/deps/django_authopenid/forms.py TIME: 2012-07-09 14:25:17,267 MSG: forms.py:clean:77 unknown provider name

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Erick Almeida's avatar
73
Erick Almeida
answered 12 years ago
link

Comments

Ldap in that release is broken, will be fixed in the next.

Evgeny's avatar Evgeny (12 years ago)

There are a roadmap or schedule for next release? I get a git repo. If exist a fix I can apply and instal...

Erick Almeida's avatar Erick Almeida (12 years ago)

I'll make a final fix today and make an update on git today - will let you know. The release may take some extra time, a few days.

Evgeny's avatar Evgeny (12 years ago)

Erick, try branch "tag-editor" on the github, LDAP works for me there.

Evgeny's avatar Evgeny (12 years ago)

Evgeny, I install this branch. After on LDAP logon method I canot login in the system. The form for "local" register disapear.

Erick Almeida's avatar Erick Almeida (12 years ago)
see more comments