How to configure LDAP in GOGS?

Hello,

I want to setup GOGS to work with LDAP. It seems to be possible but I can’t understand where to start? Is there config file somewhere that should have LDAP parameters? I saw a web page screenshot in this topic: LDAP / ActiveDirectory Setup - where to put things, but it seems that I don’t have this page in my admin section. Or I just can’t find it.

Could you please point me into the right direction.

Thank you,
Vladimir Sapronov

Hi Vladimir,

you have to go to your “admin panel”. There is a menu entry “authentications”. Then you can “add new source” and see the screen I showed on the other post.
Attached you can find a screenshot of my admin panel.
Currently I use version 0.9.99.0915

1 Like

I notice you are using AD, so this might help. You will probably need to amend due to bind parameters and attributes being different. May I recommend Apache Directory Studio. I used this to browse the schema.

I have a similar configuration. Following are my changes:

  • I used the construction allowing authentication using both “Username” or “email” as the Sign In dialog states "Username or email (adapted to match the example from @KangoV this looks like)

      (&(objectClass=person)(|(sAMAccountName=%[1]s)(mail=%[1]s)))
    
  • I further used the “Admin Filter” as well. I placed here a memberOf construction:

      (memberOf=CN=GogsAdmin,OU=Groups,DC=realistic,DC=local)
    
  • Unchecked “Fetch attributes in Bind DN context”. I did not understand the Pull request #2634. Does anyone know what or how this influences the authentication?

  • Another difference is that i used “givenName” instead of “cn” for the “First name attribute” but this is not a big deal (cn turns up empty in my situation).

I did encounter a login problem. This had to do with an organisation named “John” and a user named “John”. The user could not log in leaving no clues in the logs… When i removed the organisation the user could login using the LDAP mechanism.

Does anyone know if it is also possible to put this configuration in the custom app.ini file? It looks like this information gets stored in the database…

2 Likes

Thanks, that works fine. But I I have a question How to sync user data from LDAP to gogs, you mind answering it.