[ejabberd] ejabberd 17.04 external authentication: badarg

Badlop badlop at gmail.com
Mon May 22 11:46:26 MSK 2017


Start ejabberd in live mode (or attach a shell with ejabberdctl
debug). There, does this work or complains too?
extauth:is_user_exists(<<"foo">>,<<"localhost">>).

If that returns badarg, it probably means the erlang machine couldn't
contact the process that handles your script.

If you use the example extauth perl script, does it work correctly or
also complains?

---
Badlop
ProcessOne


On 21 May 2017 at 21:48, Marvin Gülker <m-guelker at phoenixmail.de> wrote:
> Hi,
>
> after I got ejabberd 17.04 to run, I have a problem with external
> authentication. Here is the relevant config snippet:
>
>     auth_method: [external]
>     extauth_program: "/usr/local/bin/ejabberd-auth"
>     extauth_instances: 1
>     extauth_cache: false
>
> The ejabberd-auth script is a bash script that exec()s into a Ruby
> script after changing the working directory and setting some environment
> variables. The Ruby script's main loop is:
>
>     # ...
>     Syslog.open("ejabberd-auth")
>     Syslog.debug("Starting ejabberd-auth")
>     loop do
>       len     = $stdin.read(2).unpack("s>").first
>       command = $stdin.read(len).split(":")
>
>       Syslog.debug("Read command: #{command.inspect}")
>
>       result = case command[0]
>                when "auth" then
>                  authenticate(command[1], command[3])
>                when "isuser" then
>                  check_user(command[1])
>                when "setpass" then
>                #change_password(command[1], command[3])
>                  false
>                else
>                  # Unsupported command
>                  Syslog.debug("Unsupported command: #{comand[0]}")
>                  false
>                end
>
>       if result
>         $stdout.write([2, 1].pack("s>s>"))
>       else
>         $stdout.write([2, 0].pack("s>s>"))
>       end
>     end
>
> I took the information for writing this script from the ejabberd
> website[1].
>
> The script is properly started when ejabberd starts; it properly logs
> the startup message and continues to show in the process list. Then I
> execute this command from the commandline under the "ejabberd" user, which
> is also used to start ejabberd:
>
>     $ ejabberdctl check_account foo localhost
>
> ejabberd immediately logs this:
>
>     2017-05-21 19:05:45.131 [info] <0.31.0> Application ejabberd started on node ejabberd at localhost
>     2017-05-21 19:05:51.081 [debug] <0.328.0>@ejabberd_access_permissions:handle_call:139 Command 'check_account' execution allowed by rule 'console commands' (CallerInfo=#{caller_module => ejabberd_ctl})
>     2017-05-21 19:05:51.082 [debug] <0.532.0>@ejabberd_commands:do_execute_command:633 Executing command ejabberd_auth:is_user_exists with Args=[<<"foo">>,<<"localhost">>]
>     2017-05-21 19:05:51.082 [error] <0.532.0>@ejabberd_auth:is_user_exists:394 The authentication module ejabberd_auth_external returned an error when checking user <<"foo">> in server <<"localhost">>
>     Error message: badarg
>
> The syslog reveals that ejabberd has not even written anything to my
> authentication script's standard input; otherwise it would have printed
> an according log message. The script still runs afterwards. ejabberdctl
> exits with exit status 1, indicating failure.
>
> So, what does "badarg" mean? Any pointers? How can I obtain more
> specific information on the problem?
>
> Greetings
> Marvin
>
> [1]: https://www.ejabberd.im/files/doc/dev.html#htoc8
>
> --
> Blog: https://www.guelkerdev.de
> PGP/GPG ID: F1D8799FBCC8BC4F
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd


More information about the ejabberd mailing list