Erlang Mailing Lists

Author Message

<  Ejabberd mailing list  ~  parallelized external authentication

Guest
Posted: Mon Jul 19, 2010 6:54 pm Reply with quote
Guest
I implemented a patch for extauth.erl so that it is capable of spawning
multiple scripts for any given domain.

I laid out the details on this blog.

http://zjt.blogspot.com/2010/07/ejabberd-parallelized-external-script.html

Comments and suggestions are welcome.



Post received from mailinglist
Guest
Posted: Wed Jul 28, 2010 7:29 pm Reply with quote
Guest
2010/7/19 Jesse Thompson <jesse.thompson@doit.wisc.edu>:
> I implemented a patch for extauth.erl so that it is capable of spawning
> multiple scripts for any given domain.
>
> I laid out the details on this blog.
>
> http://zjt.blogspot.com/2010/07/ejabberd-parallelized-external-script.html
>
> Comments and suggestions are welcome.


New ticket:
https://support.process-one.net/browse/EJAB-1280

I applied your patch to ejabberd 2.0.5, and tested with check_pass_null.pl

Suggestion:
You exported some functions, but that seems unnecessary.

Bug:
There is some problem getting the proper Num when handling an auth request.
The number is correctly got when starting ejabberd, because I see the
proper number of scripts running.

When I configure extauth_n to 3, I get approximately 1 error out of
every 3 login attempts:
...
** Reason for termination =
** {badarg,[{extauth,call_port,2},
{ejabberd_auth,check_password_loop,2},
{ejabberd_c2s,wait_for_auth,2},

When configured to 2, i get approximately 50% of failed attempts.
When configured to 1 or not configured, all connection attempts fail
with that error.


Comment:
You were telling a nice story:
> ejabberd's external authentication mechanism [...] is serial.
> this is a problem for us
> I'm a Perl developer
> I eventually figured out enough Erlang
> Here is the diff.
> ...
> I haven't put this into production

Oh, why doesn't your story have a happy ending?


---
Badlop
ProcessOne
_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru
http://lists.jabber.ru/mailman/listinfo/ejabberd
Post received from mailinglist
Guest
Posted: Wed Jul 28, 2010 8:39 pm Reply with quote
Guest
On 07/28/2010 02:29 PM, Badlop wrote:
> 2010/7/19 Jesse Thompson<jesse.thompson@doit.wisc.edu>:
>> I implemented a patch for extauth.erl so that it is capable of spawning
>> multiple scripts for any given domain.
>>
>> I laid out the details on this blog.
>>
>> http://zjt.blogspot.com/2010/07/ejabberd-parallelized-external-script.html
>>
>> Comments and suggestions are welcome.
>
>
> New ticket:
> https://support.process-one.net/browse/EJAB-1280

Cool!


> I applied your patch to ejabberd 2.0.5, and tested with check_pass_null.pl
>
> Suggestion:
> You exported some functions, but that seems unnecessary.

I mistakenly thought that export was required even within the lexical scope.


> Bug:
> There is some problem getting the proper Num when handling an auth request.
> The number is correctly got when starting ejabberd, because I see the
> proper number of scripts running.
>
> When I configure extauth_n to 3, I get approximately 1 error out of
> every 3 login attempts:
> ...
> ** Reason for termination =
> ** {badarg,[{extauth,call_port,2},
> {ejabberd_auth,check_password_loop,2},
> {ejabberd_c2s,wait_for_auth,2},
>
> When configured to 2, i get approximately 50% of failed attempts.
> When configured to 1 or not configured, all connection attempts fail
> with that error.

Thanks. My code was assuming that random:uniform returned between 0 and
N-1, instead of 1 and N


> Comment:
> You were telling a nice story:
>> ejabberd's external authentication mechanism [...] is serial.
>> this is a problem for us
>> I'm a Perl developer
>> I eventually figured out enough Erlang
>> Here is the diff.
>> ...
>> I haven't put this into production
>
> Oh, why doesn't your story have a happy ending?

Yet. Smile I will hopefully have this installed in production within a
few weeks.

I guess it was good that I waited since it would appear that you found a
critical bug in my code.

Jesse



>
>
> ---
> Badlop
> ProcessOne
> _______________________________________________
> ejabberd mailing list
> ejabberd@jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd



Post received from mailinglist
Guest
Posted: Thu Jul 29, 2010 11:28 am Reply with quote
Guest
On Mon, Jul 19, 2010 at 1:53 PM, Jesse Thompson
<jesse.thompson@doit.wisc.edu> wrote:
> I implemented a patch for extauth.erl so that it is capable of spawning
> multiple scripts for any given domain.

I never really liked the extauth module so I wrote my own:
http://github.com/skeltoac/ejabberd_auth_wordpress

This uses php_app to run the WordPress auth functions directly:
http://github.com/skeltoac/php_app

With php_app I can configure the number of running PHP workers. So the
auth module stays nice and simple.

I'd think it pretty cool if you forked php_app for perl scripts. Smile

Andy
_______________________________________________
ejabberd mailing list
ejabberd@jabber.ru
http://lists.jabber.ru/mailman/listinfo/ejabberd
Post received from mailinglist
Guest
Posted: Thu Jul 29, 2010 3:07 pm Reply with quote
Guest
On 07/29/2010 06:27 AM, Andy Skelton wrote:
> On Mon, Jul 19, 2010 at 1:53 PM, Jesse Thompson
> <jesse.thompson@doit.wisc.edu> wrote:
>> I implemented a patch for extauth.erl so that it is capable of spawning
>> multiple scripts for any given domain.
>
> I never really liked the extauth module so I wrote my own:
> http://github.com/skeltoac/ejabberd_auth_wordpress
>
> This uses php_app to run the WordPress auth functions directly:
> http://github.com/skeltoac/php_app
>
> With php_app I can configure the number of running PHP workers. So the
> auth module stays nice and simple.
>
> I'd think it pretty cool if you forked php_app for perl scripts. Smile

It looks like all you're doing is defining the command to run, so why
wouldn't it work with perl (or anything else) the way it is? Perhaps
all you would need to do is remove references to php and wordpress.

I haven't looked at your code in depth (I'm still not very well versed
in erlang,) but I'm assuming that you are saying that your module is
calling the external script differently than extauth does. Wouldn't it
be better to have an external auth module that supports existing extauth
scripts? I'm sure that there are many ejabberd operators who would
appreciate the benefit of parallelized external authentication without
the requirement of having to rewrite their scripts.

Jesse


>
> Andy
> _______________________________________________
> ejabberd mailing list
> ejabberd@jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd



Post received from mailinglist
Guest
Posted: Sat Jul 31, 2010 1:03 pm Reply with quote
Guest
> It looks like all you're doing is defining the command to run, so why
> wouldn't it work with perl (or anything else) the way it is?

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum