[ejabberd] Custom Erlang authentication module

William Key williamkey at gmail.com
Wed Nov 17 00:19:57 MSK 2010


Very good point on calling Ejabberd_config:get_local_option(). When I
realized that it was not
seeing the changes in the configuration file and realized that a colleague
of mine enabled
anonymous support which threw me off since it modifies the value via the
{host_config} tuple.

Thank you very much for your time. It looks like I need to learn to read a
bit more.

Thanks,
William

2010/11/16 Boris Okner <boris.okner at gmail.com>

> Ok, it almost looks like you're authenticating against another server :-)
> In debug console, try:
>
> ejabberd_auth:check_password(User, Server, Password).
>
> If that gives you false, then try to stop the server and see if your
> authentication still works :-).
> If true is returned, then you probably still have some other auth method.
> You can "play" this code in debug shell, to figure out what auth methods
> are there.
>
> Server = "<your_domain>",
>     LServer = jlib:nameprep(Server),
>     Method = ejabberd_config:get_local_option({auth_method, LServer}),
>     Methods = if
>   Method == undefined -> [];
>   is_list(Method) -> Method;
>   is_atom(Method) -> [Method]
>       end,
>     [list_to_atom("ejabberd_auth_" ++ atom_to_list(M)) || M <- Methods].
>
>
> Boris
>
>
> On Tue, Nov 16, 2010 at 3:57 PM, William Key <williamkey at gmail.com> wrote:
>
>> The exports returned:
>>
>> Exports:
>> check_password/3              is_user_exists/2
>> check_password/5              module_info/0
>> dirty_get_registered_users/0  module_info/1
>> get_password/2                plain_password_required/0
>> get_password_s/2              remove_user/2
>> get_vh_registered_users/1     remove_user/3
>> get_vh_registered_users/2     set_password/3
>> get_vh_registered_users_numberstart/1
>> get_vh_registered_users_numbertry_register/3
>> ok
>>
>> check_password() returned false (as expected, as I still haven't fully
>> implemented everything) and the ?INFO_MSG was called. When
>> actually authenticating with the server the ?INFO_MSG does not show up in
>> the logs at all.
>>
>> Thanks,
>> William
>>
>>
>> 2010/11/16 Boris Okner <boris.okner at gmail.com>
>>
>> Hmm...I haven't used 2.0.1, but by looking at the code, it should still
>>> work. I would recommend to fire off debug session, something like:
>>>
>>> sudo ejabberdctl debug
>>>
>>> and then from Erlang shell do:
>>>
>>> m(ejabberd_auth_authtest).
>>>
>>> If you see that your module was found, and the info looks right, try:
>>>
>>> User = "your_user_name",
>>> Server = "your_domain_name",
>>> Password = "your_password",
>>> ejabberd_auth_authtest:check_password(User, Server, Password).
>>>
>>> This will verify if your module does authentication as expected.
>>> We can go from there.
>>>
>>> Cheers,
>>> Boris
>>>
>>> On Tue, Nov 16, 2010 at 3:27 PM, William Key <williamkey at gmail.com>wrote:
>>>
>>>> Thanks for the quick response. My configuration has every auth_method
>>>> commented out except
>>>> mine which is {auth_method, authtest}. Is there anything specific I
>>>> should be doing other than compiling
>>>>  the module and moving it to the Ejabberd ebin directory? It has the
>>>> same functions as the odbc auth module
>>>> and the functions are exported. The filename is ejabberd_auth_authtest.
>>>>
>>>> I'm still able to authenticate with Ejabberd even though my module
>>>> wouldn't allow it. I've completely restarted
>>>> the server multiple times as well. Note: I'm using Ejabberd
>>>> 2.0.1-6+lenny2 (Ejabberd Debian package)
>>>>
>>>> Thanks,
>>>> William
>>>>
>>>> _______________________________________________
>>>> ejabberd mailing list
>>>> ejabberd at jabber.ru
>>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>>
>>>>
>>>
>>> _______________________________________________
>>> ejabberd mailing list
>>> ejabberd at jabber.ru
>>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>>
>>>
>>
>> _______________________________________________
>> ejabberd mailing list
>> ejabberd at jabber.ru
>> http://lists.jabber.ru/mailman/listinfo/ejabberd
>>
>>
>
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.jabber.ru/pipermail/ejabberd/attachments/20101116/19df9d29/attachment.html>


More information about the ejabberd mailing list