Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDAP auth no longer working after upgrade to Ejabberd Docker 20.07 #3350

Closed
budbay opened this issue Aug 1, 2020 · 5 comments
Closed

LDAP auth no longer working after upgrade to Ejabberd Docker 20.07 #3350

budbay opened this issue Aug 1, 2020 · 5 comments
Labels
Packaging:Docker Docker image from Docker Hub

Comments

@budbay
Copy link

budbay commented Aug 1, 2020

Issue

After upgrading Ejabberd Docker container from 20.04 to 20.07 LDAP has completely stopped working, reverting back to 20.04 everything works normally. No changes have been made to configuration, and no other errors or warnings show up in logs other than below. Have been running and upgrading Ejabberd docker since 19.xx version without issues.

Environment

  • Ejabberd 20.07 Docker Container (using tag: latest)
  • OS: Ubuntu 18.04
  • Docker installed from repos and up to date

LDAP Config

auth_method: [ldap]
ldap_servers: [IP]
ldap_encrypt: none
ldap_port: 389
ldap_base: "dc=example,dc=com" 

Error from log

   crasher:
     initial call: ejabberd_auth_ldap:init/1
     pid: <0.645.0>
     registered_name: []
     exception error: undefined function pg:start_link/0
       in function  eldap_pool:start_link/7 (src/eldap_pool.erl, line 69)
       in call from ejabberd_auth_ldap:init/1 (src/ejabberd_auth_ldap.erl, line 103)
       in call from gen_server:init_it/2 (gen_server.erl, line 374)
       in call from gen_server:init_it/6 (gen_server.erl, line 342)
    ancestors: [ejabberd_backend_sup,ejabberd_sup,<0.126.0>]
    message_queue_len: 0
    messages: []
    links: [<0.537.0>]
    dictionary: []
    trap_exit: true
    status: running
    heap_size: 610
    stack_size: 27
    reductions: 16544
  neighbours:
@badlop
Copy link
Member

badlop commented Aug 3, 2020

Do you know what Erlang version is used by ejabberd?

Looking at the error message and the source code, ejabberd's rebar.config thinks it is using Erlang 23.0 or newer. But apparently the Erlang library pg (which is included with Erlang/OTP 23.0 and newer, was not found.

$ erl
Erlang/OTP 23 [erts-11.0.2] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1]

Eshell V11.0.2  (abort with ^G)
1> pg:start_link().
{ok,<0.90.0>}

For example, in Debian, the library pg.beam is included in the package erlang-base:
https://packages.debian.org/search?searchon=contents&keywords=pg.beam&mode=path&suite=unstable&arch=amd64

@budbay
Copy link
Author

budbay commented Aug 3, 2020

I opened a debug shell and it states that it is using Erlang/OTP 22, so is this a bug with the docker container that it is not supplying the correct version?

@badlop
Copy link
Member

badlop commented Aug 3, 2020

Um, maybe Docker is missing some of the changes done in rebar.config

Can you please apply this patch to ejabberd and comment if it helps?

diff --git a/mix.exs b/mix.exs
index afc645eb3..00d7e0a57 100644
--- a/mix.exs
+++ b/mix.exs
@@ -66,7 +66,10 @@ defmodule Ejabberd.Mixfile do
              cond_options() ++
              Enum.map(includes, fn (path) -> {:i, path} end) ++
              if_version_above('20', [{:d, :DEPRECATED_GET_STACKTRACE}]) ++
+             if_version_below('21', [{:d, :USE_OLD_HTTP_URI}]) ++
              if_version_below('22', [{:d, :LAGER}]) ++
+             if_version_below('23', [{:d, :USE_OLD_CRYPTO_HMAC}]) ++
+             if_version_below('23', [{:d, :USE_OLD_PG2}]) ++
              if_function_exported(:erl_error, :format_exception, 6, [{:d, :HAVE_ERL_ERROR}])
     defines = for {:d, value} <- result, do: {:d, value}
     result ++ [{:d, :ALL_DEFS, defines}]

@budbay
Copy link
Author

budbay commented Aug 6, 2020

I applied the patch and rebuilt the docker image and LDAP auth is working as expected now, sorry but I only now had the time to test.

@badlop badlop added the Packaging:Docker Docker image from Docker Hub label Aug 10, 2020
@badlop badlop added this to the ejabberd 20.xx milestone Aug 10, 2020
@badlop
Copy link
Member

badlop commented Aug 10, 2020

Thanks! I've applied the changes to ejabberd's git repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Packaging:Docker Docker image from Docker Hub
Projects
None yet
Development

No branches or pull requests

2 participants