MSN XMPP see-other-host empty [duplicate] - xmpp

This question already has answers here:
Handle see-other-host in smack
(3 answers)
Closed 9 years ago.
I'm trying to use XMPP to connect with MSN with js.
When I try to connect to "messenger.live.com" I send
<body rid='2126688061' xmlns='http://jabber.org/protocol/httpbind' to='messenger.live.com' 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'/>
and I get
<body xmlns="http://jabber.org/protocol/httpbind" type="terminate" condition="remote-stream-error">
<stream:error xmlns:stream="http://etherx.jabber.org/streams">
<see-other-host xmlns="urn:ietf:params:xml:ns:xmpp-streams"></see-other-host>
</stream:error>
</body>
I do not understand why no alternative host is offered?

This is Microsofts way of load balancing :(
After connecting the stream they redirect you to another host. You have to close the existing stream and initiate another stream to the given host.
I always have seen there another host. Can you get more logs from your BOSH proxy with the RAW data?
Does your BOSH proxy support this redirection feature?

Related

XMPP libstrophe client connection with ejabberd

I am libstrophe example client program bot.c and trying to connect with ejabberd server.
I am facing authentication failure. Please refer the log below.
xmpp DEBUG Connecting via altdomain.
xmpp DEBUG sock_connect() to 127.0.0.1:5222 returned 3
xmpp DEBUG Attempting to connect to 127.0.0.1
xmpp DEBUG connection successful
conn DEBUG SENT: <?xml version="1.0"?><stream:stream to="prakash.com" xml:lang="en" version="1.0" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">
xmpp DEBUG RECV: <stream:stream id="16900185530209358531" version="1.0" lang="en" from="prakash.com">
xmpp DEBUG RECV: <features xmlns="http://etherx.jabber.org/streams"><c hash="sha-1" xmlns="http://jabber.org/protocol/caps" node="http://www.process-one.net/en/ejabberd/" ver="LSc28EBBWo2uA2P3nRDU+sBlbsc="/><mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>X-OAUTH2</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms></features>
conn DEBUG SENT: <auth mechanism="SCRAM-SHA-1" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">biwsbj1CVlAscj0zZjMwOTQ5N2IyYTEwZDYzNjUwZTRiNzEwMmY3Zjk1</auth>
xmpp DEBUG RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
xmpp DEBUG handle SCRAM-SHA-1 (challenge) called for failure
xmpp DEBUG SASL SCRAM-SHA-1 auth failed
conn DEBUG SENT: <auth mechanism="DIGEST-MD5" xmlns="urn:ietf:params:xml:ns:xmpp-sasl"/>
xmpp DEBUG RECV: <challenge xmlns="urn:ietf:params:xml:ns:xmpp-sasl">bm9uY2U9IjcwOTEwMTI1NzE1NzkzNzMyOTkiLHFvcD0iYXV0aCIsY2hhcnNldD11dGYtOCxhbGdvcml0aG09bWQ1LXNlc3M=</challenge>
xmpp DEBUG handle digest-md5 (challenge) called for challenge
conn DEBUG SENT: <response xmlns="urn:ietf:params:xml:ns:xmpp-sasl">dXNlcm5hbWU9IkJWUCIscmVhbG09InByYWthc2guY29tIixub25jZT0iNzA5MTAxMjU3MTU3OTM3MzI5OSIsY25vbmNlPSJhMjZkZWQ0M2Y4MmMiLG5jPTAwMDAwMDAxLHFvcD1hdXRoLGRpZ2VzdC11cmk9InhtcHAvcHJha2FzaC5jb20iLHJlc3BvbnNlPWEyYTVlMDIwYTNkZjc1NmY1NTAxZDBkYzMyMDliOGQ5LGNoYXJzZXQ9dXRmLTg=</response>
xmpp DEBUG RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
xmpp DEBUG handle digest-md5 (rspauth) called for failure
xmpp DEBUG SASL DIGEST-MD5 auth failed
conn DEBUG SENT: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">AEJWUABhZG1pbjEyMw==</auth>
xmpp DEBUG RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl"><not-authorized/></failure>
xmpp DEBUG SASL PLAIN auth failed
auth ERROR Cannot authenticate without resource
conn DEBUG SENT: </stream:stream>
xmpp DEBUG RECV: </stream:stream>
xmpp DEBUG Closing socket.
DEBUG: disconnected
event DEBUG Stopping event loop.
event DEBUG Event loop completed.
Can someone help me on this how to resolve this authentication problem?
Libstrophe tries supported authentication mechanisms one by one until one succeeds or all fail. The problem is on server side and given logs don't provide enough information to reveal it.
SCRAM-SHA-1 mechanism fails after the 1st stanza. This means that server rejects authentication when only username is sent. I would suggest to check if such a user exists (I'm not sure if it case-sensitive). If this doesn't help look at ejabberd logs.
Take into account that PLAIN mechanism sends base64-encoded login/password and anyone can decode it. Therefore, I would suggest to remove encoded password from libstrophe's logs like this:
conn DEBUG SENT: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">*REDACTED*</auth>
When all authentication mechanisms fail libstrophe tries legacy client authentication. In this case it needs a resource to build <iq> stanza. Logs show the next error message since a resource was not added to jid:
auth ERROR Cannot authenticate without resource
When login/password are correct and there is no problem with jabber server the authentication should succeed on the 1st supported mechanism and legacy authentication shouldn't be called. Therefore, it is safe to ignore the last error message.
Edit the below parameters in ejabbered.yml file.
auth_password_format: scram
s2s_protocol_options:
- "no_sslv3"
save the file .
Stop and start the ejabbered Server.
Now Register the user in the server side and run the bot example in the libstrophe library.

Does XMPP require a dialback?

I've been doing it as follows :
Step 1. <Stream>
Step 2. <Auth> (PLAIN)
Step 3. <Session>
Stuck here.
This tutorial does not mention dialback: http://ceit.uq.edu.au/content/how-xmpp-works-step-step
However, under 8.3. Protocol of the documentation, it says to use a dialback: http://xmpp.org/rfcs/rfc3920.html
Right now, this is the full response I get from my server:
<?xml version='1.0'?><stream:stream xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' id='1027203257' from='mysite.com' version='1.0' xml:lang='en'>
<stream:features><mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'><mechanism>PLAIN</mechanism><mechanism>DIGEST-MD5</mechanism><mechanism>SCRAM-SHA-1</mechanism></mechanisms><c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://www.process-one.net/en/ejabberd/' ver='yy7di5kE0syuCXOQTXNBTclpJWo='/><register xmlns='http://jabber.org/features/iq-register'/></stream:features>
<success xmlns='urn:ietf:params:xml:ns:xmpp-sasl'/>
<stream:error><xml-not-well-formed xmlns='urn:ietf:params:xml:ns:xmpp-streams'/></stream:error>
</stream:stream>
I've seen in some peoples code, after step 2, they run <stream> again, but in others they don't. Is this needed?
Server Dialback is uses for s2s (server-to-server) connections. You don't need it for c2s (client-to-server) connections.

Configure proxy in xmpp file transfer (Extension EXP-0065)

Server: testXyz
 <br>
Senderjid:user1#testXyz <br>
Receiverjid:user2#testXyz
RECV:
<iq xmlns="jabber:client" id="C8B91358-179B-4883-9EEC-A251D99E9AB5" to="user1#testXyz" from="user2#testXyz/Spark 2.6.3" type="error">
<query xmlns="http://jabber.org/protocol/bytestreams" sid="C8B91358-179B-4883-9EEC-A251D99E9AB5" mode="tcp">
<streamhost jid="proxy.Server" host="172.16.3.73" port="7777"/>
</query><error code="406" type="MODIFY">
<not-acceptable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"/>`
I have set the [TURNSocket setProxyCandidates:[NSArray arrayWithObjects:Server,nil]];
From one of answer on stack overflow I came to know that On OpenFire, I needed to set the ip of the proxy using a system property of xmpp.proxy.externalip. But I have installed open fire on my one of machine of local network. So, what should be the value of xmpp.proxy.externalip here this property?
Following already tried as a value of 'xmpp.proxy.externalip'
1. PC's IP(local ip shown by ipconfig command)
2. IP shown by what's myip website.
Any help would be appreciated.

Set ejabberd as a xmpp proxy for Facebook Chat with X-FACEBOOK-PLATFORM

I want to use ejabberd for xmpp proxy with Facebook Chat
It already work but unfornunately when i ask for authentication with chat.facebook.com the X-FACEBOOK-PLATFORM mechanism is not possible
This is facebook answer for mechanism :
<mechanism>DIGEST-MD5</mechanism><mechanism>PLAIN</mechanism>
The complet facebook answer :
<body xmlns='http://jabber.org/protocol/httpbind' xmlns:xmpp='urn:xmpp:xbosh' xmlns:stream='http://etherx.jabber.org/streams' sid='XXX' wait='300' requests='2' inactivity='30' maxpause='120' polling='2' ver='1.6' from='chat.facebook.com' secure='true' authid='433584819' xmpp:version='1.0'>
<stream:features xmlns:stream='http://etherx.jabber.org/streams'>
<mechanisms xmlns='urn:ietf:params:xml:ns:xmpp-sasl'>
<mechanism>DIGEST-MD5</mechanism>
<mechanism>PLAIN</mechanism>
</mechanisms>
<register xmlns='http://jabber.org/features/iq-register'/>
</stream:features>
</body>
Do you know why the X-FACEBOOK-PLATFORM mechanism is not in the list ?
Thank you
AFAIK ejabberd does not support routing in BOSH. You can only connect to the XMPP domains hosted on your ejabberd sever over BOSH. What you need is a BOSH connection manager like Punjab.
Alex

Bosh Set up using openfire

I am using openfire in windows to set up bosh connection manager...the installation is successfull but wen i give the url http://localhost:9090/bosh it says
HTTP ERROR: 404
NOT_FOUND
RequestURI=/http-bind/
Powered by Jetty://
tried http://localhost:9090/http-bind/
gives the same error
can anyone pls tel me wat s happening...
how do i troubleshoot
Thanks
Try setting the port to 7070 I believe that's the default BOSH port for Openfire. Go to the Admin consol and check out http binding (what bosh does is bind the xmpp protocol to a http request response model.... basically)
http://127.0.0.1:9090/http-bind.jsp
Edit: Actually what do you mean by "give the url"? are you putting that into the browser?
The admin consol url is http://127.0.0.1:9090/index.jsp
Try using POST rather than GET containing a <body/> element, as specified in XEP-0206:
POST /bosh HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: 275
<body content='text/xml; charset=utf-8'
from='user#localhost'
hold='1'
rid='1573741820'
to='localhost'
wait='60'
xml:lang='en'
xmpp:version='1.0'
xmlns='http://jabber.org/protocol/httpbind'
xmlns:xmpp='urn:xmpp:xbosh'/>
The BOSH request requires a BODY.
If your HTTP Bind Settings do not allow for Script Syntax then you will get a 404 error for a GET request. If you enable Script Syntax, i.e. Allows BOSH clients with limited access to connect to the server, then you will get a 400 error for a GET request, so you will at least know that Jetty is listening on that port.
To send a valid request you should make a POST request with a body, e.g. with cURL you can run (line breaks added for clarity):
curl -X POST -d "<body content='text/xml; charset=utf-8'
from='user#localhost'
hold='1'
rid='1573741820'
to='localhost'
wait='60'
xml:lang='en'
xmpp:version='1.0'
xmlns='http://jabber.org/protocol/httpbind' xmlns:xmpp='urn:xmpp:xbosh'/>"
http://desktop-nquceg9:7070/http-bind/
Try to set Script Syntax to Enable at http://127.0.0.1:9090/http-bind.jsp