Giter VIP home page Giter VIP logo

node-opcua-pki's Introduction

node-opcua

node-opcua is a full OPC UA stack for NodeJS and the Browser written in Typescript.

NPM version Node.js CI lerna Coverage Status Gitter chat The Book

NPM download - server NPM download - server -total

NPM download - client NPM download - client -total

Financial contributors

Become a sponsor

Node-opcua is the OPC-UA stack running on NodeJS.

Why NodeJS ?

Because NodeJs is a great framework for designing high-performing asynchronous applications.

Getting started

installing node-opcua as a node package

$ mkdir mytest
$ cd mytest
$ npm init 
$ npm install node-opcua --unsafe-perms
$ # Create your first app.js file!

installing node-opcua samples as a node package

$ mkdir myserver
$ cd myserver
$ npm init
$ npm install node-opcua-samples --unsafe-perms
$ ./node_modules/.bin/simple_server

or

$ ./node_modules/.bin/simple_client  -e "opc.tcp://opcserver.mAutomation.net:4841" -n="ns=1;s=EVR2.system.RTC_SEC"

or

$ ./node_modules/.bin/simple_client  -e "opc.tcp://opcuademo.sterfive.com:26543" 

Minimum Nodejs requirement

  • Nodejs version 18 or above

tutorials and guided examples

The Book. This book provides a large number of practical and ready-to-use and fully documented examples. It's the best starting point to learn about node-opcua.

Sponsors & Backers

The funding of node-opcua entirely relies on its users.
We appreciate that, once you have evaluated the software and you have decided to use it in one of your applications, you consider supporting our effort by either financially contributing to one of our sponsor programs:

Grants ensure the following:

  • ๐Ÿ”จ Long-term maintenance of the project
  • โš™๏ธ maintain the website and continuous integration platform
  • ๐Ÿ›ฃ Progress on the road map
  • ๐Ÿ› Quick responses to bug reports
  • ๐Ÿš€ New features & enhancements
  • โš–๏ธ representing the node-opcua user community at the OPC Foundation

Sponsors

Backers

Thank you to all our backers! Become a backer

Contributors

This project exists thanks to all the people who contribute.

Getting professional support

To get professional support, consider subscribing to the node-opcua membership community:

Professional Support

Registered members have access to an extended set of online documentation.

Registered members can post and query Sterfive for any question related to NodeOPCUA in a private chat room.

or contact sterfive for dedicated consulting and more advanced support or for a certified version of node-opcua. ([email protected]).

Road-map

If your company would like to participate and influence the development of future versions of node-opcua please contact sterfive.

Those are the items we would like to achieve in the next version of the API.

  • improved documentation
  • Compliance testing and certification (CTT)
  • Pub-sub support
  • support for redundancy
  • session-less transactions
  • WebSocket transport
  • JTokens and OAuth
  • reversed connection
  • more tutorials

Advanced topics

installing node-opcua from source

running the demo server from source

 $ git clone https://github.com/node-opcua/node-opcua.git
 $ cd node-opcua
 $ npm install -g pnpm 
 $ pnpm recursive install
 $ pnpm build
 $ node packages/node-opcua-samples/bin/simple_server

running the demo client from source

 $ git clone https://github.com/node-opcua/node-opcua.git
 $ cd node-opcua
 $ npm install -g pnpm 
 $ pnpm recursive install
 $ pnpm build
 $ node packages/node-opcua-samples/bin/simple_client.js -e "opc.tcp://opcserver.mAutomation.net:4841" -n="ns=1;s=EVR2.system.RTC_SEC"

Tutorials

API reference

Contributing

$ git clone git://github.com/node-opcua/node-opcua.git
$ cd node-opcua
$ npm install -g pnpm 
$ pnpm install
$ pnpm recursive install
$ pnpm build

NPM

Project Stats

Supported Features

