Where is the default CA certs used in nodejs?

I'm connecting to a server whos cert is signed by my own CA, the ca's cert had installed into system's keychain.

connecting with openssl s_client -connect some.where says Verify return code: 0 (ok)

but i cant connect with nodejs's tls/https module, which fails with Error: SELF_SIGNED_CERT_IN_CHAIN

but connecting to a normal server (i.e google.com:443) works fine.

seems that nodejs's openssl is not sharing same keychain with system's openssl.

but I cannt find where is it. i tried overide with SSL_CERT_DIR but not seemed working.

BTW: i can bypass the server verifying by setting NODE_TLS_REJECT_UNAUTHORIZED=0 , but that's not pretty enough ;)

Im using OSX 10.8.3 with OpenSSL 0.9.8r, node v0.9.8

If you're using the tls module (and it seems like you are) with tls.connect you can pass a ca param in the options that is an array of strings or buffers of certificates you want to trust.