priyadi / roundcube-converse.js-xmpp-plugin

XMPP plugin for Roundcube Webmail based on converse.js
48 stars 18 forks source link

auto login not working #24

Open darkpixel opened 10 years ago

darkpixel commented 10 years ago

When I sign in to RC, that chat link shows up. When I click on it, it brings up the boxes asking for "XMPP/Jabber Username" and "Password". I can enter "user@example.tld" and the password and I am signed into chat. Everything works beautifully.

In my config.inc.php file I have:

$rcmail_config['converse_xmpp_hostname']= function($args) {
        return 'example.tld';
};

and

$rcmail_config['converse_xmpp_username']= function($args) {
        return preg_replace('/@.*$/', '', $args['user']);
};

(I also tried setting converse_xmpp_username to plain $args['user'])

I can't seem to get it to auto-login. Looking at the network requests in Chrome, there doesn't appear to be an attempt to access /http-bind when chat first starts up. (The ejabberd logs also show no authentication attempt).

The first time the app signs in is when I manually enter my username and password on the converse.js window.

Is it supposed to automatically login for the user or am I missing something?

priyadi commented 10 years ago

The plugin should autologin. The way it works is that the PHP part of the plugin first accesses http-bind in order to login and then passes the credentials to Javascript part of the plugin. If login fails, it will present login box. In your case it appears login has failed for some reason.

If you are sure there's no connection to BOSH URL, then the problem is probably in PHP part of the plugin. Please look for error message in your web server error log.

darkpixel commented 10 years ago

Hmm--I'll have to do some more digging. I figured it was supposed to auto login, so it must be something on my end. I never see the browser make a request to /http-bind when I sign in to RC, only after I enter my username and password into the converse window. I'll see if I can track it down.

darkpixel commented 10 years ago

It's definitely not trying to access /http-bind when I initially sign in. I only see if after I enter my info and click the login button.

priyadi commented 10 years ago

Please try the troubleshooting procedure outlined in TROUBLESHOOTING.md. In particular, make sure you can login with Pidgin using your BOSH endpoint.

Also, please paste your complete config.inc.php file.

mckaygerhard commented 10 years ago

i have same problem...

my xmpp server are ejabberd 2.1.13 with some patches backported form upstream, property working, tested the url bosh with pidgin and work

http server are lighttpd 1.4.35 working perfectly

follow instruction in troubleshooting and here my paste:

Request URL:https://dmoain.net/http-bind
Request Method:POST
Status Code:200 OK
Request Headersview source
Accept:*/*
Accept-Charset:ISO-8859-1,utf-8;q=0.7,*;q=0.3
Accept-Encoding:gzip,deflate,sdch
Accept-Language:es-419,es;q=0.8
Connection:keep-alive
Content-Length:210
Content-Type:application/xml
Cookie:TRACKID=6517ec3e9a436ed0ae04dd2d2c02cd9c; roundcube_sessid=5pkpk5qms2jn4e2oq5kgajv9t3; roundcube_sessauth=S60f463951195f413b8e4314d93a7650fb964f37a
Host:domain.net
Origin:https://domain.net.ve
Referer:https://domain.net.ve/roundcube/?_task=mail
User-Agent:Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.1 (KHTML, like Gecko) Chrome/13.0.782.220 Safari/535.1
Request Payload
<body rid='2672132707' xmlns='http://jabber.org/protocol/httpbind' to='mckaygerhard' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/>
Response Headersview source
Content-Length:0
Date:Mon, 26 May 2014 19:44:28 GMT
Server:lighttpd/1.4.35

the configuration file:

$rcmail_config['converse_xmpp_bosh_prebind_url']= function($args) {
    return 'http://domain.net:5280/http-bind';
};
$rcmail_config['converse_xmpp_bosh_url']= function($args) {
    return '/http-bind';
};
$rcmail_config['converse_xmpp_hostname']= function($args) {
    return 'domain.net';
};
$rcmail_config['converse_xmpp_username']= function($args) {
    return preg_replace('/@.*$/', '', $args['user']);
};
$rcmail_config['converse_xmpp_password']= function($args) {
    return $args['pass'];
};
$rcmail_config['converse_xmpp_enable_always'] = true;

i install a DNS for resolve "domain.net" and set all my clients to resolve trought this DNS so "domain.net" are not problem

what can i doing to help and make it work! i see some of code but uses 3 proyects (candy chat, php xmpp lib and other ), i really need that chat working in my rouncube

mckaygerhard commented 10 years ago

i found that under certanly circunstances there some problems with XMPP server and bosh proxy url

if server has own ssl cert and we configured xmpp server with ssl, some conflicts appears, so i disabled all ssl certs and all get to work, later enable ssl cert only in webserver and not in xmpp server, due proxy bosh url aleady will have ssl

now usinhg roundcube 1.X beta have some problem with stanza an presense..

priyadi commented 10 years ago

What SSL conflict? Anything in the log files?

My guess you need to update your ca-bundle.crt on your Roundcube installation.

mckaygerhard commented 10 years ago

u dont understand, i mean, that i we configured both in webserver and in xmppserver ssl support, client on bosh request must pass two certificates and fail! this are obvious!!

there's nonsense for reall xmpp compilant standart class xmpp server such openfire or ejabberd if already set a certificate on prxy url, so for that i can made some wiki pages about correct configuring of xmpp servers for u.. due README are not very clear about right configurations and many of this bugs are related to

priyadi commented 10 years ago

No. That's not obvious enough to me. It would be more helpful if you have error message to tell, and where it appears.

Also, please keep your vendetta against Prosody to yourself.

mckaygerhard commented 10 years ago

log are not possible, xmpp server have the request, but brwoser client do not received the response, due double check!! that's why anybody can send to u any error log of that ,

in my debug lg, on browser client, the response are 0Kb due that.. when i disable one of ssl , all get to work...

i dont know if this issue are invalid or are valid due the problem are configuration misc!

mckaygerhard commented 10 years ago

also about vendetta, @darkpixel obviously do nt use prosody and me too, its not vendetta men, its about a problem due there's not readme detailed with that compilants xmpp servers..

i already send some comments about that to upstream too..

priyadi commented 10 years ago

I don't understand. If the server has received the request but didn't send the response, then how this is the fault of converse.js? If turning off HTTPS works, then the problem might be in your proxying configuration of your lighttpd.

Try these for troubleshooting.

mckaygerhard commented 10 years ago

hi, @priyadi of course i said:

i dont know if this issue are invalid or are valid due the problem are configuration misc!

that's whay i proposed to make more detailed wiki pages for lighty&ejabberd or ngix&ejabberd, or hiawata that ar the most secure web server today!

priyadi commented 10 years ago

@mckaygerhard Wiki pages are open for everyone to edit. You can go ahead and add your pages. Thank you for your contributions!

darkpixel commented 9 years ago

I re-tackled this issue today, and managed to figure it out based on your cURL suggestion from #21 .

On my box running Ubuntu 14.04.1, cURL (and wget) don't like my certificate which was signed by GoDaddy very recently. Apparently the error doesn't bubble up through PHP.

I ended up going to GoDaddy's cert page and downloading the certificate bundles into /usr/local/share/ca-certificates/ and then running update-ca-certificates.

cURL no longer complains about the cert, and converse.js automatically logs in.