public
Last active

Using Hubot and the hubot-xmpp adapter, I wasn't able to connect to a corp Jabber server running Openfire 3.6.4, with a seemingly different SSL configuration than the stock Openfire one. The node-xmpp client would simply hang after receiving the stanza "<proceed xmlns="urn:ietf:params:xml:ns:xmpp-tls"/>". I've seen several other posts from users experiencing the same issue. Replacing the "starttls.js" file that ships with node-xmpp with this gist fixes the problem for me. Note this requires node 0.8.x or newer.

  • Download Gist
starttls.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/**
* Perform TLS handshake using node's newer tls.connect() and forcing SSLv3
* Fixes client hanging while trying to connect on some Openfire XMPP configurations
*/
 
var crypto = require('crypto');
var tls = require('tls');
 
module.exports = function starttls(socket, credentials, isServer, cb) {
 
// TLS handshake
var cleartext = tls.connect({socket:socket, rejectUnauthorized:false, secureProtocol:'SSLv3_method'}, function() {
cleartext.authorized = true;
if (cb) cb();
});
 
cleartext._controlReleased = true;
return cleartext;
 
};

Can you make a pull request and add this to the README.md under a heading of "Openfire Issues?"? Would really appreciate that. If you don't have time, comment back and will add myself. Thanks!

@lloydwatkin I'm hesitant to pull the trigger too soon in case it breaks handshaking in other circumstances. Should we have more users test?

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.