Service
Discovery Service Set
FindServers() โœ…
GetEndpoints() โœ…
RegisterServer() โœ…
RegisterServer2() โœ…
FindServersOnNetwork() โœ…
Secure Channel Service Set
OpenSecureChannel() โœ…
CloseSecureChannel() โœ…
Session Service Set
CreateSession() โœ…
CloseSession() โœ…
ActivateSession() โœ…
Cancel()
View Service Set
Browse() โœ…
BrowseNext() โœ…
TranslateBrowsePathsToNodeIds() โœ…
RegisterNodes() โœ…
UnregisterNodes() โœ…
Attribute Service Set
Read() โœ…
Write() โœ…
HistoryRead() ๐ŸŒ’
HistoryUpdate() ๐ŸŒ’
MonitoredItems Service Set
CreateMonitoredItems() โœ…
ModifyMonitoredItems() โœ…
SetMonitoringMode() โœ…
SetTriggering() ๐ŸŒ‘
DeleteMonitoredItems() โœ…
Subscription Service Set
CreateSubscription() โœ…
ModifySubscription() โœ…
DeleteSubscriptions() โœ…
Publish() โœ…
Republish() โœ…
TransferSubscriptions() โœ…
Node Management Service Set
AddNodes() ๐ŸŒ‘
AddReferences() ๐ŸŒ‘
DeleteNodes() ๐ŸŒ‘
DeleteReferences() ๐ŸŒ‘
Query Service Set
QueryFirst() ๐ŸŒ‘
QueryNext() ๐ŸŒ‘
PubSUB as a commercial module โœ…
GDS as a commercial module โœ…
Transport Protocol
Transport Status Comment
UA-TCP UA-SC UA Binary โœ… OPC.TCP - Binary
SOAP-HTTP WS-SC UA Binary ๐ŸŒ‘ HTTP/HTTPS - Binary
SOAP-HTTP WS-SC UA XML ๐ŸŒ‘
SOAP-HTTP WS-SC UA XML-UA Binary ๐ŸŒ‘
Security Policies
Policy Status Comment
None โœ…
Basic128Rsa15 โœ… deprecated in 1.04
Basic256 โœ… deprecated in 1.04
Basic256Sha256 โœ…
Authentication Status Comment
Anonymous โœ…
User Name Password โœ…
X509 Certificate โœ…
client facets
Base Client Behaviour โœ…
AddressSpace Lookup โœ…
Attribute Read โœ…
DataChange Subscription โœ…
DataAccess โœ…
Discovery โœ…
Event Subscription โœ…
Method call โœ…
Historical Access ๐ŸŒ“
Advanced Type โœ…
Programming ๐ŸŒ‘
Auditing ๐ŸŒ“
Redundancy ๐ŸŒ‘ Sponsors wanted
server profiles
Core Server โœ…
Data Access Server โœ…
Embedded Server โœ…
Nano Embedded Device Server โœ…
Micro Embedded Device Server โœ…
Standard DataChange Subscription Server โœ…
Standard Event Subscription Server โœ…
Standard UA Server โœ…
Redundancy Transparent Server ๐ŸŒ‘ Sponsors wanted
Redundancy Visible Server ๐ŸŒ‘ Sponsors wanted
Node Management Server ๐ŸŒ‘ Sponsors wanted
Auditing Server ๐ŸŒ“
Complex Type Server โœ… (sponsored)
Session Diagnostics โœ… (sponsored)
Subscription Diagnostics โœ… (sponsored)
Alarms & Conditions โœ… (sponsored)
Pub & Sub ๐ŸŒ‘ Sponsors wanted

Feedback

  • if you're using node-opcua in one of your project, please feel free to leave a comment and a quick description in the wiki

  • if you have a particular wish or found a issue, let us known and create an issue

About licensing

The node-opcua core module is copyrighted and licencsd under the term of the "The MIT License".

This means that :

  • node-opcua comes without any warranty of any kind.
  • you can freely re-use in an open-source application or a commercial application
  • you have to include the software copyright notice in all copies or substantial portions of the software.

You are strongly encouraged to apply to our NodeOPCUA Membership to get additional benefits and support.

Copyright

