Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ionic 3 / node.js - Self signed certificate in certificate chain (how to disable strict-ssl?)

I cannot create a ionic project with ionic start because of following error:

Error: self signed certificate in certificate chain
    at TLSSocket.<anonymous> (_tls_wrap.js:1103:38)
    at emitNone (events.js:106:13)
    at TLSSocket.emit (events.js:208:7)
    at TLSSocket._finishInit (_tls_wrap.js:637:8)
    at TLSWrap.ssl.onhandshakedone (_tls_wrap.js:467:38)

on cmd: ionic start myApp tabs

Because our proxy sends a self-signed signature for all sites. (FortiGate of FortiNet)

In npm I set strict-ssl to false and works fine. But ionic loads the content over a node application, right?

How to setup node to ignore self signed certificates for all node applications or how to disable it for ionic?

ionic info

   @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

System:

    Node : v8.9.1
    npm  : 5.5.1
    OS   : Windows 10

Misc:

    backend : legacy
like image 727
Dominik Avatar asked Dec 06 '17 17:12

Dominik


People also ask

How do I whitelist a self-signed certificate?

Navigate to the site with the cert you want to trust, and click through the usual warnings for untrusted certificates. In the address bar, right click on the red warning triangle and "Not secure" message and, from the resulting menu, select "Certificate" to show the certificate.


2 Answers

I resolved my problem using:

set NODE_TLS_REJECT_UNAUTHORIZED=0
like image 98
Jayesh L Avatar answered Oct 12 '22 15:10

Jayesh L


Setting set NODE_TLS_REJECT_UNAUTHORIZED=0 comes at a great risk to the security of your application. I would recommend avoiding this "work around" for production software. I recommend reading this before disabling.

I'm still trying to fix my own issue and will update if I come up with a safer solution.

like image 28
Jerome Hurley Avatar answered Oct 12 '22 15:10

Jerome Hurley