Setting Node Red SSL on Docker

Hi guys, I am trying to set https secure connection with node red , I have generated the certificates following this tutorial NODE_RED SSL, on settings.js uncomented the follwing:

var fs = require("fs");
https: {
        //key: fs.readFileSync('privatekey.pem'),
        //cert: fs.readFileSync('certificate.pem')
		key: fs.readFileSync('/data/node-cert.pem'),
        cert: fs.readFileSync('/data/node-key.pem')
    },
    // The following property can be used to cause insecure HTTP connections to
    // be redirected to HTTPS.
requireHttps: true,

But node-red wont start , the log show the following error, Any hint?

I think that may mean that your certificate file is not valid

Thanks @colin , If my node-red is running in docker container , what would be the common name field when generating the certificate? the IP of my synology or the IP of the docker container?

Sorry, I don't know.

I think it’s the format of your files, not the Common name you’ve chosen for the certificate, that could be the problem.

That “No start line” error looks like something from an underlying SSL library.

  1. Are the line endings in the file correct for the system you’re running Node RED on (eg Unix doesn’t like Windows’ ^M - carriage return - characters),
  2. Are the key and certificate definitely in a PEM format?

I had node-red fail to start due to assuming the path I entered in settings was relative to where I placed certs.

Try removing the path (use just the file names) and put a copy of certs in .node-red folder or possibly the node-red global folder.

Might be a different issue but I seen what you're seeing when the certs were not found. Worth a try?

Your cert and priv key are backwards.

2 Likes

thanks all for the responses, I will try once again.. @gschellhas is right !! my cert and private key are backwards!!