emiloberg / liferay-ddmtool

Tool for authoring, uploading, downloading and synchronizing Liferay DDM related stuff (Structures and Templates) across environments.
MIT License
36 stars 16 forks source link

Support for SSL using self-signed certs #6

Closed zipwiz closed 9 years ago

zipwiz commented 9 years ago

I tried to use this tool to fetch built structure meta data from a dev host which is reachable only via https, but has only self-signed dummy certs installed. I receive this message:

Unknown error: {"code":"DEPTH_ZERO_SELF_SIGNED_CERT"}

This seems to be a node.js problem but can be overcome using the right modules and implementation (as it seems).

Is it possible to extend liferay-ddmtool such that thid problem can be bypassed at least by explicit configuration? Something like "allowSelfSignedCerts : true"?

zipwiz commented 9 years ago

Additional resources: https://github.com/request/request/issues/418

emiloberg commented 9 years ago

Looks like Node changed a bit around 0.10.x

rejectUnauthorized: If true, the server certificate is verified against the list of supplied CAs. An 'error' event is emitted if verification fails. Verification happens at the connection level, before the HTTP request is sent. Default true.

Could you test one thing for me: Open the index.js and add the following line at the very top:

process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;

Does that solve it?

zipwiz commented 9 years ago

Thanks... result is:

Getting data from server Downloading id's

Downloading list of sites

Error Error: Could not find any sites

I interpret this as "yes, this problem is solved" (although having another one now...)

emiloberg commented 9 years ago

Ouch! Could I ask you to add a new issue (so I can keep this for implementing a nicer way of accepting self signed certs).

zipwiz commented 9 years ago

OK, I will try some title and content... I hope to meet your expectations ;-)

emiloberg commented 9 years ago

Just copy paste the previous message and I'm happy ;)

zipwiz commented 9 years ago

take a look...

zipwiz commented 9 years ago

or did you mean the full ddm-tool reply?

emiloberg commented 9 years ago

Haha, I meant the Error: Could not find any sites problem, as I think that's a separate issue, but no problems, let's do it here.

If you find me on skype: emil.oberg or hangout: emil.oberg@gmail.com It might be easier to debug the problem.

zipwiz commented 9 years ago

I will come back as necessary, but I think that the problem is not caused by ddm-tool, but by my local setup. If that is succuessfully excluded as a possible reason, I will aks again here. Thanks for the offer however :-)

emiloberg commented 9 years ago

Perfect! Don't hesitate to come back if the error persist!