Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


UNSOLVED How to configure LDAP in Discourse?


  • This was previously posted in the Discourse App wishlist topic.

    I'm trying to add LDAP support myself. I've added the ldap addon to the package manifest, built and installed it. I've also installed the discourse-ldap-auth plugin. It sort of works! πŸŽ‰

    Here are the settings I could figure out myself:

    2d87620f-5010-4926-95ab-d45dd404be06-bild.png

    Remaining issues:

    • For invite-only forums that only want LDAP, that setting has to be turned off. Otherwise LDAP users can't authenticate. The feature can still be achieved by
      • disabling enable local logins
      • disablling enable local logins via email
      • reenable allow new registrations (Brings back the Sign up button, but luckily (!?) it leads to LDAP login too.
    • Accounts aren't automatically created. (Not possible currently)
    • I don't know what en_US.login.ldap.name is or how to map it/fix it.
    • I don't know how to map the suggested username to the Cloudron username upon Discourse account creation. I would also want to lock it. 92ecb980-7f80-4003-a4ff-03b0b6f7cac9-bild.png
    • I don't know any other LDAP settings, I just ripped them from the Wordpress LDAP integration settings πŸ˜†
    • LDAP sign-in UI looks off-brand and dodgy, possibly signalling phishing attempt for some users.

    Any help appreciated!

  • App Dev

    This was the app that I had running via cloudron OAuth that got broken! I knew there was one...this has just become a bit of a problem for me too

  • App Dev

    If the LDAP add-on is enabled for the app at least, it should be able to bind and authenticate even if it means manually copying credentials. I may have to steal them from another app (bad!) in the mean time though since I'm getting complaints from users

  • App Dev

    It would also be pretty trivial for me to fork and update this plugin to work more automatically with limited configuration for cloudron specifically and cleaning up things like that en_US.login.ldap.name which is an i18n key


  • @jimcavoli said in How to configure LDAP in Discourse?:

    fork and update this plugin to work more automatically

    Do you mean that you would be able to address the non-automatic account creation?

  • App Dev

    @yusf I'm not gonna say yes at this point since syncing requires some sort of cron-like setup and I'm just not sure how involved that would be - I mostly meant reading those settings in from the LDAP add-on without having to copy them into the admin UI from the app's console.

    I wouldn't rule it out, but if we could get that to be the only outstanding "issue" it strikes me that would be substantial progress for a start


  • I see. I don't know where the plugin data is stored but I suppose the official package can be modified to include the LDAP addon, the plugin and its settings.

    My personal incentive however, is to improve the experience for users (wrt the bullets above). Package automation can come later.

  • App Dev

    Gets a little technical about ruby and how discourse manages the plugins, but that all sort of goes hand-in-hand. Depending how the next day or two go, I'll see about doing something that we can use in order to keep the conversation moving and have a base to tackle some of those features from. Appreciate the context of your goals; I'll bear that in mind when the code starts flying πŸ™‚


  • @jimcavoli Did any code start flying? πŸ˜‰

  • App Dev

    @yusf Not as of yet...last few weeks have been very long hours for me on a litany of other things. I'll hopefully be getting some time back in a week or two


  • @girish Can we have the Discourse app updated with LDAP addon included in the Cloudron manifest? (MR here)

  • Staff

    Were the issues related to account creation sorted out?


  • @girish It was not. As mentioned earlier I did some light digging into the issue but as you can see in this issue that is where it's at currently.

    I figured there's no harm in enabling the Cloudron LDAP addon in the package but I realize that as maintainer you may have another view on that matter.

  • Staff

    @yusf If I understand the current situation, if the LDAP plugin is enabled:

    • User logs in.
    • User sees a screen to 'create new account'. User has to just click through.

    Is this the case? If so, that does not seem like a major issue.


  • @girish That's correct. There are more oddities around depending on what default use case you would go with for the package. (walled garden, open registration+ldap etc)

  • Staff

    @yusf To keep you updated, I looked into this a bit further. The issue is that when we add ldap as addon, Cloudron UI selects this as the default. For an app like discourse, using LDAP is uncommon since it's mostly a publicly forum use case.

    I think before we add LDAP support to nodebb/discourse etc, we need to fix Cloudron to support "dynamic addons". This way one can toggle LDAP support on/off whenever they want. That's the best way to fix this. Otherwise, I suspect, people will blindly install Discourse with LDAP, then disable LDAP inside Discourse and this will only lead to problems (since in Cloudron packages currently we assume that LDAP support is never removed like that inside an app).


  • @girish Seems like an apt solution to the problem. Thanks for looking into it.

    For what it’s worth I’m often faced with the opposite use-case: some group need internal forum software, apart from other Cloudron services. So I’m interested in doing the same thing with NodeBB.


  • @girish said in How to configure LDAP in Discourse?:

    For an app like discourse, using LDAP is uncommon since it's mostly a publicly forum use case.

    Even in those cases it'd still be nice to have LDAP, like we can in Rocket.Chat right now, i.e. Cloudron uses can use LDAP to login to Rocket.Chat using their Clourdon credentials, and non-Cloudron users can just register and login as normal too.

    I'd like the same UX for Discourse too, best of both worlds! πŸ™‚


  • @girish And meanwhile if I want to go venture off with a forked Discourse app with the only difference being that the LDAP addon is added, I should be able to stay compatible with the official one within foreseeable future, right?

  • Staff

    @yusf Yes, it should remain compatible. I haven't gotten time to updating the Dockerfile to have the LDAP plugin pre-installed and pre-configured. If you have the code for that, I can look into merging it.