Copyright (c) 2022-2024 Sterfive SAS - 833264583 RCS ORLEANS - France (https://www.sterfive.com) Copyright (c) 2014-2022 Etienne Rossignon

node-opcua-pki's People

Contributors

bartag512 avatar bompi88 avatar ceolinrenato avatar danihaag avatar dependabot[bot] avatar erossignon avatar everiaz avatar snyk-bot avatar ss-yogi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

node-opcua-pki's Issues

Client wont work with self signed demo certificates

Hello Etienne,

I've tested with that module to generate server and client certificates and key pairs.
The server works great with that:

image

... but the client wont work, because of an error

image

server_secure_channel_layer :114 xxxxx error SIGN and ENCRYPT asymmetricVerify : Invalid packet signature Error: SIGN and ENCRYPT asymmetricVerify : Invalid packet signature at MessageBuilderBase._report_error (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/message_builder_base.js:217:24) at MessageBuilder._decrypt_OPN (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-secure-channel/src/message_builder.js:185:14) at MessageBuilder._decrypt (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-secure-channel/src/message_builder.js:323:21) at MessageBuilder._read_headers (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-secure-channel/src/message_builder.js:368:19) at MessageBuilderBase._append (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/message_builder_base.js:117:15) at MessageBuilderBase._feed_messageChunk (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/message_builder_base.js:176:14) at PacketAssembler.<anonymous> (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/message_builder_base.js:52:14) at emitOne (events.js:116:13) at PacketAssembler.emit (events.js:211:7) at PacketAssembler.feed (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-packet-assembler/src/packet_assembler.js:105:14) at MessageBuilderBase.feed (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/message_builder_base.js:156:30) at ServerTCP_transport.<anonymous> (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-secure-channel/src/server/server_secure_channel_layer.js:340:37) at emitOne (events.js:116:13) at ServerTCP_transport.emit (events.js:211:7) at ServerTCP_transport._on_message_received (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/tcp_transport.js:193:14) at PacketAssembler.<anonymous> (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/tcp_transport.js:291:30) server_secure_channel_layer :115 xxxxx Server is now closing socket, without further notice server_secure_channel_layer :885 ServerSecureChannelLayer#close tcp_transport :303 SOCKET CLOSE : had_error = false Transport 37 tcp_transport :320 SOCKET END : null CLIENT Transport 36 tcp_transport :255 Transport Connection ended Transport 36 tcp_transport :263 bytesRead = 28 tcp_transport :264 bytesWritten = 1869 tcp_transport :303 SOCKET CLOSE : had_error = false Transport 36 tcp_transport :306 remote address = undefined undefined undefined 21 Feb 19:32:01 - [error] [OPCUA-IIoT-Connector:LOCAL SERVER] Error: _socket has been disconnected by third party at ClientTCP_transport.TCP_transport._on_socket_ended_message (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/tcp_transport.js:257:18) at Socket.<anonymous> (/Users/klaus/Development/github/node-red-contrib-iiot-opcua/node_modules/node-opcua-transport/src/tcp_transport.js:322:14) at emitNone (events.js:111:20) at Socket.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1055:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9) Bytes Read : 384 Bytes Written : 256 time to receive request : 0.003531999999999243 sec time to process request : 0.43678199999999195 sec time to send response : 0.0004840000000112923 sec

Is there some to do for the client with the pki package?
I set the cnf config for the server to my NodeRED-IIoT-Server and the client to NodeRED-IIoT-Client as the application name.

It works well from different path with the certs and keys of the installation process.
(node-opcua-client/certificates/...)

Maybe you have a hint for me, please!

Thank you!
Klaus

Can't load random.rnd into RNG with OpenSSL 1.1.1b 26 Feb 2019

Hello,

after i update OpenSSL to version 1.1.1b the certificates can't be created anymore.
I got this error:

Can't load random.rnd into RNG 1996141840:error:2406F079:random number generator:RAND_load_file:Cannot open file:crypto/rand/randfile.c:98:Filename=random.rnd

The random.rnd files are not created during the certificate creation.
I was able to fix this manually by creating the random.rnd files by myself and then create the certificates after the node installation. Unfortunately the files are deleted when i installed the node again.

Version 1.0.x. works but the support ends in September 2019.

LibreSSL support

OSX seems to be bundled with LibreSSL. An easy fix is to install OpenSSL with brew:

$ brew install openssl
$ echo 'export PATH="/usr/local/opt/libressl/bin:$PATH"' >> ~/.bash_profile

But it would be nice if node-opcua-pki runs on newer OSX out of the box, supporting LibreSSL. Seems like the only thing that stops this from happening is that LibreSSL has dropped support of injecting environment variables. A fix would be generating a config each time it's used by one of the underlaying methods. PR #5 .

How / where to run the command?

Hello,

I'm a bit confused...
I don't get how and where to run the command to generate the Certificate & Private key.
Do I run the command in the command prompt (cmd.exe) or in my nodejs project?

Thanks for your help!

TypeError: Path must be a string. Received undefined

function get_openssl_folder_win32() {

Seems like the case where you have LOCALAPPDATA environment variable declared, and the directory Programs does not exists, the get_openssl_folder_win32 returns undefined. Implementations of get_openssl_folder_win32 should probably be in the lines of:

    function get_openssl_folder_win32() {
        if (process.env.LOCALAPPDATA) {
            var user_program_folder = path.join(process.env.LOCALAPPDATA, "Programs");
            if (fs.existsSync(user_program_folder)) {
                return path.join(user_program_folder, "openssl");
            }
        } 
        return path.join(process.cwd(), "openssl");
    }

Added PR #3

Generate custom certificate

Is it possible to generate a certificate with custom values in the certificate fields? For example, when using openssl, I could give extra options like:

"/C=Country/ST=providence/L=place/O=Organisation/CN=Name"

I couldn't find it in the examples, book and documentation.

Crash when running (v2.8.0)

C:\DNA\PlantViewer\node_modules\node-opcua-pki>node bin\crypto_create_CA.js demo --dev

internal/fs/utils.js:269
    throw err;
    ^

Error: ENOENT: no such file or directory, open 'C:/Users/ADMINI~1/AppData/Local/Temp/2/empty_config.cnf'
    at Object.openSync (fs.js:462:3)
    at Object.writeFileSync (fs.js:1362:35)
    at execute_openssl (C:\DNA\PlantViewer\node_modules\node-opcua-pki\dist\pki\toolbox.js:193:12)
    at C:\DNA\PlantViewer\node_modules\node-opcua-pki\dist\pki\toolbox.js:168:13
    at C:\DNA\PlantViewer\node_modules\node-opcua-pki\dist\pki\toolbox.js:65:9
    at C:\DNA\PlantViewer\node_modules\node-opcua-pki\dist\misc\install_prerequisite.js:349:13
    at C:\DNA\PlantViewer\node_modules\node-opcua-pki\dist\misc\install_prerequisite.js:319:20
    at C:\DNA\PlantViewer\node_modules\node-opcua-pki\dist\misc\install_prerequisite.js:173:21
    at C:\DNA\PlantViewer\node_modules\node-opcua-pki\dist\misc\install_prerequisite.js:69:9
    at ChildProcess.exithandler (child_process.js:294:7) {
  errno: -4058,
  syscall: 'open',
  code: 'ENOENT',
  path: 'C:/Users/ADMINI~1/AppData/Local/Temp/2/empty_config.cnf'
}

C:\DNA\PlantViewer\node_modules\node-opcua-pki>

pki subfolder "issuers" instead of "issuer"

The OPC UA specification shows following directory layout for the issuer certificates:

/issuer The Certificate store which contains the CA Certificates needed for validation.
/issuer/certs Contains the X.509 v3 Certificates which are needed for validation.
/issuer/crl Contains the X.509 v3 CRLs for any Certificates in the ./certs directory.

But the modules uses "issuers" (additional s) in certificate_manager.ts.

yargs regression

node-opcua-pki cli is currently broke

node-opcua-pki cli should be updated to the new yargs API,

Flashing command prompts on windows

Related: node-opcua/node-opcua#1043

Is your feature request related to a problem? Please describe.

When starting a nodejs process with pm2 using node-opcua on Windows 10 a Windows Prompt windows pops ups each time when "node-opcua-pki" package runs child_process.exec() method. The exec process is calling openssl.
There are two occurances: lib/misc/install_prerequisite.ts:98 and lib/pki/toolbox.js:123

Describe the solution you'd like

I would like to make disappear the flashing popups each time the application starts.
This could be achieved by using options windowsHide: true in exec method
Source nodejs docs

Additional context

I was able to stop the popups with editing the two js files in dist folder.
install_prerequisite.js
image
toolbox.js
image

node-opcua version: node-opcua@^2.47.0
node version: v14.17.0
Operating System: win32 10.0.19042

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.