node-opcua-server-configuration 2.56.2 → 2.59.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/LICENSE +20 -20
- package/README.md +12 -12
- package/dist/server/promote_trust_list.js +6 -4
- package/dist/server/promote_trust_list.js.map +1 -1
- package/package.json +16 -16
- package/source/server/promote_trust_list.ts +71 -78
- package/dist/push_certificate_manager_helpers.d.ts +0 -6
- package/dist/push_certificate_manager_helpers.js +0 -221
- package/dist/push_certificate_manager_helpers.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2014-2021 Etienne Rossignon
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
-
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
-
the Software without restriction, including without limitation the rights to
|
|
8
|
-
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
-
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
-
subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
-
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
-
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
-
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
-
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2014-2021 Etienne Rossignon
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
7
|
+
the Software without restriction, including without limitation the rights to
|
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
10
|
+
subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
node-opcua-server-configuration
|
|
2
|
-
===============================
|
|
3
|
-
|
|
4
|
-
an implementation of a OPC UA stack fully written in javascript and nodejs
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
see http://node-opcua.github.io/
|
|
8
|
-
|
|
9
|
-
an implementation of ServerConfiguration object inside node-opcua servers
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
node-opcua-server-configuration
|
|
2
|
+
===============================
|
|
3
|
+
|
|
4
|
+
an implementation of a OPC UA stack fully written in javascript and nodejs
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
see http://node-opcua.github.io/
|
|
8
|
+
|
|
9
|
+
an implementation of ServerConfiguration object inside node-opcua servers
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
@@ -20,8 +20,8 @@ const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
|
20
20
|
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
21
21
|
const node_opcua_data_model_1 = require("node-opcua-data-model");
|
|
22
22
|
const node_opcua_file_transfer_1 = require("node-opcua-file-transfer");
|
|
23
|
-
const trust_list_server_1 = require("./trust_list_server");
|
|
24
23
|
const node_opcua_crypto_1 = require("node-opcua-crypto");
|
|
24
|
+
const trust_list_server_1 = require("./trust_list_server");
|
|
25
25
|
const tools_1 = require("./tools");
|
|
26
26
|
const roles_and_permissions_1 = require("./roles_and_permissions");
|
|
27
27
|
const debugLog = (0, node_opcua_debug_1.make_debugLog)("ServerConfiguration");
|
|
@@ -62,7 +62,7 @@ function _addCertificate(inputArguments, context) {
|
|
|
62
62
|
const certificateChain = inputArguments[0].value;
|
|
63
63
|
const isTrustedCertificate = inputArguments[1].value;
|
|
64
64
|
const certificates = (0, node_opcua_crypto_1.split_der)(certificateChain);
|
|
65
|
-
// validate certificate first
|
|
65
|
+
// validate certificate first
|
|
66
66
|
const r = yield (0, node_opcua_crypto_1.verifyCertificateChain)(certificates);
|
|
67
67
|
if (r.status !== "Good") {
|
|
68
68
|
warningLog("Invalid certificate ", r.status, r.reason);
|
|
@@ -122,10 +122,12 @@ function promoteTrustList(trustList) {
|
|
|
122
122
|
// possible statusCode: Bad_UserAccessDenied The current user does not have the rights required.
|
|
123
123
|
const certificateManager = trustList.$$certificateManager || undefined;
|
|
124
124
|
if (certificateManager) {
|
|
125
|
-
(0, trust_list_server_1.writeTrustList)(memfs_1.fs, filename, trustMask, certificateManager)
|
|
125
|
+
(0, trust_list_server_1.writeTrustList)(memfs_1.fs, filename, trustMask, certificateManager)
|
|
126
|
+
.then(() => {
|
|
126
127
|
// trustList.isOpened = true;
|
|
127
128
|
_open_asyncExecutionFunction.call(this, inputArgs, context, callback);
|
|
128
|
-
})
|
|
129
|
+
})
|
|
130
|
+
.catch((err) => {
|
|
129
131
|
errorLog(err);
|
|
130
132
|
callback(err, { statusCode: node_opcua_status_code_1.StatusCodes.BadInternalError });
|
|
131
133
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promote_trust_list.js","sourceRoot":"","sources":["../../source/server/promote_trust_list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"promote_trust_list.js","sourceRoot":"","sources":["../../source/server/promote_trust_list.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,+BAAmC;AACnC,iCAAoC;AAapC,uDAAkF;AAClF,mEAAgE;AAEhE,2DAAuD;AACvD,iEAA+D;AAE/D,uEAAqF;AAErF,yDAAsE;AAEtE,2DAAqE;AAErE,mCAAqE;AACrE,mEAAkE;AAElE,MAAM,QAAQ,GAAG,IAAA,gCAAa,EAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,IAAA,iCAAc,EAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,UAAU,GAAG,IAAA,kCAAe,EAAC,qBAAqB,CAAC,CAAC;AAC1D,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAE1B,SAAS,wBAAwB,CAAC,SAAsB;IACpD,OAAO,KAAK,CAAC,CAAC,WAAW;AAC7B,CAAC;AAED,SAAe,eAAe,CAE1B,cAAyB,EACzB,OAAwB;;QAExB,OAAO,EAAE,UAAU,EAAE,oCAAW,CAAC,IAAI,EAAE,CAAC;IAC5C,CAAC;CAAA;AAED,eAAe;AACf,SAAe,eAAe,CAE1B,cAAyB,EACzB,OAAwB;;QAExB,gFAAgF;QAChF,yFAAyF;QACzF,kFAAkF;QAClF,4FAA4F;QAC5F,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AAC,eAAe,CAAQ,CAAC;YACrE,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,OAAO,EAAE,EAAE;gBAChD,OAAO;aACV;YACD,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;YACzD,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,IAAA,kBAAW,EAAC,eAAe,CAAC,CAAC,CAAC;YACjE,QAAQ,CAAC,iBAAiB,CAAC,UAAU,CAAC,IAAA,kBAAW,EAAC,kBAAkB,CAAC,CAAC,CAAC;YACvE,QAAQ,CAAC,aAAa,IAAI,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC;YACnF,QAAQ,CAAC,cAAc,IAAI,QAAQ,CAAC,cAAc,CAAC,UAAU,CAAC,IAAA,kBAAW,EAAC,eAAe,CAAC,CAAC,CAAC;QAChG,CAAC;QACD,sCAAsC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;IACnE,CAAC;CAAA;AA/FD,4CA+FC;AAED,SAAgB,mCAAmC,CAAC,SAAgC;IAChF,KAAK,MAAM,CAAC,IAAI,SAAS,CAAC,aAAa,EAAE,EAAE;QACvC,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,kBAAkB,CAAC,+CAAuB,CAAC,CAAC;QAC/C,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,qBAAqB,CAAC,8CAAsB,CAAC,eAAe,GAAG,8CAAsB,CAAC,kBAAkB,CAAC,CAAC;KAChH;AACL,CAAC;AALD,kFAKC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-opcua-server-configuration",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.59.0",
|
|
4
4
|
"description": "pure nodejs OPCUA SDK - module -server",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "tsc -b",
|
|
@@ -12,32 +12,32 @@
|
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"dependencies": {
|
|
14
14
|
"memfs": "^3.3.0",
|
|
15
|
-
"node-opcua-address-space": "2.
|
|
15
|
+
"node-opcua-address-space": "2.59.0",
|
|
16
16
|
"node-opcua-assert": "2.55.0",
|
|
17
|
-
"node-opcua-basic-types": "2.
|
|
18
|
-
"node-opcua-certificate-manager": "2.
|
|
19
|
-
"node-opcua-client": "2.
|
|
17
|
+
"node-opcua-basic-types": "2.57.0",
|
|
18
|
+
"node-opcua-certificate-manager": "2.57.0",
|
|
19
|
+
"node-opcua-client": "2.59.0",
|
|
20
20
|
"node-opcua-constants": "2.52.0",
|
|
21
21
|
"node-opcua-crypto": "^1.7.4",
|
|
22
|
-
"node-opcua-data-model": "2.
|
|
22
|
+
"node-opcua-data-model": "2.57.0",
|
|
23
23
|
"node-opcua-debug": "2.55.0",
|
|
24
|
-
"node-opcua-file-transfer": "2.
|
|
24
|
+
"node-opcua-file-transfer": "2.59.0",
|
|
25
25
|
"node-opcua-hostname": "2.55.0",
|
|
26
26
|
"node-opcua-nodeid": "2.55.0",
|
|
27
|
-
"node-opcua-nodesets": "2.
|
|
27
|
+
"node-opcua-nodesets": "2.57.0",
|
|
28
28
|
"node-opcua-pki": "^2.12.0",
|
|
29
|
-
"node-opcua-pseudo-session": "2.
|
|
30
|
-
"node-opcua-secure-channel": "2.
|
|
31
|
-
"node-opcua-server": "2.
|
|
32
|
-
"node-opcua-service-translate-browse-path": "2.
|
|
29
|
+
"node-opcua-pseudo-session": "2.59.0",
|
|
30
|
+
"node-opcua-secure-channel": "2.59.0",
|
|
31
|
+
"node-opcua-server": "2.59.0",
|
|
32
|
+
"node-opcua-service-translate-browse-path": "2.59.0",
|
|
33
33
|
"node-opcua-status-code": "2.56.0",
|
|
34
|
-
"node-opcua-types": "2.
|
|
35
|
-
"node-opcua-variant": "2.
|
|
34
|
+
"node-opcua-types": "2.59.0",
|
|
35
|
+
"node-opcua-variant": "2.59.0",
|
|
36
36
|
"rimraf": "^3.0.2"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"node-opcua-binary-stream": "2.55.0",
|
|
40
|
-
"node-opcua-data-value": "2.
|
|
40
|
+
"node-opcua-data-value": "2.59.0",
|
|
41
41
|
"node-opcua-leak-detector": "2.56.0",
|
|
42
42
|
"should": "^13.2.3",
|
|
43
43
|
"sinon": "^11.1.2"
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"internet of things"
|
|
58
58
|
],
|
|
59
59
|
"homepage": "http://node-opcua.github.io/",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "ea10265745d3d4b8af249a4e13288ad71232706f"
|
|
61
61
|
}
|
|
@@ -2,54 +2,44 @@
|
|
|
2
2
|
* @module node-opcua-server-configuration
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from "node-opcua-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
} from "node-opcua-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
32
|
-
|
|
33
|
-
import {
|
|
34
|
-
TrustListMasks,
|
|
35
|
-
writeTrustList
|
|
36
|
-
} from "./trust_list_server";
|
|
37
|
-
import { split_der, verifyCertificateChain } from "node-opcua-crypto";
|
|
5
|
+
import { callbackify } from "util";
|
|
6
|
+
import { fs as MemFs } from "memfs";
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
AddressSpace,
|
|
10
|
+
MethodFunctor,
|
|
11
|
+
SessionContext,
|
|
12
|
+
UAMethod,
|
|
13
|
+
UATrustList,
|
|
14
|
+
UAObject,
|
|
15
|
+
UAVariable,
|
|
16
|
+
ISessionContext,
|
|
17
|
+
IAddressSpace
|
|
18
|
+
} from "node-opcua-address-space";
|
|
19
|
+
import { checkDebugFlag, make_debugLog, make_warningLog } from "node-opcua-debug";
|
|
20
|
+
import { CallbackT, StatusCodes } from "node-opcua-status-code";
|
|
21
|
+
import { CallMethodResultOptions } from "node-opcua-types";
|
|
22
|
+
import { DataType, Variant } from "node-opcua-variant";
|
|
23
|
+
import { AccessRestrictionsFlag } from "node-opcua-data-model";
|
|
24
|
+
import { CertificateManager } from "node-opcua-pki";
|
|
25
|
+
import { AbstractFs, installFileType, OpenFileMode } from "node-opcua-file-transfer";
|
|
26
|
+
import { OPCUACertificateManager } from "node-opcua-certificate-manager";
|
|
27
|
+
import { split_der, verifyCertificateChain } from "node-opcua-crypto";
|
|
28
|
+
|
|
29
|
+
import { TrustListMasks, writeTrustList } from "./trust_list_server";
|
|
30
|
+
|
|
38
31
|
import { hasEncryptedChannel, hasExpectedUserAccess } from "./tools";
|
|
39
32
|
import { rolePermissionAdminOnly } from "./roles_and_permissions";
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
33
|
+
|
|
34
|
+
const debugLog = make_debugLog("ServerConfiguration");
|
|
35
|
+
const doDebug = checkDebugFlag("ServerConfiguration");
|
|
36
|
+
const warningLog = make_warningLog("ServerConfiguration");
|
|
37
|
+
const errorLog = debugLog;
|
|
38
|
+
|
|
47
39
|
function trustListIsAlreadyOpened(trustList: UATrustList): boolean {
|
|
48
40
|
return false; // to do...
|
|
49
41
|
}
|
|
50
42
|
|
|
51
|
-
|
|
52
|
-
|
|
53
43
|
async function _closeAndUpdate(
|
|
54
44
|
this: UAMethod,
|
|
55
45
|
inputArguments: Variant[],
|
|
@@ -58,14 +48,12 @@ async function _closeAndUpdate(
|
|
|
58
48
|
return { statusCode: StatusCodes.Good };
|
|
59
49
|
}
|
|
60
50
|
|
|
61
|
-
|
|
62
51
|
// in TrustList
|
|
63
52
|
async function _addCertificate(
|
|
64
53
|
this: UAMethod,
|
|
65
54
|
inputArguments: Variant[],
|
|
66
55
|
context: ISessionContext
|
|
67
56
|
): Promise<CallMethodResultOptions> {
|
|
68
|
-
|
|
69
57
|
// If the Certificate is issued by a CA then the Client shall provide the entire
|
|
70
58
|
// chain in the certificate argument (see OPC 10000-6). After validating the Certificate,
|
|
71
59
|
// the Server shall add the CA Certificates to the Issuers list in the Trust List.
|
|
@@ -76,9 +64,9 @@ async function _addCertificate(
|
|
|
76
64
|
if (!hasExpectedUserAccess(context)) {
|
|
77
65
|
return { statusCode: StatusCodes.BadUserAccessDenied };
|
|
78
66
|
}
|
|
79
|
-
|
|
67
|
+
|
|
80
68
|
const trustList = context.object as UATrustList;
|
|
81
|
-
const cm = (trustList as any).$$certificateManager as CertificateManager || null;
|
|
69
|
+
const cm = ((trustList as any).$$certificateManager as CertificateManager) || null;
|
|
82
70
|
|
|
83
71
|
// The trust list must have been bound
|
|
84
72
|
if (!cm) {
|
|
@@ -94,13 +82,13 @@ async function _addCertificate(
|
|
|
94
82
|
|
|
95
83
|
const certificates = split_der(certificateChain);
|
|
96
84
|
|
|
97
|
-
// validate certificate first
|
|
85
|
+
// validate certificate first
|
|
98
86
|
const r = await verifyCertificateChain(certificates);
|
|
99
|
-
if (r.status !== "Good"){
|
|
87
|
+
if (r.status !== "Good") {
|
|
100
88
|
warningLog("Invalid certificate ", r.status, r.reason);
|
|
101
89
|
return { statusCode: StatusCodes.BadCertificateInvalid };
|
|
102
90
|
}
|
|
103
|
-
|
|
91
|
+
|
|
104
92
|
for (let i = 0; i < certificates.length; i++) {
|
|
105
93
|
const certificate = certificates[i];
|
|
106
94
|
if (i === certificates.length - 1 && isTrustedCertificate) {
|
|
@@ -111,14 +99,12 @@ async function _addCertificate(
|
|
|
111
99
|
}
|
|
112
100
|
debugLog("_addCertificate - done isTrustedCertificate= ", isTrustedCertificate);
|
|
113
101
|
return { statusCode: StatusCodes.Good };
|
|
114
|
-
|
|
115
102
|
}
|
|
116
103
|
async function _removeCertificate(
|
|
117
104
|
this: UAMethod,
|
|
118
105
|
inputArguments: Variant[],
|
|
119
106
|
context: ISessionContext
|
|
120
107
|
): Promise<CallMethodResultOptions> {
|
|
121
|
-
|
|
122
108
|
if (!hasEncryptedChannel(context)) {
|
|
123
109
|
return { statusCode: StatusCodes.BadSecurityModeInsufficient };
|
|
124
110
|
}
|
|
@@ -130,13 +116,9 @@ async function _removeCertificate(
|
|
|
130
116
|
return { statusCode: StatusCodes.Good };
|
|
131
117
|
}
|
|
132
118
|
|
|
133
|
-
|
|
134
119
|
let counter = 0;
|
|
135
120
|
|
|
136
|
-
|
|
137
121
|
export async function promoteTrustList(trustList: UATrustList) {
|
|
138
|
-
|
|
139
|
-
|
|
140
122
|
const filename = `/tmpFile${counter}`;
|
|
141
123
|
counter += 1;
|
|
142
124
|
|
|
@@ -152,11 +134,15 @@ export async function promoteTrustList(trustList: UATrustList) {
|
|
|
152
134
|
const addCertificate = trustList.getChildByName("AddCertificate") as UAMethod;
|
|
153
135
|
const removeCertificate = trustList.getChildByName("RemoveCertificate") as UAMethod;
|
|
154
136
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
137
|
+
function _openTrustList(
|
|
138
|
+
this: any,
|
|
139
|
+
trustMask: TrustListMasks,
|
|
140
|
+
inputArgs: Variant[],
|
|
141
|
+
context: ISessionContext,
|
|
142
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
143
|
+
) {
|
|
158
144
|
if (trustListIsAlreadyOpened(trustList)) {
|
|
159
|
-
return callback(null, { statusCode: StatusCodes.BadInvalidState })
|
|
145
|
+
return callback(null, { statusCode: StatusCodes.BadInvalidState });
|
|
160
146
|
}
|
|
161
147
|
// if (trustList.isOpened) {
|
|
162
148
|
// warningLog("TrustList is already opened")
|
|
@@ -166,45 +152,55 @@ export async function promoteTrustList(trustList: UATrustList) {
|
|
|
166
152
|
// The Open Method shall not support modes other than Read (0x01) and the Write + EraseExisting (0x06).
|
|
167
153
|
const openMask = inputArgs[0].value as number;
|
|
168
154
|
if (openMask !== OpenFileMode.Read && openMask !== OpenFileMode.WriteEraseExisting) {
|
|
169
|
-
return callback(null, { statusCode: StatusCodes.BadInvalidArgument })
|
|
155
|
+
return callback(null, { statusCode: StatusCodes.BadInvalidArgument });
|
|
170
156
|
}
|
|
171
157
|
// possible statusCode: Bad_UserAccessDenied The current user does not have the rights required.
|
|
172
|
-
const certificateManager = (trustList as any).$$certificateManager as OPCUACertificateManager || undefined;
|
|
158
|
+
const certificateManager = ((trustList as any).$$certificateManager as OPCUACertificateManager) || undefined;
|
|
173
159
|
if (certificateManager) {
|
|
174
|
-
writeTrustList(MemFs as AbstractFs, filename, trustMask, certificateManager)
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
160
|
+
writeTrustList(MemFs as AbstractFs, filename, trustMask, certificateManager)
|
|
161
|
+
.then(() => {
|
|
162
|
+
// trustList.isOpened = true;
|
|
163
|
+
|
|
164
|
+
_open_asyncExecutionFunction.call(this, inputArgs, context, callback);
|
|
165
|
+
})
|
|
166
|
+
.catch((err) => {
|
|
167
|
+
errorLog(err);
|
|
168
|
+
callback(err, { statusCode: StatusCodes.BadInternalError });
|
|
169
|
+
});
|
|
183
170
|
} else {
|
|
184
|
-
warningLog("certificateManager is not defined on trustlist do something to update the document before we open it")
|
|
171
|
+
warningLog("certificateManager is not defined on trustlist do something to update the document before we open it");
|
|
185
172
|
return _open_asyncExecutionFunction.call(this, inputArgs, context, callback);
|
|
186
173
|
}
|
|
187
174
|
}
|
|
188
175
|
|
|
189
|
-
function _openCallback(
|
|
176
|
+
function _openCallback(
|
|
177
|
+
this: any,
|
|
178
|
+
inputArgs: Variant[],
|
|
179
|
+
context: ISessionContext,
|
|
180
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
181
|
+
) {
|
|
190
182
|
_openTrustList.call(this, TrustListMasks.All, inputArgs, context, callback);
|
|
191
183
|
}
|
|
192
184
|
|
|
193
185
|
open.bindMethod(_openCallback);
|
|
194
186
|
|
|
195
|
-
function _openWithMaskCallback(
|
|
187
|
+
function _openWithMaskCallback(
|
|
188
|
+
this: any,
|
|
189
|
+
inputArgs: Variant[],
|
|
190
|
+
context: ISessionContext,
|
|
191
|
+
callback: CallbackT<CallMethodResultOptions>
|
|
192
|
+
) {
|
|
196
193
|
const trustListMask = inputArgs[0].value as number;
|
|
197
194
|
inputArgs[0] = new Variant({ dataType: DataType.Byte, value: OpenFileMode.Read });
|
|
198
195
|
_openTrustList.call(this, trustListMask, inputArgs, context, callback);
|
|
199
196
|
}
|
|
200
197
|
// The OpenWithMasks Method allows a Client to read only the portion of the Trust List.
|
|
201
198
|
// This Method can only be used to read the Trust List.
|
|
202
|
-
openWithMasks.bindMethod(_openWithMaskCallback)
|
|
199
|
+
openWithMasks.bindMethod(_openWithMaskCallback);
|
|
203
200
|
addCertificate.bindMethod(callbackify(_addCertificate));
|
|
204
201
|
removeCertificate.bindMethod(callbackify(_removeCertificate));
|
|
205
202
|
closeAndUpdate?.bindMethod(callbackify(_closeAndUpdate));
|
|
206
203
|
|
|
207
|
-
|
|
208
204
|
function install_method_handle_on_TrustListType(addressSpace: IAddressSpace): void {
|
|
209
205
|
const fileType = addressSpace.findObjectType("TrustListType") as any;
|
|
210
206
|
if (!fileType || fileType.addCertificate.isBound()) {
|
|
@@ -217,11 +213,8 @@ export async function promoteTrustList(trustList: UATrustList) {
|
|
|
217
213
|
fileType.closeAndUpdate && fileType.closeAndUpdate.bindMethod(callbackify(_closeAndUpdate));
|
|
218
214
|
}
|
|
219
215
|
install_method_handle_on_TrustListType(trustList.addressSpace);
|
|
220
|
-
|
|
221
216
|
}
|
|
222
217
|
|
|
223
|
-
|
|
224
|
-
|
|
225
218
|
export function installAccessRestrictionOnTrustList(trustList: UAVariable | UAObject) {
|
|
226
219
|
for (const m of trustList.getComponents()) {
|
|
227
220
|
m?.setRolePermissions(rolePermissionAdminOnly);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module node-opcua-server-configuration
|
|
3
|
-
*/
|
|
4
|
-
import { AddressSpace } from "node-opcua-address-space";
|
|
5
|
-
import { PushCertificateManagerServerOptions } from "./server/push_certificate_manager_server_impl";
|
|
6
|
-
export declare function installPushCertificateManagement(addressSpace: AddressSpace, options: PushCertificateManagerServerOptions): void;
|
|
@@ -1,221 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module node-opcua-server-configuration
|
|
4
|
-
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.installPushCertificateManagement = void 0;
|
|
16
|
-
const util_1 = require("util");
|
|
17
|
-
const node_opcua_debug_1 = require("node-opcua-debug");
|
|
18
|
-
const node_opcua_status_code_1 = require("node-opcua-status-code");
|
|
19
|
-
const node_opcua_variant_1 = require("node-opcua-variant");
|
|
20
|
-
const install_CertificateAlarm_1 = require("./server/install_CertificateAlarm");
|
|
21
|
-
const push_certificate_manager_server_impl_1 = require("./server/push_certificate_manager_server_impl");
|
|
22
|
-
const debugLog = node_opcua_debug_1.make_debugLog("ServerConfiguration");
|
|
23
|
-
const doDebug = node_opcua_debug_1.checkDebugFlag("ServerConfiguration");
|
|
24
|
-
const errorLog = debugLog;
|
|
25
|
-
function hasExpectedUserAccess(context) {
|
|
26
|
-
if (!context ||
|
|
27
|
-
!context.session ||
|
|
28
|
-
!context.session.userIdentityToken) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
const currentUserRole = context.getCurrentUserRole();
|
|
32
|
-
return !!currentUserRole.match("SecurityAdmin");
|
|
33
|
-
}
|
|
34
|
-
function hasEncryptedChannel(context) {
|
|
35
|
-
// todo
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
function expected(variant, dataType, variantArrayType) {
|
|
39
|
-
if (!variant) {
|
|
40
|
-
return false;
|
|
41
|
-
}
|
|
42
|
-
if (variant.dataType !== dataType) {
|
|
43
|
-
return false;
|
|
44
|
-
}
|
|
45
|
-
if (variant.arrayType !== variantArrayType) {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
50
|
-
function getPushCertificateManager(method) {
|
|
51
|
-
const serverConfiguration = method.addressSpace.rootFolder.objects.server.serverConfiguration;
|
|
52
|
-
const serverConfigurationPriv = serverConfiguration;
|
|
53
|
-
if (serverConfigurationPriv.$pushCertificateManager) {
|
|
54
|
-
return serverConfigurationPriv.$pushCertificateManager;
|
|
55
|
-
}
|
|
56
|
-
// throw new Error("Cannot find pushCertificateManager object");
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
function _createSigningRequest(inputArguments, context) {
|
|
60
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
-
const certificateGroupIdVariant = inputArguments[0];
|
|
62
|
-
const certificateTypeIdVariant = inputArguments[1];
|
|
63
|
-
const subjectNameVariant = inputArguments[2];
|
|
64
|
-
const regeneratePrivateKeyVariant = inputArguments[3];
|
|
65
|
-
const nonceVariant = inputArguments[4];
|
|
66
|
-
if (!expected(certificateGroupIdVariant, node_opcua_variant_1.DataType.NodeId, node_opcua_variant_1.VariantArrayType.Scalar)) {
|
|
67
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
68
|
-
}
|
|
69
|
-
if (!expected(certificateTypeIdVariant, node_opcua_variant_1.DataType.NodeId, node_opcua_variant_1.VariantArrayType.Scalar)) {
|
|
70
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
71
|
-
}
|
|
72
|
-
if (!expected(subjectNameVariant, node_opcua_variant_1.DataType.String, node_opcua_variant_1.VariantArrayType.Scalar)) {
|
|
73
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
74
|
-
}
|
|
75
|
-
if (!expected(regeneratePrivateKeyVariant, node_opcua_variant_1.DataType.Boolean, node_opcua_variant_1.VariantArrayType.Scalar)) {
|
|
76
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
77
|
-
}
|
|
78
|
-
if (!expected(regeneratePrivateKeyVariant, node_opcua_variant_1.DataType.Boolean, node_opcua_variant_1.VariantArrayType.Scalar)) {
|
|
79
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
80
|
-
}
|
|
81
|
-
if (!hasEncryptedChannel(context)) {
|
|
82
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadSecurityModeInsufficient };
|
|
83
|
-
}
|
|
84
|
-
if (!hasExpectedUserAccess(context)) {
|
|
85
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadUserAccessDenied };
|
|
86
|
-
}
|
|
87
|
-
const certificateGroupId = certificateGroupIdVariant.value;
|
|
88
|
-
const certificateTypeId = certificateTypeIdVariant.value;
|
|
89
|
-
const subjectName = subjectNameVariant.value;
|
|
90
|
-
const regeneratePrivateKey = regeneratePrivateKeyVariant.value;
|
|
91
|
-
const nonce = nonceVariant.value;
|
|
92
|
-
const pushCertificateManager = getPushCertificateManager(this);
|
|
93
|
-
if (!pushCertificateManager) {
|
|
94
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadNotImplemented };
|
|
95
|
-
}
|
|
96
|
-
const result = yield pushCertificateManager.createSigningRequest(certificateGroupId, certificateTypeId, subjectName, regeneratePrivateKey, nonce);
|
|
97
|
-
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
98
|
-
return { statusCode: result.statusCode };
|
|
99
|
-
}
|
|
100
|
-
const callMethodResult = {
|
|
101
|
-
outputArguments: [
|
|
102
|
-
{
|
|
103
|
-
dataType: node_opcua_variant_1.DataType.ByteString,
|
|
104
|
-
value: result.certificateSigningRequest
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
statusCode: result.statusCode
|
|
108
|
-
};
|
|
109
|
-
return callMethodResult;
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
function _updateCertificate(inputArguments, context) {
|
|
113
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
const certificateGroupId = inputArguments[0].value;
|
|
115
|
-
const certificateTypeId = inputArguments[1].value;
|
|
116
|
-
const certificate = inputArguments[2].value;
|
|
117
|
-
const issuerCertificates = inputArguments[3].value;
|
|
118
|
-
const privateKeyFormat = inputArguments[4].value;
|
|
119
|
-
const privateKey = inputArguments[5].value;
|
|
120
|
-
// This Method requires an encrypted channel and that the Client provides credentials with
|
|
121
|
-
// administrative rights on the Server
|
|
122
|
-
if (!hasEncryptedChannel(context)) {
|
|
123
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadSecurityModeInsufficient };
|
|
124
|
-
}
|
|
125
|
-
if (!hasExpectedUserAccess(context)) {
|
|
126
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadUserAccessDenied };
|
|
127
|
-
}
|
|
128
|
-
if (privateKeyFormat && privateKeyFormat !== "" && privateKeyFormat.toLowerCase() !== "pem") {
|
|
129
|
-
errorLog("_updateCertificate: Invalid PEM format requested " + privateKeyFormat);
|
|
130
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadInvalidArgument };
|
|
131
|
-
}
|
|
132
|
-
const pushCertificateManager = getPushCertificateManager(this);
|
|
133
|
-
if (!pushCertificateManager) {
|
|
134
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadNotImplemented };
|
|
135
|
-
}
|
|
136
|
-
const result = yield pushCertificateManager.updateCertificate(certificateGroupId, certificateTypeId, certificate, issuerCertificates, privateKeyFormat, privateKey);
|
|
137
|
-
// todo raise a CertificateUpdatedAuditEventType
|
|
138
|
-
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
139
|
-
return { statusCode: result.statusCode };
|
|
140
|
-
}
|
|
141
|
-
const callMethodResult = {
|
|
142
|
-
outputArguments: [
|
|
143
|
-
{
|
|
144
|
-
dataType: node_opcua_variant_1.DataType.Boolean,
|
|
145
|
-
value: !!result.applyChangesRequired
|
|
146
|
-
}
|
|
147
|
-
],
|
|
148
|
-
statusCode: result.statusCode
|
|
149
|
-
};
|
|
150
|
-
return callMethodResult;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
function _getRejectedList(inputArguments, context) {
|
|
154
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
155
|
-
if (!hasEncryptedChannel(context)) {
|
|
156
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadSecurityModeInsufficient };
|
|
157
|
-
}
|
|
158
|
-
if (!hasExpectedUserAccess(context)) {
|
|
159
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadUserAccessDenied };
|
|
160
|
-
}
|
|
161
|
-
const pushCertificateManager = getPushCertificateManager(this);
|
|
162
|
-
if (!pushCertificateManager) {
|
|
163
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadNotImplemented };
|
|
164
|
-
}
|
|
165
|
-
const result = yield pushCertificateManager.getRejectedList();
|
|
166
|
-
if (result.statusCode !== node_opcua_status_code_1.StatusCodes.Good) {
|
|
167
|
-
return { statusCode: result.statusCode };
|
|
168
|
-
}
|
|
169
|
-
return {
|
|
170
|
-
outputArguments: [
|
|
171
|
-
{
|
|
172
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Array,
|
|
173
|
-
dataType: node_opcua_variant_1.DataType.ByteString,
|
|
174
|
-
value: result.certificates
|
|
175
|
-
}
|
|
176
|
-
],
|
|
177
|
-
statusCode: node_opcua_status_code_1.StatusCodes.Good
|
|
178
|
-
};
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
function _applyChanges(inputArguments, context) {
|
|
182
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
183
|
-
// This Method requires an encrypted channel and that the Client provide credentials with
|
|
184
|
-
// administrative rights on the Server.
|
|
185
|
-
if (!hasEncryptedChannel(context)) {
|
|
186
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadSecurityModeInsufficient };
|
|
187
|
-
}
|
|
188
|
-
if (!hasExpectedUserAccess(context)) {
|
|
189
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadUserAccessDenied };
|
|
190
|
-
}
|
|
191
|
-
const pushCertificateManager = getPushCertificateManager(this);
|
|
192
|
-
if (!pushCertificateManager) {
|
|
193
|
-
return { statusCode: node_opcua_status_code_1.StatusCodes.BadNotImplemented };
|
|
194
|
-
}
|
|
195
|
-
const statusCode = yield pushCertificateManager.applyChanges();
|
|
196
|
-
return { statusCode };
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
function installPushCertificateManagement(addressSpace, options) {
|
|
200
|
-
const serverConfiguration = addressSpace.rootFolder.objects.server.serverConfiguration;
|
|
201
|
-
const serverConfigurationPriv = serverConfiguration;
|
|
202
|
-
if (serverConfigurationPriv.$pushCertificateManager) {
|
|
203
|
-
return;
|
|
204
|
-
throw new Error("PushCertificateManagement has already been installed");
|
|
205
|
-
}
|
|
206
|
-
serverConfigurationPriv.$pushCertificateManager = new push_certificate_manager_server_impl_1.PushCertificateManagerServerImpl(options);
|
|
207
|
-
serverConfiguration.supportedPrivateKeyFormats.setValueFromSource({
|
|
208
|
-
arrayType: node_opcua_variant_1.VariantArrayType.Array,
|
|
209
|
-
dataType: node_opcua_variant_1.DataType.String,
|
|
210
|
-
value: ["PEM"]
|
|
211
|
-
});
|
|
212
|
-
serverConfiguration.createSigningRequest.bindMethod(util_1.callbackify(_createSigningRequest));
|
|
213
|
-
serverConfiguration.updateCertificate.bindMethod(util_1.callbackify(_updateCertificate));
|
|
214
|
-
serverConfiguration.getRejectedList.bindMethod(util_1.callbackify(_getRejectedList));
|
|
215
|
-
if (serverConfiguration.applyChanges) {
|
|
216
|
-
serverConfiguration.applyChanges.bindMethod(util_1.callbackify(_applyChanges));
|
|
217
|
-
}
|
|
218
|
-
install_CertificateAlarm_1.installCertificateExpirationAlarm(addressSpace);
|
|
219
|
-
}
|
|
220
|
-
exports.installPushCertificateManagement = installPushCertificateManagement;
|
|
221
|
-
//# sourceMappingURL=push_certificate_manager_helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"push_certificate_manager_helpers.js","sourceRoot":"","sources":["../source/push_certificate_manager_helpers.ts"],"names":[],"mappings":";AAAA;;GAEG;;;;;;;;;;;;AAEH,+BAAmC;AAGnC,uDAAiE;AAEjE,mEAAqD;AAErD,2DAAyE;AAIzE,gFAE2C;AAC3C,wGAGuD;AAEvD,MAAM,QAAQ,GAAG,gCAAa,CAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,OAAO,GAAG,iCAAc,CAAC,qBAAqB,CAAC,CAAC;AACtD,MAAM,QAAQ,GAAG,QAAQ,CAAC;AAE1B,SAAS,qBAAqB,CAAC,OAAuB;IAClD,IAAI,CAAC,OAAO;QACV,CAAC,OAAO,CAAC,OAAO;QAChB,CAAC,OAAO,CAAC,OAAO,CAAC,iBAAiB,EAAE;QAClC,OAAO,KAAK,CAAC;KAChB;IACD,MAAM,eAAe,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC;I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