coussej / node-opcua-logger

An OPCUA Client for logging data to InfluxDB! 🔌 🏭
https://www.factry.io
MIT License
180 stars 63 forks source link

OpenSSL Issue #18

Open AWanderingEngineer opened 5 years ago

AWanderingEngineer commented 5 years ago

Hi,

First I want to say I'm pretty new at linux and so I apologize in advance is this is a minor issue with an obvious solution. I'm trying to get this package installed and upon running npm install from the node-opcua-logger directory I get several errors having to do with the creation of private keys and certificates using openSSL. I've attached a text file with all the errors (there were several, all related to openSSL). However they all appear to be duplicates of this:

###########OPENSSL ERROR ############
CWD = /home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client
Command failed: "openssl" genrsa  -out "/home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/private_key.pem" -rand "/home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/random.rnd" 2048
Can't load /home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/random.rnd into RNG
139806547309696:error:2406F079:random number generator:RAND_load_file:Cannot open file:../crypto/rand/randfile.c:98:Filename=/home/bmcadmin/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/random.rnd
[OPCUA-Logger Errors.txt](https://github.com/coussej/node-opcua-logger/files/3238905/OPCUA-Logger.Errors.txt)

Thanks for any help resolving this issue!

coussej commented 5 years ago

Hi, can you specify some details about your environment?

Heli4ce commented 5 years ago

I have the same issues, both unexperienced and "Can't load /home....../random.rnd into RNG": My versions are:

user@computer:\~/node-opcua-logger$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic user@computer:\~/node-opcua-logger$ openssl version OpenSSL 1.1.1 11 Sep 2018 user@computer:\~/node-opcua-logger$ node --version v8.10.0

I don't know how to tell if openssl is correctly installed...

As far as I can understand I miss these files: /node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/random.rnd and /node-opcua-logger/node_modules/node-opcua-server/certificates/PKI/own/private/random.rnd and /node-opcua-logger/node_modules/node-opcua-server-discovery/certificates/PKI/own/private/random.rnd

Thanks!

Resolved by doing this... sudo openssl genrsa -out "/home/user/node-opcua-logger/node_modules/node-opcua-server-discovery/certificates/PKI/own/private/private_key.pem" 2048 sudo openssl genrsa -out "/home/user/node-opcua-logger/node_modules/node-opcua-server/certificates/PKI/own/private/private_key.pem" 2048 sudo openssl genrsa -out "/home/user/node-opcua-logger/node_modules/node-opcua-client/certificates/PKI/own/private/private_key.pem" 2048 cd /home/user/node-opcua-logger/node_modules/node-opcua-client node test_helpers/create_certificates.js certificate -s -o certificates/client_selfsigned_cert_1024.pem cd ../node-opcua-server node test_helpers/create_certificates.js certificate -s -o certificates/server_selfsigned_cert_2048.pem cd ../node-opcua-server-discovery/ node test_helpers/create_certificates.js certificate -s -o certificates/server_selfsigned_cert_2048.pem

not sure if the sudo bit on openssl commands is really necessary...

coussej commented 4 years ago

Hi @AWanderingEngineer,

certificate generation is done by the underlying node OPCUA library, and I've had problems with it before. Could you try this with the new version (v2) of the logger, which also contains a much more recent version of the node-OPCUA library? Even better, if you download a binary from the release page, you don't need to generate anything yourself.