where to put the file for external authentication?

There are some examples (http://www.ejabberd.im/extauth) about the exteranl authentication of ejabbered.
we now use apache+tomcat+ejabbered+jwchat.
Tomcat is installed in directory c:\program files\tomcat
ejabbered is installed in directory c:\program files\ejabbered
I want to write a authentication file(in jsp,java..). where should I put it, in the directory of tomcat or ejabbered?

How to config the ejaberred.cfg?

My configuration is set as
{auth_method, external}.
{extauth_program, "/jwchat/test.jsp"}.

,but I got the following error message when ejabbered is started:

Error in process <0.239.0> on node 'ejabberd@atteam' with exit value:
"{einval,[{erlang,open_port,[{spawn,"/jwchat/test.jsp"},[{packet,2}]]},{extauth,init,2}]}"

Can anybody help? thank you in advance.

The extauth program is

The extauth program is started by ejabberd on start so on ejabberd.cfg you should put the full path to the executable.

Same Error

I'm getting the same error even I have my ejabberd.cfg pointing to the FULL PATH of the executable script.

Error in process <0.274.0> on node 'ejabberd@localhost' with exit value: {einval,[{erlang,open_port,[{spawn,"C:\jabbertest\extauth.php"},[{packet,2}]]},{extauth,init,2}]}

Please help

Maybe format of string?

bertneng wrote:

I'm getting the same error even I have my ejabberd.cfg pointing to the FULL PATH of the executable script.

Error in process <0.274.0> on node 'ejabberd@localhost' with exit value: {einval,[{erlang,open_port,[{spawn,"C:\jabbertest\extauth.php"},[{packet,2}]]},{extauth,init,2}]}

It seems you are using Windows. Maybe your problem is in the format of the string.

If you currently have "C:\jabbertest\extauth.php" in ejabberd.cfg, try putting "C:\\jabbertest\\extauth.php". Or the opposite.

Still the same..

I tried

"C:\\jabbertest\\extauth.php"
"C:\/jabbertest\/extauth.php"
"C:/jabbertest/extauth.php"

and getting the same error.

Some ideas

bertneng wrote:

Error in process <0.274.0> on node 'ejabberd@localhost' with exit value: {einval,[{erlang,open_port,[{spawn,"C:\jabbertest\extauth.php"},[{packet,2}]]},{extauth,init,2}]}

Ah, sorry, I never used extauth in Windows, only in Linux. I'll try to give some hints, maybe they help you to find the correct solution.

The code in ejabberd that generates this error is called when ejabberd starts: it attempts to start your extauth script, and fails.

So, you must specify the full path of a program that should be executable. If you specify a php script, then I guess you have PHP installed in such a way that the script can be executed as-is. Maybe you can also specify something like this: "C:\\PHP-5.0.0\\php.exe C:\\jabbertest\\extauth.php"

You can repeat the error easily, and investigate what is the correct value:

  1. Start ejabberd. It will report that error.
  2. Then start the program: Start -> Programs -> Process-one -> Debug console
  3. Now you can type commands, like:
    open_port({spawn, "C:\jabbertest\extauth.php"}, [{packet, 2}]).
  4. It will of course report the same error message. The benefit of this is that you can immediately try other strings. If you get a response like #Port<0.462> then you probably found the correct string.
  5. For example, you can try the string "cmd.exe". Obviously, that is not a good extauth program for ejabberd :)
  6. Once you finally find a string that seems to work, you can put it in ejabberd.cfg, stop Debug console, stop ejabberd, and start ejabberd again.

You can find more information of the open_port function

Syndicate content