How to secure node-red with https access

Hello to all !
I try to put my node red access in https but I can't succeed.

1 Jan 07:11:33 - [info] Node-RED version: v3.1.3
1 Jan 07:11:33 - [info] Node.js version: v20.10.0
1 Jan 07:11:33 - [info] Linux 6.1.69-v8+ arm64 LE

OpenSSL 3.0.11 19 Sep 2023 (Library: OpenSSL 3.0.11 19 Sep 2023)

What I did : https://dave.thwaites.org.uk/theatre-royal/eos-remote/securing-nodered.html

When I start node-red-start I have this in the log :

Error loading settings file: /home/hotspot/.node-red/settings.js
Error: EACCES: permission denied, open '/home/hotspot/.node-red/public/privatekey.pem'

I have a public and inside I have :

:/home/hotspot/.node-red/public# ls
certificate.pem myCA.cer myCA.key private-csr.req privatekey.pem

In the settings.js :
/** Option 1: static object */
https: {
key: require("fs").readFileSync('/home/hotspot/.node-red/public/privatekey.pem'),
cert: require("fs").readFileSync('/home/hotspot/.node-red/certificate.pem')
},

requireHttps: true,

Any help will be very appreciated my friends :slight_smile:

Best regards and a happy new year 2024 to all !

Ensure the account which runs node-red has read access to the files.

ok steve I check it now

it means that all the files are only in a root access

ls -l
total 20
-rw-r--r-- 1 root root 916 Jan 1 06:51 certificate.pem
-rw-r--r-- 1 root root 1107 Jan 1 06:49 myCA.cer
-rw------- 1 root root 1704 Jan 1 06:49 myCA.key
-rw-r--r-- 1 root root 676 Jan 1 06:51 private-csr.req
-rw------- 1 root root 916 Jan 1 06:49 privatekey.pem

question 1 : but I have created this file not in a root session and without sudo command ?
question 2 : the node red isn't installed in root session but in a standart as pi (hotspot in my case) session ?

Many thanks for your help :slight_smile:

No idea

Just chown the files and be done :smile:

so easy many thanks steve :slight_smile:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.