Skip to content

Loading…

Error "Hostname/IP doesn't match certificate's altnames" with Node 0.10.0 #181

Closed
naholyr opened this Issue · 6 comments

4 participants

@naholyr

Hello,

I cannot find any way to connect to imap.gmail.com anymore when using imap with Node 0.10.0, it continuously throws the following error:

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Hostname/IP doesn't match certificate's altnames
    at SecurePair.<anonymous> (tls.js:1280:23)
    at SecurePair.EventEmitter.emit (events.js:92:17)
    at SecurePair.maybeInitFinished (tls.js:883:10)
    at CleartextStream.read [as _read] (tls.js:421:15)
    at CleartextStream.Readable.read (_stream_readable.js:293:10)
    at EncryptedStream.write [as _write] (tls.js:330:25)
    at doWrite (_stream_writable.js:211:10)
    at writeOrBuffer (_stream_writable.js:201:5)
    at EncryptedStream.Writable.write (_stream_writable.js:172:11)
    at write (_stream_readable.js:547:24)

I'm not sure exactly why this happens, in previous versions it happened when you provided a direct IP for connection, but it's not the case here.

I'll try to dig further, but for the moment I have no idea :s

Note: i tested with all available 0.9.x versions and I can say it's still working in 0.9.1, and starts failing at 0.9.2.

@naholyr

OK I found the source of the issue, from changelog of 0.9.2:

tls, https: validate server certificate by default (Ben Noordhuis)

Add rejectUnauthorized: false to go back to previous behavior. I think the best would be to allow tls options to be passed to Imap#connect, I'll send a PR for that in a few minutes :)

@naholyr naholyr added a commit to lmtm/node-imap that referenced this issue
@naholyr naholyr Allow custom TLS options (fix #181) a1bb885
@mscdex mscdex closed this in 0b042e0
@skeggse

This hasn't been added to the npm module, has it? For now, I'm modifying imap.js, but I'd prefer not to.

@naholyr

You could depend on https://github.com/mscdex/node-imap.git#5610cb90c7 in your package.json and change it back when it's published :)
That's what I do.

@skeggse

Okay, I'll do that. Thanks!

@mscdex
Owner

I'll be publishing a new version once I get the ugly fetch() bug fixed.

@chirag04 chirag04 referenced this issue in circuithub/mail-listener
Closed

mail listener breaks on receiving new mails #7

@chirag04

@mscdex Can we have this published to npm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.