pgstath / Sharp.Xmpp

Sharp.Xmpp is looking for a maintainer! Unfortunatelly I do not have currently the time needed to maintain the library. Luckily a small but vibrant community has evolved around Sharp.Xmpp. If you would like to be the project's maintainer please sent an email to pgstath@gmail.com. This should include issues, tickets and commits that you have done for Sharp.Xmpp or other similar project. Sharp.Xmpp is a multiplatform, Windows and Android, .NET XMPP client assembly.Sharp.Xmpp supports IM functionality & a variety of XMPP extensions, is simple and is extensively tested against Android Xamarin. It is a fork of the currently frozen excellent S22.Xmpp project. Sharp.Xmpp will be at the FOSSDEM 2016 Real time DevRoom!
Other
84 stars 51 forks source link

Session establishment failed #9

Closed mabra closed 8 years ago

mabra commented 8 years ago

Hi !

I just used the demo from the docs, compiled and failed:

Exception: Sharp.Xmpp.XmppErrorException: Session establishment failed.

client.Connect();

The xmpp server record is there and properly read. The credentials for the jid are verified. My chatroom appender with agXMPP works properly with that server, which is an OpenFire.

Thanks anyway and best regards, Manfred

pgstath commented 8 years ago

Hi, It would be very useful if you could append a log from the server side. I could direct you to related steps (please note that these are different and depend on the OS version used for openfire)

mabra commented 8 years ago

Hello !

Thanks for your reply.

I additionally ask a question about OpenFire's log in the OpenFire forum, because it shows something, which I never saw before.

OpenFire is running on Debian 6.0.10 (squeeze) with version 3.6.4

OpenFire has two log entries, under warning and under debug.

Warning:

2015.09.29 17:38:01 Closing session due to incorrect hostname in stream header. Host: thor.manne.eu. Connection: org.jivesoftware.openfire.net.SocketConnection@a946ac socket: Socket[addr=/37.209.66.102,port=57507,localport=5269] session: null

Debug:

2015.09.29 19:36:24 NIOConnection: startTLS: using c2s 2015.09.29 19:36:25 AuthorizationManager: Trying Default Policy.authorize(test , test@manne.eu) 2015.09.29 19:36:25 DefaultAuthorizationPolicy: Checking authenID realm 2015.09.29 19:36:25 DefaultAuthorizationPolicy: authenRealm = xmpp.domain 2015.09.29 19:36:25 LocalOutgoingServerSession: OS - Trying to connect to thor.manne.eu:5269(DNS lookup: thor.manne.eu:5269) 2015.09.29 19:36:25 LocalOutgoingServerSession: OS - Plain connection to thor.manne.eu:5269 successful 2015.09.29 19:36:25 Connect Socket[addr=/37.209.66.102,port=57607,localport=5269] 2015.09.29 19:36:25 Connection closed before session established Socket[addr=/37.209.66.102,port=57607,localport=5269] 2015.09.29 19:36:25 LocalOutgoingServerSession: OS - Going to try connecting using server dialback with: thor.manne.eu 2015.09.29 19:36:25 ServerDialback: OS - Trying to connect to thor.manne.eu:5269(DNS lookup: thor.manne.eu:5269) 2015.09.29 19:36:25 Connect Socket[addr=/37.209.66.102,port=57608,localport=5269] 2015.09.29 19:36:25 ServerDialback: OS - Connection to thor.manne.eu:5269 successful 2015.09.29 19:36:25 ServerDialback: OS - Sent dialback key to host: thor.manne.eu id: bc6e5a19 from domain: manne.eu 2015.09.29 19:36:25 ServerDialback: RS - Received dialback key from host: manne.eu to: thor.manne.eu 2015.09.29 19:36:25 ServerDialback: RS - Error, hostname not recognized: thor.manne.eu 2015.09.29 19:36:25 Connection closed before session established Socket[addr=/37.209.66.102,port=57608,localport=5269] 2015.09.29 19:36:25 ServerDialback: OS - Unexpected answer in validation from: thor.manne.eu id: bc6e5a19 for domain: manne.eu answer:/stream:error 2015.09.29 19:36:25 OutgoingSessionPromise: Error sending packet to remote server:

java.lang.Exception: Failed to create connection to remote server at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.sendPacket(OutgoingSessionPromise.java:252) at org.jivesoftware.openfire.server.OutgoingSessionPromise$PacketsProcessor.run(OutgoingSessionPromise.java:216) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662)

Also the connected was close - so it looks for me, by the client - the java-arch cannot cancel the started thread at this point. As sad, I asked in there forum, but have no answer yet. As sad, all my agXMPP base tools ar working from inside the firewall and also Gajim and PSI. From outside, I use Xaber and Jitsi. My DNS record are ok too:

Do:

host -t SRV _xmpp-client._tcp.manne.eu host -t SRV _xmpp-server._tcp.manne.eu

and this is the result:

_xmpp-client._tcp.manne.eu has SRV record 10 10 5222 thor.manne.eu. _xmpp-server._tcp.manne.eu has SRV record 10 10 5269 thor.manne.eu.

The testprogram runs on Windows Server 2008 R2 with anti-Virus protection and firewall enabled. I had disbaled both, just to be sure and added an additional rule for the testprogram.

Hope, this gives a tip.

OOOHH, suddenly, at least, something comes to my mind: My server does not have a official certificate !!!!!

Thanks so far and best regards,

Manfred

From: PGS [mailto:notifications@github.com] Sent: Tuesday, September 29, 2015 4:29 PM To: pgstath/Sharp.Xmpp Cc: mabra Subject: Re: [Sharp.Xmpp] Session establishment failed (#9)

Hi, It would be very useful if you could append a log from the server side. I could direct you to related steps (please note that these are different and depend on the OS version used for openfire) — Reply to this email directly or view it on GitHub https://github.com/pgstath/Sharp.Xmpp/issues/9#issuecomment-144077388 . https://github.com/notifications/beacon/AAekDsQOlyKngZe62AYNNEVTcn72giVyks5o2peygaJpZM4GFru6.gif

pgstath commented 8 years ago

Hey thanks for the log and the information, it is detailed. However, sorry for not being clear enough, I meant the XMPP log. The openfire java log is not quite useful usually.

The steps in order to have the Openfire XMPP logs are:

  1. install Openfire Debugger plugin, http://www.igniterealtime.org/projects/openfire/plugins.jsp (From the plugin admin menu)
  2. Enable it under Server/Server Manager/System Properties: plugin.debugger.interpretedAllowed -- true to print XML packets after they were parsed by the server. . The default value is false.

    In my installation XMPP logs are accessible after:

  3. sudo -i
  4. cd /opt/openfire/logs. (actual location is configuration option of the server under the key xmpp.audit.logdir )
  5. tail -f nohup.out

From my experience at some point, with any library these are going to be needed, so it is a step worth taking!

In either case I would not bet on being the certificate. S22.Xmpp/Sharp.Xmpp have a callback, when the certificate is not signed, but it must be explicitly be implemented.

By the way what is the value of your xmpp.domain configuration property in open fire? It should be the XMPP domain. I can see this message on your logs:

"Unexpected answer in validation from: thor.manne.eu id: bc6e5a19 for domain: manne.eu" and "Unexpected answer in validation from: thor.manne.eu id: bc6e5a19 for domain: manne.eu answer:/stream:error"

xmpp.domain should be manne.eu, if it is not please try just for testing's sake to change it to thor.manne.eu.

mabra commented 8 years ago

Hi !

The value for the domain is "manne.eu", which is correct. I was a moment mooney and trusted you too much ... ;-) I put "thor.manne.eu" into the domain and saw the dead. I was no longer able to logon, because Openfire takes all users relative to the registered domain, like admin@mann.eu. Now, no user was valid :-(

I hacked around a lot until I remembered, that this also at installtime happened to me ... ;-)

The xmldebugger plugin cannot be installed, because it needs a newer server version.

We can just stop here, because I'll even have no time to go further - I just stumpled inadvertently onto your lib ....

The box is 15 years old and a plan to replace lies on my table since two years and the new box too - a little old now ... I'll need debian jessie with a new mono version and more power, but stuck in other projects. Hope, before the end of the year, everything is on modern software ...

I'll keep your new lib in memory, would even require a chatroom feature, so to wait is the right moment.

Thanks for your investigation!

Best regards,

Manfred

From: PGS [mailto:notifications@github.com] Sent: Tuesday, September 29, 2015 9:29 PM To: pgstath/Sharp.Xmpp Cc: mabra Subject: Re: [Sharp.Xmpp] Session establishment failed (#9)

Hey thanks for the log and the information, it is detailed. However, sorry for not being clear enough, I meant the XMPP log. The openfire java log is not quite useful usually. The steps in order to have the Openfire XMPP logs are:

  1. install Openfire Debugger plugin, http://www.igniterealtime.org/projects/openfire/plugins.jsp (From the plugin admin menu)
  2. Enable it under Server/Server Manager/System Properties: plugin.debugger.interpretedAllowed -- true to print XML packets after they were parsed by the server. . The default value is false. In my installation XMPP logs are accessible after:
  3. sudo -i
  4. cd /opt/openfire/logs. (actual location is configuration option of the server under the key xmpp.audit.logdir )
  5. tail -f nohup.out From my experience at some point, with any library these are going to be needed, so it is a step worth taking! In either case I would not bet on being the certificate. S22.Xmpp/Sharp.Xmpp have a callback, when the certificate is not signed, but it must be explicitly be implemented. By the way what is the value of your xmpp.domain configuration property in open fire? It should be the XMPP domain. I can see this message on your logs: "Unexpected answer in validation from: thor.manne.eu id: bc6e5a19 for domain: manne.eu" and
pgstath commented 8 years ago

OK thanks Mabra. One thing that I must definitely put in the library is the ability to printout the received XML messages, this would be helpful for this situation as well.