node-opcua-server 2.166.0 → 2.167.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base_server.js +1 -3
- package/dist/base_server.js.map +1 -1
- package/dist/opcua_server.js +3 -3
- package/dist/opcua_server.js.map +1 -1
- package/dist/register_server_manager.d.ts +8 -8
- package/dist/register_server_manager.js +40 -40
- package/dist/register_server_manager.js.map +1 -1
- package/dist/server_end_point.d.ts +2 -2
- package/dist/server_end_point.js +5 -12
- package/dist/server_end_point.js.map +1 -1
- package/package.json +42 -41
- package/source/base_server.ts +2 -4
- package/source/opcua_server.ts +18 -11
- package/source/register_server_manager.ts +75 -72
- package/source/server_end_point.ts +16 -23
|
@@ -10,7 +10,7 @@ import chalk from "chalk";
|
|
|
10
10
|
|
|
11
11
|
import { assert } from "node-opcua-assert";
|
|
12
12
|
import type { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
13
|
-
import { type Certificate, makeSHA1Thumbprint, type PrivateKey, split_der } from "node-opcua-crypto/web";
|
|
13
|
+
import { type Certificate, combine_der, makeSHA1Thumbprint, type PrivateKey, split_der } from "node-opcua-crypto/web";
|
|
14
14
|
import { checkDebugFlag, make_debugLog, make_errorLog, make_warningLog } from "node-opcua-debug";
|
|
15
15
|
import { getFullyQualifiedDomainName, resolveFullyQualifiedDomainName } from "node-opcua-hostname";
|
|
16
16
|
import {
|
|
@@ -69,9 +69,8 @@ function extractChannelData(channel: ServerSecureChannelLayer): IChannelData {
|
|
|
69
69
|
|
|
70
70
|
function dumpChannelInfo(channels: ServerSecureChannelLayer[]): void {
|
|
71
71
|
function d(s: IServerSessionBase) {
|
|
72
|
-
return `[ status=${s.status} lastSeen=${s.clientLastContactTime.toFixed(0)}ms sessionName=${s.sessionName} timeout=${
|
|
73
|
-
|
|
74
|
-
} ]`;
|
|
72
|
+
return `[ status=${s.status} lastSeen=${s.clientLastContactTime.toFixed(0)}ms sessionName=${s.sessionName} timeout=${s.sessionTimeout
|
|
73
|
+
} ]`;
|
|
75
74
|
}
|
|
76
75
|
function dumpChannel(channel: ServerSecureChannelLayer): void {
|
|
77
76
|
console.log("------------------------------------------------------");
|
|
@@ -98,7 +97,8 @@ function dumpChannelInfo(channels: ServerSecureChannelLayer[]): void {
|
|
|
98
97
|
console.log("------------------------------------------------------");
|
|
99
98
|
}
|
|
100
99
|
|
|
101
|
-
const
|
|
100
|
+
const emptyCertificateChain: Certificate[] = [];
|
|
101
|
+
|
|
102
102
|
// biome-ignore lint/suspicious/noExplicitAny: deliberate null→PrivateKey sentinel
|
|
103
103
|
const emptyPrivateKey = null as any as PrivateKey;
|
|
104
104
|
|
|
@@ -116,7 +116,7 @@ export interface OPCUAServerEndPointOptions {
|
|
|
116
116
|
/**
|
|
117
117
|
* the DER certificate chain
|
|
118
118
|
*/
|
|
119
|
-
certificateChain: Certificate;
|
|
119
|
+
certificateChain: Certificate[];
|
|
120
120
|
|
|
121
121
|
/**
|
|
122
122
|
* privateKey
|
|
@@ -333,7 +333,7 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
333
333
|
public _on_connectionRefused?: (socketData: ISocketData) => void;
|
|
334
334
|
public _on_openSecureChannelFailure?: (socketData: ISocketData, channelData: IChannelData) => void;
|
|
335
335
|
|
|
336
|
-
private _certificateChain: Certificate;
|
|
336
|
+
private _certificateChain: Certificate[];
|
|
337
337
|
private _privateKey: PrivateKey;
|
|
338
338
|
private _channels: { [key: string]: ServerSecureChannelLayer };
|
|
339
339
|
private _server?: Server;
|
|
@@ -390,7 +390,7 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
390
390
|
}
|
|
391
391
|
|
|
392
392
|
public dispose(): void {
|
|
393
|
-
this._certificateChain =
|
|
393
|
+
this._certificateChain = emptyCertificateChain;
|
|
394
394
|
this._privateKey = emptyPrivateKey;
|
|
395
395
|
|
|
396
396
|
assert(Object.keys(this._channels).length === 0, "OPCUAServerEndPoint channels must have been deleted");
|
|
@@ -417,7 +417,7 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
417
417
|
" l = " +
|
|
418
418
|
this._endpoints.length +
|
|
419
419
|
" " +
|
|
420
|
-
makeSHA1Thumbprint(this.
|
|
420
|
+
makeSHA1Thumbprint(this.getCertificate()).toString("hex");
|
|
421
421
|
return txt;
|
|
422
422
|
}
|
|
423
423
|
|
|
@@ -429,13 +429,13 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
429
429
|
* Returns the X509 DER form of the server certificate
|
|
430
430
|
*/
|
|
431
431
|
public getCertificate(): Certificate {
|
|
432
|
-
return
|
|
432
|
+
return this.getCertificateChain()[0];
|
|
433
433
|
}
|
|
434
434
|
|
|
435
435
|
/**
|
|
436
436
|
* Returns the X509 DER form of the server certificate
|
|
437
437
|
*/
|
|
438
|
-
public getCertificateChain(): Certificate {
|
|
438
|
+
public getCertificateChain(): Certificate[] {
|
|
439
439
|
return this._certificateChain;
|
|
440
440
|
}
|
|
441
441
|
|
|
@@ -687,7 +687,7 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
687
687
|
|
|
688
688
|
this._server.listen(
|
|
689
689
|
listenOptions,
|
|
690
|
-
/*"::",*/
|
|
690
|
+
/*"::",*/(err?: Error) => {
|
|
691
691
|
// 'listening' listener
|
|
692
692
|
debugLog(chalk.green.bold("LISTENING TO PORT "), this.port, "err ", err);
|
|
693
693
|
assert(!err, " cannot listen to port ");
|
|
@@ -877,7 +877,7 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
877
877
|
debugLog(
|
|
878
878
|
chalk.bgWhite.cyan(
|
|
879
879
|
"OPCUAServerEndPoint#_on_client_connection " +
|
|
880
|
-
|
|
880
|
+
"SERVER END POINT IS PROBABLY SHUTTING DOWN !!! - Connection is refused"
|
|
881
881
|
)
|
|
882
882
|
);
|
|
883
883
|
socket.end();
|
|
@@ -887,7 +887,7 @@ export class OPCUAServerEndPoint extends EventEmitter implements ServerSecureCha
|
|
|
887
887
|
console.log(
|
|
888
888
|
chalk.bgWhite.cyan(
|
|
889
889
|
"OPCUAServerEndPoint#_on_client_connection " +
|
|
890
|
-
|
|
890
|
+
"The maximum number of connection has been reached - Connection is refused"
|
|
891
891
|
)
|
|
892
892
|
);
|
|
893
893
|
const reason = `maxConnections reached (${this.maxConnections})`;
|
|
@@ -1130,7 +1130,7 @@ interface MakeEndpointDescriptionOptions {
|
|
|
1130
1130
|
*/
|
|
1131
1131
|
hostname: string;
|
|
1132
1132
|
|
|
1133
|
-
serverCertificateChain: Certificate;
|
|
1133
|
+
serverCertificateChain: Certificate[];
|
|
1134
1134
|
/**
|
|
1135
1135
|
*
|
|
1136
1136
|
*/
|
|
@@ -1224,13 +1224,6 @@ function estimateSecurityLevel(securityMode: MessageSecurityMode, securityPolicy
|
|
|
1224
1224
|
* @private
|
|
1225
1225
|
*/
|
|
1226
1226
|
function _makeEndpointDescription(options: MakeEndpointDescriptionOptions, parent: OPCUAServerEndPoint): EndpointDescriptionEx {
|
|
1227
|
-
assert(Object.prototype.hasOwnProperty.call(options, "serverCertificateChain"));
|
|
1228
|
-
assert(!Object.prototype.hasOwnProperty.call(options, "serverCertificate"));
|
|
1229
|
-
assert(!!options.securityMode); // s.MessageSecurityMode
|
|
1230
|
-
assert(!!options.securityPolicy);
|
|
1231
|
-
assert(options.server !== null && typeof options.server === "object");
|
|
1232
|
-
assert(!!options.hostname && typeof options.hostname === "string");
|
|
1233
|
-
assert(typeof options.restricted === "boolean");
|
|
1234
1227
|
|
|
1235
1228
|
const u = (n: string) => getUniqueName(n, options.collection);
|
|
1236
1229
|
options.securityLevel =
|
|
@@ -1353,7 +1346,7 @@ function _makeEndpointDescription(options: MakeEndpointDescriptionOptions, paren
|
|
|
1353
1346
|
endpointUrl: "<to be evaluated at run time>", // options.endpointUrl,
|
|
1354
1347
|
|
|
1355
1348
|
server: undefined, // options.server,
|
|
1356
|
-
serverCertificate: options.serverCertificateChain,
|
|
1349
|
+
serverCertificate: options.serverCertificateChain.length > 0 ? combine_der(options.serverCertificateChain) : undefined,
|
|
1357
1350
|
|
|
1358
1351
|
securityMode: options.securityMode,
|
|
1359
1352
|
securityPolicyUri,
|