rroemhild / docker-ejabberd

Dockerfile for Ejabberd server
MIT License
268 stars 160 forks source link

docker-ejabberd and ejabberd deb #166

Closed ravikantmishra closed 5 years ago

ravikantmishra commented 6 years ago

Hello,

I need some help.

I have installed ejabberd 18.03 deb package on ubuntu from here (https://www.process-one.net/en/ejabberd/downloads/) and also enabled external auth with php script. Which is running successfully and no issues.

Now I am trying to use the same script with latest 18.03 "docker-ejabberd" and its not working. Error log says

10:07:07.584 [info] (<0.717.0>) Accepted connection ::ffff: 172.17.0.1:41628 -> ::ffff: 172.17.0.3:5222 10:08:07.587 [error] extauth call '[<<"auth">>,<<"admin">>,<<"xxxxxxxxxxxxx.com">>,<<"xxxxxxxxxxxxx">>]' didn't receive response

Can somebody shed some light on what could be the possible issues.

Thanks in advance

mitchellurgero commented 6 years ago

Looks like your external auth script is not working as expected. Check there first.

ravikantmishra commented 6 years ago

@mitchellurgero ejabberd is able to execute php script because I can see all the logs that I have mentioned in the script. this time php script is kept inside /bin/index.php

last lines of my php script after authentication

$message = pack('nn', 2, (int)$status);
$this->log('Sending response: ' . bin2hex($message));  // I am able see this log
fwrite($this->stdout, $message);

while earlier when I was using ejabberd without docker the script was kept inside /var/www/html/jabberd/index.php and its was working. I was able to authenticate.

mitchellurgero commented 6 years ago

Wait, why are you sending back the message in hex???

In my custom external module I use to out put 1 or 0 and it works without a hitch:

$return = false;
if($authenticationGood){
    $return = true;
} else {
    $return = false;
}
$return = ($return) ? 1 : 0;
return @pack("nn",2,$return);
ravikantmishra commented 6 years ago

No i am not sending response in hex its just for logging purpose.

See the last line fwrite(..............

That line is being used to send response.

I also noticed that you are not using that line. While if you search all the PHP scripts available on the internet are using fwrite for sending response to ejabberd.

You sure we don't need that line?

mitchellurgero commented 6 years ago

Sorry - for context on my code: https://github.com/mitchellurgero/ejabberd_gnusocial/blob/master/xmpp_auth.php

ravikantmishra commented 6 years ago

Thanks for all your support. I will try this.