Not logged in. · Lost password · Register
Forum: MatriX and XmppDotNet RSS
Avatar
neoXMPP #1
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
Subject: Cisco Presence Server and Matrix SDK in C#
Hello Experts! I used the Matrix SDK to successfully connect and send/receive chats with the Google server. But I am having a tough time doing the same with a Cisco Presence Server (ver 9.1) using BOSH.

I've set the Transport to BOSH and specified the Uri parameter to point the Cisco Server. I have checked the URL in a browser and I get the RFC landing page from Presence Server.

  1. xmppClient.Transport = Matrix.Net.Transport.BOSH;
  2. xmppClient.Uri = new System.Uri("https://cisco-server.lab.com:7335/httpbinding/");

I am unable to Login successfully to the Cisco Server. I can see traffic going back and forth in a wireshark, but doesn't give any clues.

If someone has done it already, could you share the relevant section of the code?
This post was edited 2 times, last on 2013-05-02, 08:59 by Alex.
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Your code is correct.
Please post your complete BOSH log which you can get from the handlers OnReceiveBody and OnSendBody.
Avatar
neoXMPP #3
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
I do have the OnReceiveBody and OnSendBody writing to Console, but don't see any messages written. Here's my  code:

  1. static void Main(string[] args)
  2. {
  3.     ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;      
  4.     XmppClient xmpp = new XmppClient();
  5.     xmpp.SetUsername("username");
  6.     xmpp.Password = "Password";
  7.     xmpp.SetXmppDomain("xmpp.lab");
  8.  
  9.     xmpp.ResolveSrvRecords = false;
  10.     xmpp.Transport = Matrix.Net.Transport.BOSH;
  11.     xmpp.Uri = new System.Uri("https://server-cups1.xmpp.lab:7335/httpbinding/");
  12.     xmpp.Port = 7335;
  13.  
  14.     xmpp.Open();
  15.  
  16.     xmpp.OnReceiveBody += new EventHandler<Matrix.Net.BodyEventArgs>(XmppClientOnReceiveBody);
  17.     xmpp.OnSendBody += new EventHandler<Matrix.Net.BodyEventArgs>(XmppClientOnSendBody);
  18. }
  19. static void XmppClientOnReceiveBody(object sender, Matrix.Net.BodyEventArgs e)
  20. {
  21.    Console.WriteLine(e.Body);
  22.    Console.ReadLine();
  23. }
  24.  
  25. static void XmppClientOnSendBody(object sender, Matrix.Net.BodyEventArgs e)
  26. {
  27.     Console.WriteLine(e.Body);
  28.     Console.ReadLine();
  29. }
This post was edited on 2013-05-02, 10:10 by Alex.
Avatar
Alex #4
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
the handlers should be before the Open call.
The Open call is async, which means it returns immediately and your console app will terminate before you are connected. You have to prevent you console app also from terminating. Look at the console example which ships with MatriX.
Avatar
neoXMPP #5
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
I have tried that before, it works perfectly with GMail IDs. It doesn't work against Cisco while not using BOSH. Here's the XML for you:

  1. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="cups1" version="1.0" >
  2. RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" xml:lang="en-US.UTF-8" id="417E2AC2C2" from="cups1" version="1.0" >
  3. RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  4.  <starttls xmlns="urn:ietf:params:xml:ns:xmpp-tls">
  5.     <required />
  6.  </starttls>
  7. </stream:features>
  8. </stream:features>
  9. SEND:  
  10. SEND:

And I don't know how to use miniclient to talk over BOSH. Is there a sample you can point me to, something that has been tested against Cisco Presence Server?
This post was edited 2 times, last on 2013-05-02, 10:41 by neoXMPP.
Avatar
Alex #6
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
Quote by neoXMPP:
Is there a sample you can point me to, something that has been tested against Cisco Presence Server?

The MiniClient example should work fine. We have lots of customers user Cisco XMPP servers without any problem.

Is the last log you posted from an connection attempt over BOSH? If yes then your server is configured wrong. Because it only offers the starttls stream feature which is not allowed on BOSH. It must offer the SASL mechanisms here.

Alex
Avatar
neoXMPP #7
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
Made changes to make Mini Client talk BOSH. Some progress but still not getting through. Here's the XML from Mini Client:

  1. SEND: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" to="icollab.lab" version="1.0" >
  2. RECV: <stream:stream xmlns:stream="http://etherx.jabber.org/streams" xmlns="jabber:client" from="icollab.lab" version="1.0" id="24535E324B" >
  3. RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">
  4.  <mechanisms xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  5.     <mechanism>PLAIN</mechanism>
  6.     <mechanism>CISCO-VTG-TOKEN</mechanism>
  7.  </mechanisms>
  8. </stream:features>
  9. SEND: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">XXXX</auth>
  10. RECV: <failure xmlns="urn:ietf:params:xml:ns:xmpp-sasl">
  11.  <not-authorized />
  12. </failure>
  13. SEND: </stream:stream>
This post was edited on 2013-05-02, 11:25 by Alex.
Avatar
Alex #8
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
authentication failed. Either username or password is wrong.
Avatar
neoXMPP #9
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
I had all users auth handled by LDAP before, tried creating a local user and it started working. I get a success response:
  1. RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />

I am not sure if LDAP auth is supposed to work with Matrix.  Thanks for all the help so far!
This post was edited on 2013-05-02, 11:56 by Alex.
Avatar
Alex #10
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
The authentication your server offers is SASL plain, this means a client must offer a valid username and password combination.
LDAP is configured only on the backend of your server.

There are also many other authentication mechanisms in MatriX like Kerberos, GSSAPI..... but they are not configured on your server right now.

Anyway, this SASL Plain is fine when your server used this to authenticate against your LDAP properly. So there is probably still something missing in your LDAP configuration, or you have to provide the username in a special format.
Avatar
neoXMPP #11
Member since May 2013 · 14 posts
Group memberships: Members
Show profile · Link to this post
LDAP Auth is setup correctly as it works from other clients (for the same test users). And I have tried all possible combinations of user IDs
Name
Domain\Name
Name@Domain
Name@Domain.Com
Name@Server
Name@Server.Domain
Name@Server.Domain.Com

But then I disabled LDAP-S and used LDAP without SSL. (Cisco <-no-SSL-> LDAP) and Mini Client started working for LDAP Login now. XML Logs show a successful response.

  1. SEND: <auth mechanism="PLAIN" xmlns="urn:ietf:params:xml:ns:xmpp-sasl">XXX</auth>
  2. RECV: <success xmlns="urn:ietf:params:xml:ns:xmpp-sasl" />

Funny thing is, the XCP Traces on the Cisco server shows only failure login attempts, nothing comes up for successful logins.

21:44:48.568 | error| SXComponent::_processRequest(): SASL::Plain Authentication failed, sending auth failure
21:44:48.568 | error| SXComponent::_sendAuthFailure(): Auth component sending Failure
21:45:20.943 | error| SXComponent::isUserAuthenticated(): User: [user1] was not successfully Authenticated
21:45:20.943 | error| SXComponent::authenticatePlainSASL(): isUserAuth check failed for user: [user1]
This post was edited 2 times, last on 2013-05-02, 20:39 by Alex.
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters: