Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with Node 0.10.x with secure is true #160

Closed
domkm opened this issue Apr 10, 2013 · 10 comments
Closed

Incompatible with Node 0.10.x with secure is true #160

domkm opened this issue Apr 10, 2013 · 10 comments

Comments

@domkm
Copy link

domkm commented Apr 10, 2013

I ran into a problem setting up hubot-irc (nandub/hubot-irc#76). At this point, the problem appears to be that node-irc (a dependency of hubot-irc) is incompatible with Node versions 0.10.x. Downgrading to 0.8.x fixes any issues. To replicate, run the secure.js example using Node 0.10.x and 0.8.x (you will have to comment out line 4).

@jketreno
Copy link

Not sure what the 'correct' fix is, but here is what I had to do:

First, add a 'netError' handler (instead of just 'error'):

client.addListener('netError', function(error) {
  console.log('netError: ' + error);
});

that started showing the error:

netError: Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE

Which I used to see prior to setting selfSigned = true in my client config options... so, the second part of the "fix" is to patch node-irc with the following:

diff --git a/lib/irc.js b/lib/irc.js
index 79e9600..c1bd172 100644
--- a/lib/irc.js
+++ b/lib/irc.js
@@ -577,7 +577,7 @@ Client.prototype.connect = function ( retryCount, callback ) { // {{{
     if (self.opt.secure) {
         var creds = self.opt.secure;
         if (typeof self.opt.secure !== 'object') {
-            creds = {};
+            creds = { rejectUnauthorized: !self.opt.selfSigned };
         }

         self.conn = tls.connect(self.opt.port, self.opt.server, creds, function() {

and success. node-irc now working with 10.0.x.

@wridgers
Copy link

This fix worked for me.

Any idea when this issue will be correct in the master branch?

@ronaldevers
Copy link

Yeah I also stumbled upon this. It seems that the 'error' callback is called, maybe because there is no netError callback. Maybe the tls library changed behavior slightly, I don't know. Anyway, without the rejectUnauthorized option, the connect callback never gets called.

Oh by the way, I think it should be:

creds = { rejectUnauthorized: !self.opt.secure };

since besides self-signed there is also the expired flag. All of that is checked manually in the callback from tls.connect(...) as far as I can tell.

@lhecker
Copy link

lhecker commented May 24, 2013

@ronaldevers fix worked for me too. Thanks! 😃

@spajus
Copy link

spajus commented Jun 18, 2013

👍

@radare
Copy link

radare commented Jul 2, 2013

Can you push a new release of irc.js with this bugfix? it works for me too

@nullthreat
Copy link

Worked here as well

@jarofghosts
Copy link

Yeah, this appears to still be a thing.

@Weyland
Copy link

Weyland commented Jan 21, 2014

+1 This helped me save a few hours of debugging.

Mutjake added a commit to Mutjake/enocoffeebot that referenced this issue Mar 31, 2014
@osslate
Copy link
Collaborator

osslate commented May 29, 2014

Fixed in master.

@osslate osslate closed this as completed May 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests