@itentialopensource/adapter-sectigo_certification_manager 0.1.1

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.
Files changed (112) hide show
  1. package/.eslintignore +5 -0
  2. package/.eslintrc.js +18 -0
  3. package/.jshintrc +3 -0
  4. package/AUTH.md +45 -0
  5. package/BROKER.md +211 -0
  6. package/CALLS.md +1323 -0
  7. package/CHANGELOG.md +9 -0
  8. package/CODE_OF_CONDUCT.md +43 -0
  9. package/CONTRIBUTING.md +13 -0
  10. package/ENHANCE.md +69 -0
  11. package/LICENSE +201 -0
  12. package/PROPERTIES.md +646 -0
  13. package/README.md +343 -0
  14. package/SUMMARY.md +9 -0
  15. package/SYSTEMINFO.md +18 -0
  16. package/TAB1.md +10 -0
  17. package/TAB2.md +325 -0
  18. package/TROUBLESHOOT.md +47 -0
  19. package/adapter.js +20171 -0
  20. package/adapterBase.js +1452 -0
  21. package/entities/.generic/action.json +214 -0
  22. package/entities/.generic/schema.json +28 -0
  23. package/entities/.system/action.json +50 -0
  24. package/entities/.system/mockdatafiles/getToken-default.json +3 -0
  25. package/entities/.system/mockdatafiles/healthcheck-default.json +3 -0
  26. package/entities/.system/schema.json +19 -0
  27. package/entities/.system/schemaTokenReq.json +53 -0
  28. package/entities/.system/schemaTokenResp.json +53 -0
  29. package/entities/ACMEEVDetailsValidation/action.json +24 -0
  30. package/entities/ACMEEVDetailsValidation/schema.json +19 -0
  31. package/entities/Administrators/action.json +230 -0
  32. package/entities/Administrators/schema.json +29 -0
  33. package/entities/AssignmentRules/action.json +127 -0
  34. package/entities/AssignmentRules/schema.json +24 -0
  35. package/entities/AzureAccounts/action.json +67 -0
  36. package/entities/AzureAccounts/schema.json +21 -0
  37. package/entities/CertificateBuckets/action.json +207 -0
  38. package/entities/CertificateBuckets/schema.json +28 -0
  39. package/entities/ClientCertificates/action.json +270 -0
  40. package/entities/ClientCertificates/schema.json +31 -0
  41. package/entities/CustomFields/action.json +106 -0
  42. package/entities/CustomFields/schema.json +23 -0
  43. package/entities/DeviceCertificates/action.json +289 -0
  44. package/entities/DeviceCertificates/schema.json +32 -0
  45. package/entities/DomainControlValidation/action.json +265 -0
  46. package/entities/DomainControlValidation/schema.json +31 -0
  47. package/entities/Domains/action.json +206 -0
  48. package/entities/Domains/schema.json +28 -0
  49. package/entities/MSADDiscoveryTasks/action.json +126 -0
  50. package/entities/MSADDiscoveryTasks/schema.json +24 -0
  51. package/entities/MSAgents/action.json +106 -0
  52. package/entities/MSAgents/schema.json +23 -0
  53. package/entities/NetworkAgents/action.json +250 -0
  54. package/entities/NetworkAgents/schema.json +30 -0
  55. package/entities/NetworkDiscoveryTasks/action.json +126 -0
  56. package/entities/NetworkDiscoveryTasks/schema.json +24 -0
  57. package/entities/Notifications/action.json +106 -0
  58. package/entities/Notifications/schema.json +23 -0
  59. package/entities/Operations/action.json +66 -0
  60. package/entities/Operations/schema.json +21 -0
  61. package/entities/Organizations/action.json +148 -0
  62. package/entities/Organizations/schema.json +36 -0
  63. package/entities/Persons/action.json +209 -0
  64. package/entities/Persons/schema.json +28 -0
  65. package/entities/Reports/action.json +104 -0
  66. package/entities/Reports/schema.json +34 -0
  67. package/entities/SSLCertificates/action.json +370 -0
  68. package/entities/SSLCertificates/schema.json +36 -0
  69. package/entities/SectigoPublicACMEAccounts/action.json +208 -0
  70. package/entities/SectigoPublicACMEAccounts/schema.json +28 -0
  71. package/entities/SectigoPublicACMEServers/action.json +25 -0
  72. package/entities/SectigoPublicACMEServers/schema.json +19 -0
  73. package/entities/TemplateAdministrators/action.json +106 -0
  74. package/entities/TemplateAdministrators/schema.json +23 -0
  75. package/entities/UniversalACMEAccounts/action.json +147 -0
  76. package/entities/UniversalACMEAccounts/schema.json +25 -0
  77. package/error.json +190 -0
  78. package/metadata.json +81 -0
  79. package/package.json +81 -0
  80. package/pronghorn.json +11368 -0
  81. package/propertiesDecorators.json +14 -0
  82. package/propertiesSchema.json +1574 -0
  83. package/refs?service=git-upload-pack +0 -0
  84. package/report/Sectigo-Certificate-Management-OpenAPI.json +20192 -0
  85. package/report/adapterInfo.json +10 -0
  86. package/report/auto-adapter-openapi.json +8898 -0
  87. package/report/creationReport.json +1485 -0
  88. package/sampleProperties.json +265 -0
  89. package/test/integration/adapterTestBasicGet.js +83 -0
  90. package/test/integration/adapterTestConnectivity.js +118 -0
  91. package/test/integration/adapterTestIntegration.js +5256 -0
  92. package/test/unit/adapterBaseTestUnit.js +1024 -0
  93. package/test/unit/adapterTestUnit.js +7204 -0
  94. package/utils/adapterInfo.js +206 -0
  95. package/utils/addAuth.js +94 -0
  96. package/utils/artifactize.js +146 -0
  97. package/utils/basicGet.js +50 -0
  98. package/utils/checkMigrate.js +63 -0
  99. package/utils/entitiesToDB.js +179 -0
  100. package/utils/findPath.js +74 -0
  101. package/utils/methodDocumentor.js +273 -0
  102. package/utils/modify.js +152 -0
  103. package/utils/packModificationScript.js +35 -0
  104. package/utils/patches2bundledDeps.js +90 -0
  105. package/utils/pre-commit.sh +32 -0
  106. package/utils/removeHooks.js +20 -0
  107. package/utils/setup.js +33 -0
  108. package/utils/taskMover.js +309 -0
  109. package/utils/tbScript.js +239 -0
  110. package/utils/tbUtils.js +489 -0
  111. package/utils/testRunner.js +298 -0
  112. package/utils/troubleshootingAdapter.js +193 -0
@@ -0,0 +1,265 @@
1
+ {
2
+ "id": "Adapter-sectigo_certification_manager",
3
+ "type": "SectigoCertificationManager",
4
+ "properties": {
5
+ "host": "localhost",
6
+ "port": 443,
7
+ "choosepath": "",
8
+ "base_path": "/",
9
+ "version": "",
10
+ "cache_location": "none",
11
+ "encode_pathvars": true,
12
+ "encode_queryvars": true,
13
+ "save_metric": false,
14
+ "stub": true,
15
+ "protocol": "https",
16
+ "authentication": {
17
+ "auth_method": "static_token",
18
+ "username": "username",
19
+ "password": "password",
20
+ "token": "token",
21
+ "token_timeout": 600000,
22
+ "token_cache": "local",
23
+ "invalid_token_error": 401,
24
+ "auth_field": [
25
+ "header.headers.login",
26
+ "header.headers.password",
27
+ "header.headers.customerUri"
28
+ ],
29
+ "auth_field_format": [
30
+ "{username}",
31
+ "{password}",
32
+ "{token}"
33
+ ],
34
+ "auth_logging": false,
35
+ "client_id": "",
36
+ "client_secret": "",
37
+ "grant_type": "",
38
+ "sensitive": [],
39
+ "multiStepAuthCalls": [
40
+ {
41
+ "name": "",
42
+ "requestFields": {},
43
+ "responseFields": {},
44
+ "successfullResponseCode": 200
45
+ }
46
+ ],
47
+ "sso": {
48
+ "protocol": "",
49
+ "host": "",
50
+ "port": 0
51
+ }
52
+ },
53
+ "healthcheck": {
54
+ "type": "none",
55
+ "frequency": 60000,
56
+ "query_object": {},
57
+ "addlHeaders": {}
58
+ },
59
+ "throttle": {
60
+ "throttle_enabled": false,
61
+ "number_pronghorns": 1,
62
+ "sync_async": "sync",
63
+ "max_in_queue": 1000,
64
+ "concurrent_max": 1,
65
+ "expire_timeout": 0,
66
+ "avg_runtime": 200,
67
+ "priorities": [
68
+ {
69
+ "value": 0,
70
+ "percent": 100
71
+ }
72
+ ]
73
+ },
74
+ "request": {
75
+ "number_redirects": 0,
76
+ "number_retries": 3,
77
+ "limit_retry_error": [
78
+ 0
79
+ ],
80
+ "failover_codes": [],
81
+ "attempt_timeout": 5000,
82
+ "global_request": {
83
+ "payload": {},
84
+ "uriOptions": {},
85
+ "addlHeaders": {},
86
+ "authData": {}
87
+ },
88
+ "healthcheck_on_timeout": true,
89
+ "return_raw": false,
90
+ "archiving": false,
91
+ "return_request": false
92
+ },
93
+ "proxy": {
94
+ "enabled": false,
95
+ "host": "",
96
+ "port": 1,
97
+ "protocol": "http",
98
+ "username": "",
99
+ "password": ""
100
+ },
101
+ "ssl": {
102
+ "ecdhCurve": "",
103
+ "enabled": false,
104
+ "accept_invalid_cert": false,
105
+ "ca_file": "",
106
+ "key_file": "",
107
+ "cert_file": "",
108
+ "secure_protocol": "",
109
+ "ciphers": ""
110
+ },
111
+ "mongo": {
112
+ "host": "",
113
+ "port": 0,
114
+ "database": "",
115
+ "username": "",
116
+ "password": "",
117
+ "replSet": "",
118
+ "db_ssl": {
119
+ "enabled": false,
120
+ "accept_invalid_cert": false,
121
+ "ca_file": "",
122
+ "key_file": "",
123
+ "cert_file": ""
124
+ }
125
+ },
126
+ "devicebroker": {
127
+ "enabled": false,
128
+ "getDevice": [
129
+ {
130
+ "path": "/get/devices/{id}",
131
+ "method": "GET",
132
+ "query": {},
133
+ "body": {},
134
+ "headers": {},
135
+ "handleFailure": "fail",
136
+ "requestFields": {
137
+ "id": "name"
138
+ },
139
+ "responseDatakey": "",
140
+ "responseFields": {
141
+ "name": "host",
142
+ "ostype": "os",
143
+ "ostypePrefix": "system-",
144
+ "ipaddress": "attributes.ipaddr",
145
+ "port": "443"
146
+ }
147
+ }
148
+ ],
149
+ "getDevicesFiltered": [
150
+ {
151
+ "path": "/get/devices",
152
+ "method": "GET",
153
+ "pagination": {
154
+ "offsetVar": "",
155
+ "limitVar": "",
156
+ "incrementBy": "limit",
157
+ "requestLocation": "query"
158
+ },
159
+ "query": {},
160
+ "body": {},
161
+ "headers": {},
162
+ "handleFailure": "fail",
163
+ "requestFields": {},
164
+ "responseDatakey": "",
165
+ "responseFields": {
166
+ "name": "host",
167
+ "ostype": "os",
168
+ "ostypePrefix": "system-",
169
+ "ipaddress": "attributes.ipaddr",
170
+ "port": "443"
171
+ }
172
+ }
173
+ ],
174
+ "isAlive": [
175
+ {
176
+ "path": "/get/devices/{id}/status",
177
+ "method": "GET",
178
+ "query": {},
179
+ "body": {},
180
+ "headers": {},
181
+ "handleFailure": "fail",
182
+ "requestFields": {
183
+ "id": "name"
184
+ },
185
+ "responseDatakey": "",
186
+ "responseFields": {
187
+ "status": "status",
188
+ "statusValue": "online"
189
+ }
190
+ }
191
+ ],
192
+ "getConfig": [
193
+ {
194
+ "path": "/get/devices/{id}/configPart1",
195
+ "method": "GET",
196
+ "query": {},
197
+ "body": {},
198
+ "headers": {},
199
+ "handleFailure": "fail",
200
+ "requestFields": {
201
+ "id": "name"
202
+ },
203
+ "responseDatakey": "",
204
+ "responseFields": {}
205
+ }
206
+ ],
207
+ "getCount": [
208
+ {
209
+ "path": "/get/devices",
210
+ "method": "GET",
211
+ "query": {},
212
+ "body": {},
213
+ "headers": {},
214
+ "handleFailure": "fail",
215
+ "requestFields": {},
216
+ "responseDatakey": "",
217
+ "responseFields": {}
218
+ }
219
+ ]
220
+ },
221
+ "cache": {
222
+ "enabled": false,
223
+ "entities": [
224
+ {
225
+ "entityType": "",
226
+ "frequency": 1440,
227
+ "flushOnFail": false,
228
+ "limit": 1000,
229
+ "retryAttempts": 5,
230
+ "sort": true,
231
+ "populate": [
232
+ {
233
+ "path": "",
234
+ "method": "GET",
235
+ "pagination": {
236
+ "offsetVar": "",
237
+ "limitVar": "",
238
+ "incrementBy": "limit",
239
+ "requestLocation": "query"
240
+ },
241
+ "query": {},
242
+ "body": {},
243
+ "headers": {},
244
+ "handleFailure": "ignore",
245
+ "requestFields": {},
246
+ "responseDatakey": "",
247
+ "responseFields": {}
248
+ }
249
+ ],
250
+ "cachedTasks": [
251
+ {
252
+ "name": "",
253
+ "filterField": "",
254
+ "filterLoc": ""
255
+ }
256
+ ]
257
+ }
258
+ ]
259
+ }
260
+ },
261
+ "groups": [],
262
+ "brokers": [],
263
+ "logLevel": "none",
264
+ "timeout": 120000
265
+ }
@@ -0,0 +1,83 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe context before after */
4
+ /* eslint global-require: warn */
5
+ /* eslint no-unused-vars: warn */
6
+ /* eslint import/no-extraneous-dependencies: warn */
7
+ /* eslint import/no-dynamic-require: warn */
8
+ /* eslint import/no-unresolved: warn */
9
+
10
+ const path = require('path');
11
+ const assert = require('assert');
12
+ const mocha = require('mocha');
13
+ const itParam = require('mocha-param');
14
+
15
+ const utils = require('../../utils/tbUtils');
16
+ const basicGet = require('../../utils/basicGet');
17
+ const { name } = require('../../package.json');
18
+ const { methods } = require('../../pronghorn.json');
19
+
20
+ const getPronghornProps = (iapDir) => {
21
+ console.log('Retrieving properties.json file...');
22
+ const rawProps = require(path.join(iapDir, 'properties.json'));
23
+ console.log('Decrypting properties...');
24
+ const pronghornProps = utils.decryptProperties(rawProps, iapDir);
25
+ console.log('Found properties.\n');
26
+ return pronghornProps;
27
+ };
28
+
29
+ let a;
30
+
31
+ describe('[integration] Adapter BasicGET Test', () => {
32
+ context('Testing GET calls without query parameters', () => {
33
+ before(async () => {
34
+ const iapDir = path.join(__dirname, '../../../../../');
35
+ if (!utils.areWeUnderIAPinstallationDirectory()) {
36
+ const sampleProperties = require('../../sampleProperties.json');
37
+ const adapter = { properties: sampleProperties };
38
+ a = basicGet.getAdapterInstance(adapter);
39
+ } else {
40
+ const pronghornProps = getPronghornProps(iapDir);
41
+ console.log('Connecting to Database...');
42
+ const database = await basicGet.connect(pronghornProps);
43
+ console.log('Connection established.');
44
+ const adapter = await database.collection(utils.SERVICE_CONFIGS_COLLECTION).findOne(
45
+ { model: name }
46
+ );
47
+ a = basicGet.getAdapterInstance(adapter);
48
+ }
49
+ });
50
+
51
+ after((done) => {
52
+ done();
53
+ });
54
+
55
+ const basicGets = methods.filter((method) => (method.route.verb === 'GET' && method.input.length === 0));
56
+ if (basicGets.length === 0) {
57
+ console.log('No non-parameter GET calls found.');
58
+ process.exit(0);
59
+ }
60
+ const functionNames = basicGets.map((g) => g.name);
61
+ const request = function request(f, ad) {
62
+ return new Promise((resolve, reject) => {
63
+ const getRespCode = (resp) => {
64
+ if (resp) {
65
+ if (resp.metrics.code !== 200) {
66
+ console.log('\x1b[31m', `Testing ${f} \nResponseCode: ${resp.metrics.code}`);
67
+ }
68
+ resolve(resp.metrics.code);
69
+ } else {
70
+ console.log('\x1b[31m', `call ${f} results in failure`);
71
+ reject(new Error(`${f} failed`));
72
+ }
73
+ };
74
+ ad[f](getRespCode, console.log);
75
+ });
76
+ };
77
+
78
+ itParam('GET call should return 200', functionNames, (fname) => {
79
+ console.log(`\t ${fname}`);
80
+ return request(fname, a).then((result) => assert.equal(result, 200));
81
+ });
82
+ });
83
+ });
@@ -0,0 +1,118 @@
1
+ /* @copyright Itential, LLC 2020 */
2
+
3
+ /* global describe it context before after */
4
+ /* eslint no-unused-vars: warn */
5
+
6
+ const assert = require('assert');
7
+ const https = require('https');
8
+ const mocha = require('mocha');
9
+ const ping = require('ping');
10
+ const dnsLookup = require('dns-lookup-promise');
11
+
12
+ let host;
13
+ process.argv.forEach((val) => {
14
+ if (val.indexOf('--HOST') === 0) {
15
+ [, host] = val.split('=');
16
+ }
17
+ });
18
+
19
+ describe('[integration] Adapter Test', () => {
20
+ context(`Testing network connection on ${host}`, () => {
21
+ after((done) => {
22
+ done();
23
+ });
24
+
25
+ it('DNS resolve', (done) => {
26
+ dnsLookup(host)
27
+ .then((addresses) => {
28
+ try {
29
+ assert.ok(addresses.length > 0);
30
+ done();
31
+ } catch (error) {
32
+ done(error);
33
+ }
34
+ })
35
+ .catch((err) => {
36
+ done(err);
37
+ });
38
+ });
39
+
40
+ it('Responds to ping', (done) => {
41
+ ping.promise.probe(host)
42
+ .then((result) => {
43
+ try {
44
+ assert.ok(result.alive);
45
+ done();
46
+ } catch (error) {
47
+ done(error);
48
+ }
49
+ })
50
+ .catch((err) => {
51
+ done(err);
52
+ });
53
+ });
54
+
55
+ it('Support HTTPS on port 443', (done) => {
56
+ const requestOptions = {
57
+ host,
58
+ port: 443,
59
+ method: 'HEAD'
60
+ };
61
+
62
+ const req = https.request(requestOptions, (res) => {
63
+ try {
64
+ assert.ok(res.statusCode >= 200 && res.statusCode < 400);
65
+ done();
66
+ } catch (error) {
67
+ done(error);
68
+ }
69
+ });
70
+
71
+ req.on('error', (err) => {
72
+ done(err);
73
+ });
74
+
75
+ req.end();
76
+ });
77
+
78
+ it('Support IPv4', (done) => {
79
+ const options = {
80
+ family: 4,
81
+ hints: dnsLookup.ADDRCONFIG
82
+ };
83
+
84
+ dnsLookup.lookup(host, options)
85
+ .then((address, family) => {
86
+ try {
87
+ assert.ok(address !== null && family === 4);
88
+ done();
89
+ } catch (error) {
90
+ done(error);
91
+ }
92
+ })
93
+ .catch((err) => {
94
+ done(err);
95
+ });
96
+ });
97
+
98
+ it('Support IPv6', (done) => {
99
+ const options = {
100
+ family: 6,
101
+ hints: dnsLookup.ADDRCONFIG
102
+ };
103
+
104
+ dnsLookup.lookup(host, options)
105
+ .then((address, family) => {
106
+ try {
107
+ assert.ok(address !== null && family === 6);
108
+ done();
109
+ } catch (error) {
110
+ done(error);
111
+ }
112
+ })
113
+ .catch((err) => {
114
+ done(err);
115
+ });
116
+ });
117
+ });
118
+ });