# Unable to connect to our LDAP

**URL:** <https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611>\
**Category:** General\
**Created:** [October 15, 2018, 8:55am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611 "2018-10-15T08:55:44Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prashanthmallu](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Prashanthmallu](https://forum.gitea.com/u/Prashanthmallu)\
**Post date:** [October 15, 2018, 8:55am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/1 "2018-10-15T08:55:44Z")

</div>

Hi,

we have many Third Party softwares integrated to our ADS active directory. They all seems to work normally.

But we are unable to connect to our LDAP using Gitea. I have gone through the document and tried various option.

can someone help us on this?

---

<div class="post-metadata">

**Author:** ![anon74399538](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@anon74399538](https://forum.gitea.com/u/anon74399538)\
**Post date:** [October 15, 2018, 1:06pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/2 "2018-10-15T13:06:59Z")

</div>

To get help you’re probably going to have to provide more details or try asking on Stack Overflow unless you’re ready to buck up some cash for someone’s time.

---

<div class="post-metadata">

**Author:** ![Prashanthmallu](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Prashanthmallu](https://forum.gitea.com/u/Prashanthmallu)\
**Post date:** [October 15, 2018, 5:27pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/3 "2018-10-15T17:27:12Z")

</div>

2018/10/15 14:32:06 [D] Template: home  
2018/10/15 14:32:08 [D] Session ID: ab8bb5242b2770d0  
2018/10/15 14:32:08 [D] CSRF Token: PYovUfQ1-ncppPXh79nmZV34Pss6MTUzOTU5NDEyNjU3MDAwMTUwMA==  
2018/10/15 14:32:08 [D] Template: user/auth/signin  
2018/10/15 14:32:18 [D] Session ID: ab8bb5242b2770d0  
2018/10/15 14:32:18 [D] CSRF Token: PYovUfQ1-ncppPXh79nmZV34Pss6MTUzOTU5NDEyNjU3MDAwMTUwMA==  
2018/10/15 14:32:18 [T] Dialing LDAP with security protocol (0) without verifying: false  
2018/10/15 14:32:18 [T] LDAP will use BindDN.  
2018/10/15 14:32:18 [T] Search for LDAP user: prasanth  
2018/10/15 14:32:18 [D] Failed to bind as BindDN[CN=gitadmin,Users,DC=dsrc,DC=in]: LDAP Result Code 49 “Invalid Credentials”: 80090308: LdapErr: DSID-0C09042F, comment: AcceptSecurityContext error, data 52e, v2580  
2018/10/15 14:32:18 [W] Failed to login ‘prasanth’ via ‘ldap-test1’: user does not exist [uid: 0, name: prasanth, keyid: 0]  
2018/10/15 14:32:18 [D] Template: user/auth/signin  
2018/10/15 14:32:18 [I] Failed authentication attempt for prasanth from [::1]

---

<div class="post-metadata">

**Author:** ![Prashanthmallu](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Prashanthmallu](https://forum.gitea.com/u/Prashanthmallu)\
**Post date:** [October 15, 2018, 7:14pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/4 "2018-10-15T19:14:44Z")

</div>

okay thanks for the info

---

<div class="post-metadata">

**Author:** ![anon74399538](https://avatars.discourse-cdn.com/v4/letter/a/c6cbf5/32.png) [@anon74399538](https://forum.gitea.com/u/anon74399538)\
**Post date:** [October 16, 2018, 7:06am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/5 "2018-10-16T07:06:47Z")

</div>

No problem. Hope you’re able to figure it out. They’re may be some Issues on GitHub you can search through to help find your answer. Try searching for “LDAP” in the Git repo and if you do figure it out let us know how you did it here. Best of luck!

---

<div class="post-metadata">

**Author:** ![Prashanthmallu](https://avatars.discourse-cdn.com/v4/letter/p/4491bb/32.png) [@Prashanthmallu](https://forum.gitea.com/u/Prashanthmallu)\
**Post date:** [October 16, 2018, 8:26am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/6 "2018-10-16T08:26:23Z")

</div>

we got it working now, Thanks

---

<div class="post-metadata">

**Author:** ![zane\_shus](https://avatars.discourse-cdn.com/v4/letter/z/db5fbb/32.png) [@zane\_shus](https://forum.gitea.com/u/zane_shus)\
**Post date:** [October 22, 2018, 7:30pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/7 "2018-10-22T19:30:12Z")

</div>

What did you do to get it working. I am in the same situation.

---

<div class="post-metadata">

**Author:** ![jsmigiel](https://avatars.discourse-cdn.com/v4/letter/j/85e7bf/32.png) [@jsmigiel](https://forum.gitea.com/u/jsmigiel)\
**Post date:** [January 2, 2019, 11:52pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/8 "2019-01-02T23:52:45Z")

</div>

These are example settings that worked for me to authenticate with an Active Directory server:

Authentication Type:  
LDAP (via BindDN)

Security Protocol:  
Unencrypted

Host:  
[myserver.myexample.com](http://myserver.myexample.com)

Port:  
389

User Search Base:  
CN=Users,DC=myexample,DC=com

Bind DN:  
[myreadonlyuser@myexample.com](mailto:myreadonlyuser@myexample.com)

Bind Password:  
password1234

User filter:  
(&(sAMAccountName=%s)(objectCategory=Person)(memberOf=CN=Gitea-group,DC=myexample,DC=com)(!(UserAccountControl:1.2.840.113556.1.4.803:=2)))

Admin filter:  
(memberOf=CN=GiteaAdmins-group,DC=myexample,DC=com)

First name attribute:  
givenName

Surname attribute:  
sn

Email attribute:  
mail

 ![GiteaExample](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/1X/833e88bfdb87a82dbad2773073b709bd6e1ccabf.png)

---

<div class="post-metadata">

**Author:** ![obohovyk](https://avatars.discourse-cdn.com/v4/letter/o/58f4c7/32.png) [@obohovyk](https://forum.gitea.com/u/obohovyk)\
**Post date:** [January 12, 2019, 3:45pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/9 "2019-01-12T15:45:20Z")

</div>

Hi everyone! the only one working solution I found for me is in attachment. It uses FreeIPA 4.4.  
Main problem was in User Search Base.

 ![Selection_044](https://us1.discourse-cdn.com/flex020/uploads/gitea/original/1X/fb014a726c942acc24c33d1b546faa82afcc8dda.png)

---

<div class="post-metadata">

**Author:** ![vinodsatapara](https://avatars.discourse-cdn.com/v4/letter/v/8edcca/32.png) [@vinodsatapara](https://forum.gitea.com/u/vinodsatapara)\
**Post date:** [January 2, 2020, 12:48pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/10 "2020-01-02T12:48:36Z")

</div>

I am having similar problem. How can i test the LDAP setting that i have added?

Do we have any test button on Authentication Source screen to test the setting?

---

<div class="post-metadata">

**Author:** ![silencej](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/silencej/32/4931_2.png) [@silencej](https://forum.gitea.com/u/silencej)\
**Post date:** [July 23, 2020, 6:36am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/11 "2020-07-23T06:36:26Z")

</div>

May I ask, where did you find these log?

---

<div class="post-metadata">

**Author:** ![vtmb](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/vtmb/32/909_2.png) [@vtmb](https://forum.gitea.com/u/vtmb)\
**Post date:** [August 6, 2020, 7:47am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/12 "2020-08-06T07:47:16Z")

</div>

Hello,  
I see Free IPA is a bunch of software. Is it really worth the effort? I just want to use Active Directory for User Management but it wont work.

---

<div class="post-metadata">

**Author:** ![SonGokussj4](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.gitea.com/songokussj4/32/1533_2.png) [@SonGokussj4](https://forum.gitea.com/u/SonGokussj4)\
**Post date:** [August 25, 2021, 5:09pm UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/13 "2021-08-25T17:09:13Z")

</div>

Hi. I had the same problem. Resolved by changing DN from CN=myuser,OU=my,OU=company to myuser@my.company

---

<div class="post-metadata">

**Author:** ![joatd](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@joatd](https://forum.gitea.com/u/joatd)\
**Post date:** [December 28, 2022, 1:25am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/14 "2022-12-28T01:25:08Z")

</div>

I was able to get the Gitea authentication working using an old format for Guacamole (don’t ask). The good news is that it works. The bad news (I think) is that it ignores groups. Maybe someone else can expand on the following.

```
Autnetication Type: LDAP (simple auth)
Authentication Name: *whatever*
Security Protocol: Unencrypted
Host: *IP of FreeIPA Server*
Port: 389
User Search Base: cn=users, cn=compat,dc=*example*,dc=*com*
User DN: uid=%s,cn=users,cn=compat,dc=*example*,dc=*com*
User Filter: (&(objectClass=posixAccount)(uid=%s))
Email attribute: mail

```

With the above, only check the “This Authentication Source is Activated”

In the above, you’ll want to change the following (and leave off the asterisks):

- whatever
- IP of FreeIPA server
- example
- com

Now that I have that much working, Ill be experimenting with getting the encrypted version working.

Note: in developing the above “ldapsearch -x” was valuable.

---

<div class="post-metadata">

**Author:** ![joatd](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@joatd](https://forum.gitea.com/u/joatd)\
**Post date:** [December 28, 2022, 1:28am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/15 "2022-12-28T01:28:01Z")

</div>

Also, to note: the documentation has you building and installing gitea.ldif in your FreeIPA server. Only do that if you plan on updating passwords from Gitea, back to FreeIPA. The LDIF is not needed if you’re not changing SSO passwords from within Gitea.

---

<div class="post-metadata">

**Author:** ![joatd](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@joatd](https://forum.gitea.com/u/joatd)\
**Post date:** [December 28, 2022, 1:32am UTC](https://forum.gitea.com/t/unable-to-connect-to-our-ldap/611/16 "2022-12-28T01:32:38Z")

</div>

Maybe I should add a description about my setup: I’m running Gitea and FreeIPA in separate Docker containers, running on the same host. The IP address used in the above is the external IP address for the Docker host. Both containers have ports forwarded to the host so that both services are externally reachable.

I’ll be trying to add a groups filter and an admin filter sometime in the near future.
