open-webui / open-webui

User-friendly AI Interface (Supports Ollama, OpenAI API, ...)
https://openwebui.com
MIT License
46.86k stars 5.71k forks source link

feat: LDAP User management #668

Open this-josh opened 9 months ago

this-josh commented 9 months ago

Is your feature request related to a problem? Please describe. Users should be managed via LDAP, similar to Portainer

Describe the solution you'd like LDAP user management implemented

Describe alternatives you've considered

I believe LDAP is the best starting point

Additional context

One key feature of ollama-webui is its ability to have users, but without LDAP this doesn't have same network level utility.

jannikstdl commented 9 months ago

Yes agree, this would be a use case for us as well.

tjbck commented 9 months ago

Related: https://github.com/ollama-webui/ollama-webui/issues/483

SurvivaLlama commented 9 months ago

I can help test this.

eingemaischt commented 7 months ago

This would be great for us as well - an auth via Header, set by an reverse proxy, would be a great alternative. Then we could add different auth mechanisms (OpenID, LDAP, Kerberos etc) without implementing each of them in webui itself...

justinh-rahb commented 7 months ago

This would be great for us as well - an auth via Header, set by an reverse proxy, would be a great alternative. Then we could add different auth mechanisms (OpenID, LDAP, Kerberos etc) without implementing each of them in webui itself...

Excellent news, this has been implemented:

Manfredzimmermann commented 4 months ago

How can I connect Open-WebUI with Microsoft Active directory? I'm looking for an excellent solution. A fixed module in Open-WebUI for Active Directory (LDAP) would be a dream

FritzHeiden commented 3 months ago

I'd really like to see this feature implemented aswell

dorianborovina commented 3 months ago

Me too! +1 from me.

hostingnuggets commented 3 months ago

Me too! +100 from me ;-)

peske commented 3 months ago

+1

sry9681 commented 3 months ago

+1

lduplaga commented 3 months ago

Would be awesome to have this feature.

seal61 commented 2 months ago

+1

lduplaga commented 2 months ago

I solved my case with Microsoft authentication by this

https://docs.openwebui.com/tutorial/sso#microsoft

seal61 commented 2 months ago

I solved my case with Microsoft authentication by this

https://docs.openwebui.com/tutorial/sso#microsoft

does not help with local active directory / ldap server sadly, but might be useful for some.

WilsonZiweiWang commented 2 months ago

My implementation: https://github.com/WilsonZiweiWang/open-webui/commit/f4e487480f414f24ff19b0243e6357c0625b330f It worked in my case with my LDAP server. Feel free to play with it and leave a comment. Thanks.

hostingnuggets commented 2 months ago

Bravo @WilsonZiweiWang for your LDAP implementation. @tjbck could @WilsonZiweiWang's code be integrated to this project?

tjbck commented 2 months ago

Feel free to make a PR!

justinh-rahb commented 2 months ago

WilsonZiweiWang with some refac that might be workable for more servers. Not working on my AD server, but honestly I'm fairly sure it's either a layer8 problem, or we just need more environment variables to tune the (too many) options for LDAP binding, user search and field mappings.

Peter-De-Ath commented 2 months ago

My implementation: WilsonZiweiWang@f4e4874 It worked in my case with my LDAP server. Feel free to play with it and leave a comment. Thanks.

I wasn't quite able able to get this working out the box, but adding

LDAP_USER_DN = f'cn={cn},{LDAP_USERS_DN}'

inside if uid == form_data.user:

justinh-rahb commented 2 months ago

I got this to work with @Peter-De-Ath's modification on a test LDAP server, but still unable to get working on my (probably misconfigured by my predecessor) AD domain.

Some notes I'd add:

WilsonZiweiWang commented 2 months ago

hi all, thanks for testing my code and leaving comments, I have created the PR for this issue: https://github.com/open-webui/open-webui/pull/5056

tjbck commented 1 week ago

LDAP support merged to dev. More testing wanted from the community here!

arthur-flam commented 1 week ago

Hello! We managed to make it work with LDAP. Thanks a lot for adding this feature. Some small issues I ran into:

nordy1145 commented 1 week ago

I also got LDAP working with a simple ldap filter to a specific group, TLS and no issues authenticating. The only issue I see is the default Role is Pending instead of User as mentioned above.

GabrielRamirez commented 1 week ago

Are the LDAP variables set in the .env file?

WilsonZiweiWang commented 1 week ago

Are the LDAP variables set in the .env file?

You can set initial values to them in the .env file or edit them with the interface