@opscompass/opscompass-cli 1.0.38 → 1.0.40
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/index.js +4 -1
- package/lib/maskValues.js +239 -97
- package/modules/license-manager.js +41 -28
- package/package.json +6 -6
package/index.js
CHANGED
|
@@ -88,8 +88,11 @@ function help() {
|
|
|
88
88
|
} else {
|
|
89
89
|
requiresLogin();
|
|
90
90
|
}
|
|
91
|
+
} else if (moduleName === "version") {
|
|
92
|
+
const pkg = require("./package.json");
|
|
93
|
+
console.log(`${pkg.name} ${pkg.version}`);
|
|
91
94
|
} else {
|
|
92
|
-
console.error(
|
|
95
|
+
console.error(`Unknown module, "${moduleName}"`);
|
|
93
96
|
return help();
|
|
94
97
|
}
|
|
95
98
|
})();
|
package/lib/maskValues.js
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
# Library to allow for masking of sensitive values
|
|
7
7
|
#
|
|
8
8
|
# Modification History:
|
|
9
|
+
# 2025-01-28 mss: Added keyCommands
|
|
9
10
|
# 2024-10-09 mss: Initial revision
|
|
10
11
|
#
|
|
11
12
|
#--------------------------------------------------------------------------- */
|
|
@@ -17,16 +18,103 @@ const path = require("path");
|
|
|
17
18
|
const { utilsModule: utils } = require("./utils");
|
|
18
19
|
const { opscompassHome } = require("../environment/current"); // For compatibility with the OpsCompass CLI
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Function to execute operating system commands
|
|
23
|
+
*/
|
|
24
|
+
const { exec } = require("child_process");
|
|
25
|
+
function executeCommand(command) {
|
|
26
|
+
return new Promise((resolve, reject) => {
|
|
27
|
+
exec(command, (error, stdout, stderr) => {
|
|
28
|
+
if (error) {
|
|
29
|
+
reject(`Error: ${stderr}`);
|
|
30
|
+
} else {
|
|
31
|
+
resolve(stdout);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
20
37
|
// Resources to check for sensitive attributes
|
|
21
38
|
const maskTypes = {
|
|
22
39
|
md5: "md5",
|
|
23
40
|
sha256: "sha256",
|
|
24
41
|
};
|
|
25
42
|
|
|
43
|
+
/**
|
|
44
|
+
* Function to find keyCommand for a maskType, and only check
|
|
45
|
+
* once per maskType
|
|
46
|
+
*
|
|
47
|
+
* Example of a command shell script:
|
|
48
|
+
|
|
49
|
+
$ cat ~/.opscompassdev/keystore/1password-lookup.sh
|
|
50
|
+
#/usr/bin/env bash
|
|
51
|
+
|
|
52
|
+
#
|
|
53
|
+
# *** It is up to the user to ensure that this command will work
|
|
54
|
+
# *** in non-interactive environments
|
|
55
|
+
#
|
|
56
|
+
# 1Password keystore command to get the fields for an item
|
|
57
|
+
# https://developer.1password.com/docs/cli/reference/management-commands/item
|
|
58
|
+
#
|
|
59
|
+
# op item get [{ <itemName> | <itemID> | <shareLink> | - }] [flags]
|
|
60
|
+
#
|
|
61
|
+
# To use this, set mask fields for the configuration
|
|
62
|
+
# via the Opscompass CLI or WebUI
|
|
63
|
+
#
|
|
64
|
+
# For example, set the user field to the following, where
|
|
65
|
+
# "opscompass-oracle-default" is the secret to lookup in 1Password:
|
|
66
|
+
#
|
|
67
|
+
# oc$mask-1password:{opscompass-oracle-default}
|
|
68
|
+
#
|
|
69
|
+
# To verify your configuration
|
|
70
|
+
# 1. Copy this file to ~/.opscompass/keystore/1password-lookup.sh
|
|
71
|
+
# 2. Create an entry in your vault with the key "opscompass-oracle-default"
|
|
72
|
+
# 3. To enable the script, ensure it is executable and issue this command
|
|
73
|
+
#
|
|
74
|
+
# opscompass license-manager mask-monitoring-configurations lookup \
|
|
75
|
+
# 'user=oc$mask-1password:{opscompass-oracle-default}'
|
|
76
|
+
#
|
|
77
|
+
# lookupCreds: {
|
|
78
|
+
# username: 'c##dblicmon',
|
|
79
|
+
# password: 'sfwjfj28sd1jdx',
|
|
80
|
+
# notesPlain: null
|
|
81
|
+
# }
|
|
82
|
+
#
|
|
83
|
+
|
|
84
|
+
op item get "${1}" \
|
|
85
|
+
--reveal --format json \
|
|
86
|
+
| jq '.fields | map({(.id): .value}) | add'
|
|
87
|
+
|
|
88
|
+
* The key command is called with the item name as the only argument, and returns
|
|
89
|
+
* a JSON string with the key-value pairs for the item
|
|
90
|
+
*
|
|
91
|
+
* @param {*} maskType
|
|
92
|
+
* @returns the path to the keyCommand (if executable) or undefined
|
|
93
|
+
*/
|
|
94
|
+
let keyCmd = [];
|
|
95
|
+
function getKeyCommand(maskType) {
|
|
96
|
+
if (keyCmd.hasOwnProperty(maskType)) return keyCmd[maskType];
|
|
97
|
+
|
|
98
|
+
keyCmd[maskType] = undefined;
|
|
99
|
+
const keyCommand = path.join(
|
|
100
|
+
opscompassHome,
|
|
101
|
+
"keystore",
|
|
102
|
+
`${maskType}-lookup.sh`
|
|
103
|
+
);
|
|
104
|
+
try {
|
|
105
|
+
// If keyCommand exists and is executable, use that
|
|
106
|
+
fs.accessSync(keyCommand, fs.constants.F_OK | fs.constants.X_OK);
|
|
107
|
+
keyCmd[maskType] = keyCommand;
|
|
108
|
+
} catch (error) {
|
|
109
|
+
// If the file does not exist or does not match the criteria, the test will throw
|
|
110
|
+
// console.error(`Error testing keyCommand for mask (${maskType}):\n`, error);
|
|
111
|
+
}
|
|
112
|
+
return keyCmd[maskType];
|
|
113
|
+
}
|
|
114
|
+
|
|
26
115
|
/**
|
|
27
116
|
* Return a sqlite3 db object (create if necessary)
|
|
28
117
|
*/
|
|
29
|
-
const sqlite3 = require("sqlite3").verbose();
|
|
30
118
|
class MaskDb {
|
|
31
119
|
company = undefined;
|
|
32
120
|
db = undefined;
|
|
@@ -45,25 +133,35 @@ class MaskDb {
|
|
|
45
133
|
];
|
|
46
134
|
|
|
47
135
|
constructor(dbFileName, company = global?.company || "unspecified-company") {
|
|
136
|
+
const Database = require("better-sqlite3");
|
|
137
|
+
|
|
48
138
|
this.company = company;
|
|
49
139
|
this.dbFilePath = path.join(opscompassHome, "configs", company, dbFileName);
|
|
50
140
|
// It is possible that this will be the first time we need that directory
|
|
51
|
-
|
|
141
|
+
try {
|
|
142
|
+
fs.mkdirSync(path.dirname(this.dbFilePath), { recursive: true });
|
|
143
|
+
} catch (err) {
|
|
144
|
+
console.error(`Could not create directory for mask database:\n${err}`);
|
|
145
|
+
process.exit(10);
|
|
146
|
+
}
|
|
52
147
|
|
|
53
148
|
return new Promise((resolve, reject) => {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
149
|
+
try {
|
|
150
|
+
this.db = new Database(this.dbFilePath);
|
|
151
|
+
// Set WAL mode for better performance
|
|
152
|
+
this.db.pragma("journal_mode = WAL");
|
|
153
|
+
} catch (err) {
|
|
154
|
+
console.error(`Could not open database ${this.dbFilePath}:\n${err}`);
|
|
155
|
+
process.exit(12);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// console.info("Connected to database:", this.dbFilePath);
|
|
159
|
+
this.createTable("mask", this.maskColumns)
|
|
160
|
+
.then(() => {
|
|
161
|
+
// console.log("Table and indexes created successfully");
|
|
162
|
+
resolve(this);
|
|
163
|
+
})
|
|
164
|
+
.catch((err) => reject("Could not create tables", err));
|
|
67
165
|
});
|
|
68
166
|
}
|
|
69
167
|
|
|
@@ -77,18 +175,13 @@ class MaskDb {
|
|
|
77
175
|
.join(", ");
|
|
78
176
|
|
|
79
177
|
const sql = `CREATE TABLE IF NOT EXISTS ${tableName} (${columnsDefinition})`;
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
}).then(async () => {
|
|
90
|
-
// console.log("Creating indexes...");
|
|
91
|
-
await this.createIndexes(tableName, columns);
|
|
178
|
+
try {
|
|
179
|
+
this.db.exec(sql);
|
|
180
|
+
this.createIndexes(tableName, columns);
|
|
181
|
+
resolve();
|
|
182
|
+
} catch (err) {
|
|
183
|
+
reject(`Could not create table ${tableName}: ${err}`);
|
|
184
|
+
}
|
|
92
185
|
});
|
|
93
186
|
}
|
|
94
187
|
|
|
@@ -97,14 +190,12 @@ class MaskDb {
|
|
|
97
190
|
if (column.index) {
|
|
98
191
|
const indexSql = `CREATE INDEX IF NOT EXISTS idx_${tableName}_${column.name} ON ${tableName} (${column.name})`;
|
|
99
192
|
return new Promise((resolve, reject) => {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
});
|
|
193
|
+
try {
|
|
194
|
+
this.db.exec(indexSql);
|
|
195
|
+
resolve();
|
|
196
|
+
} catch (err) {
|
|
197
|
+
reject(`Could not create index on ${column.name}: ${err}`);
|
|
198
|
+
}
|
|
108
199
|
});
|
|
109
200
|
}
|
|
110
201
|
return Promise.resolve();
|
|
@@ -118,24 +209,22 @@ class MaskDb {
|
|
|
118
209
|
`SELECT * FROM ${tableName}` +
|
|
119
210
|
(mask ? ` WHERE value = '${mask}'` : "") +
|
|
120
211
|
" ORDER BY name DESC";
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
}
|
|
138
|
-
});
|
|
212
|
+
|
|
213
|
+
console.error(`\nContents of ${tableName} table (${this.dbFilePath}):`);
|
|
214
|
+
console.log(`{\n "${path.basename(this.dbFilePath)}": [`);
|
|
215
|
+
this.db
|
|
216
|
+
.prepare(sql)
|
|
217
|
+
.all()
|
|
218
|
+
.forEach((row, idx, arr) => {
|
|
219
|
+
row.mask = `oc$mask-${maskType}:{${row.value}}`;
|
|
220
|
+
console.log(
|
|
221
|
+
process.stdout.isTTY
|
|
222
|
+
? JSON.stringify(row, null, 2).replace(/^/gm, " ")
|
|
223
|
+
: JSON.stringify(row),
|
|
224
|
+
idx < arr.length - 1 ? "," : ""
|
|
225
|
+
);
|
|
226
|
+
});
|
|
227
|
+
console.log(" ]\n}\n");
|
|
139
228
|
}
|
|
140
229
|
|
|
141
230
|
close() {
|
|
@@ -176,7 +265,11 @@ function processArgs(action, args) {
|
|
|
176
265
|
const testMask = matchResult.splice(1);
|
|
177
266
|
maskType = maskTypes[testMask[0]];
|
|
178
267
|
if (!maskType) {
|
|
179
|
-
|
|
268
|
+
maskType = testMask[0];
|
|
269
|
+
const keyCommand = getKeyCommand(maskType);
|
|
270
|
+
if (!keyCommand) {
|
|
271
|
+
return printHelp(`unknown mask type for lookup (${maskType})`);
|
|
272
|
+
}
|
|
180
273
|
}
|
|
181
274
|
break;
|
|
182
275
|
case "set":
|
|
@@ -197,7 +290,7 @@ function processArgs(action, args) {
|
|
|
197
290
|
}
|
|
198
291
|
|
|
199
292
|
if (!maskType) {
|
|
200
|
-
return printHelp(`unknown mask type (${args[maskTest + 1]})`);
|
|
293
|
+
return printHelp(`unknown mask type for argument (${args[maskTest + 1]})`);
|
|
201
294
|
}
|
|
202
295
|
|
|
203
296
|
// console.log(
|
|
@@ -307,17 +400,43 @@ async function lookupMask(maskType, args) {
|
|
|
307
400
|
const [prop, value] = args[0].split("=");
|
|
308
401
|
const dbname = `mask-${maskType}-${prop}`;
|
|
309
402
|
|
|
403
|
+
if (!value) {
|
|
404
|
+
return printHelp("no property=value provided");
|
|
405
|
+
}
|
|
406
|
+
|
|
310
407
|
// The type is after the '-' in oc$mask-{type} and should match the maskType
|
|
311
408
|
const testMask = value.match(/.*-(.+):{(.*)}/).splice(1);
|
|
312
409
|
if (testMask.length !== 2 || testMask[0] !== maskType) {
|
|
313
410
|
return printHelp(`invalid property value (${args[0]})`);
|
|
314
411
|
}
|
|
315
412
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
413
|
+
// If keyCmd is set we need to run that command to get the key
|
|
414
|
+
let keystoreResponse = undefined;
|
|
415
|
+
if (keyCmd[maskType]) {
|
|
416
|
+
// console.log(`We need to lookup ${testMask[1]} using keystore:`, keyCmd);
|
|
417
|
+
try {
|
|
418
|
+
keystoreResponse = await executeCommand(
|
|
419
|
+
`${keyCmd[maskType]} ${testMask[1]}`
|
|
420
|
+
);
|
|
421
|
+
const lookupCreds = JSON.parse(keystoreResponse);
|
|
422
|
+
console.log("lookupObject:", lookupCreds);
|
|
423
|
+
} catch (err) {
|
|
424
|
+
// it was not JSON, so try a literal string
|
|
425
|
+
if (keystoreResponse) {
|
|
426
|
+
console.log("lookup:", keystoreResponse.trimEnd());
|
|
427
|
+
} else {
|
|
428
|
+
return printHelp(
|
|
429
|
+
`Could not retrieve data for ${testMask[1]} from keystore:\n${err}`
|
|
430
|
+
);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
} else {
|
|
434
|
+
const maskDb = await new MaskDb(dbname).then((db) => {
|
|
435
|
+
// console.log("db opened:", db);
|
|
436
|
+
return db;
|
|
437
|
+
});
|
|
438
|
+
maskDb.dumpTable("mask", testMask[1]);
|
|
439
|
+
}
|
|
321
440
|
}
|
|
322
441
|
|
|
323
442
|
/**
|
|
@@ -338,24 +457,55 @@ async function getMask(maskType, args) {
|
|
|
338
457
|
return printHelp(`invalid property value (${args[0]})`);
|
|
339
458
|
}
|
|
340
459
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
460
|
+
let unmaskedValue = undefined;
|
|
461
|
+
let keystoreResponse = undefined;
|
|
462
|
+
let keystoreObject = undefined;
|
|
463
|
+
// If there's an external command, use it to get the value
|
|
464
|
+
const keyCommand = getKeyCommand(maskType);
|
|
465
|
+
if (keyCommand) {
|
|
466
|
+
try {
|
|
467
|
+
keystoreResponse = await executeCommand(`${keyCommand} ${testMask[1]}`);
|
|
468
|
+
keystoreObject = JSON.parse(keystoreResponse);
|
|
469
|
+
|
|
470
|
+
// If a username is returned by the keystore, the user is the username
|
|
471
|
+
if (prop === "user") {
|
|
472
|
+
unmaskedValue = keystoreObject.user || keystoreObject.username;
|
|
473
|
+
} else {
|
|
474
|
+
unmaskedValue = keystoreObject[prop];
|
|
356
475
|
}
|
|
357
|
-
)
|
|
358
|
-
|
|
476
|
+
} catch (err) {
|
|
477
|
+
if (keystoreResponse && !keystoreObject) {
|
|
478
|
+
unmaskedValue = keystoreResponse.trimEnd();
|
|
479
|
+
} else {
|
|
480
|
+
console.error(
|
|
481
|
+
`Could not retrieve data for ${testMask[1]} from keystore:\n${err}\n`
|
|
482
|
+
);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
if (!unmaskedValue) {
|
|
486
|
+
unmaskedValue = `unknown-${maskType}`;
|
|
487
|
+
}
|
|
488
|
+
} else {
|
|
489
|
+
const maskDb = await new MaskDb(dbname).then((db) => {
|
|
490
|
+
// console.log("db opened:", db);
|
|
491
|
+
return db;
|
|
492
|
+
});
|
|
493
|
+
unmaskedValue = await new Promise((resolve, reject) => {
|
|
494
|
+
try {
|
|
495
|
+
const row = maskDb.db
|
|
496
|
+
.prepare(
|
|
497
|
+
// This only seems to get the first row, not all rows, so we get the longest name match
|
|
498
|
+
`SELECT name FROM mask WHERE value = ? ORDER BY name DESC`
|
|
499
|
+
)
|
|
500
|
+
.get(testMask[1]);
|
|
501
|
+
|
|
502
|
+
resolve(row ? row.name : `unknown-${maskType}`);
|
|
503
|
+
} catch (err) {
|
|
504
|
+
reject(`Could not retrieve data from table mask:\n${err}`);
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
|
|
359
509
|
// This function is called during get-monitoring-configuration --asFile, so we do
|
|
360
510
|
// not want to print the message because it will mess up the JSON output
|
|
361
511
|
// console.error(`${prop}: ${unmaskedValue}`);
|
|
@@ -381,7 +531,7 @@ async function setMask(maskType, args) {
|
|
|
381
531
|
maskFn = utils.sha256sum;
|
|
382
532
|
break;
|
|
383
533
|
default:
|
|
384
|
-
return printHelp(`unknown mask type (${maskType})`);
|
|
534
|
+
return printHelp(`unknown mask type for setMask (${maskType})`);
|
|
385
535
|
}
|
|
386
536
|
console.error(`masking value (${maskType}): ${prop}=${value}`);
|
|
387
537
|
|
|
@@ -390,6 +540,12 @@ async function setMask(maskType, args) {
|
|
|
390
540
|
return db;
|
|
391
541
|
});
|
|
392
542
|
|
|
543
|
+
const insert = maskDb.db.prepare(
|
|
544
|
+
`INSERT INTO mask(name, value) VALUES(?, ?)
|
|
545
|
+
ON CONFLICT(name)
|
|
546
|
+
DO UPDATE SET value=excluded.value;`
|
|
547
|
+
);
|
|
548
|
+
|
|
393
549
|
let maskValue = undefined;
|
|
394
550
|
switch (prop) {
|
|
395
551
|
case "server":
|
|
@@ -404,22 +560,11 @@ async function setMask(maskType, args) {
|
|
|
404
560
|
// );
|
|
405
561
|
|
|
406
562
|
// Insert or update value in the mask table
|
|
407
|
-
await
|
|
408
|
-
`INSERT INTO mask(name, value) VALUES(?, ?)
|
|
409
|
-
ON CONFLICT(name)
|
|
410
|
-
DO UPDATE SET value=excluded.value;`,
|
|
411
|
-
[server.serverName, maskValue]
|
|
412
|
-
);
|
|
563
|
+
await insert.run(server.serverName, maskValue);
|
|
413
564
|
// Save the short name as well
|
|
414
565
|
if (server.serverName !== server.shortName) {
|
|
415
|
-
await
|
|
416
|
-
`INSERT INTO mask(name, value) VALUES(?, ?)
|
|
417
|
-
ON CONFLICT(name)
|
|
418
|
-
DO UPDATE SET value=excluded.value;`,
|
|
419
|
-
[server.shortName, maskValue]
|
|
420
|
-
);
|
|
566
|
+
await insert.run(server.shortName, maskValue);
|
|
421
567
|
}
|
|
422
|
-
maskDb.close();
|
|
423
568
|
|
|
424
569
|
// If the value contained more information we need to save that too
|
|
425
570
|
if (value === server.serverName) {
|
|
@@ -432,13 +577,10 @@ async function setMask(maskType, args) {
|
|
|
432
577
|
maskString = `oc$mask-${maskType}:{${maskValue}}`;
|
|
433
578
|
|
|
434
579
|
// Insert or update value in the mask table
|
|
435
|
-
await
|
|
436
|
-
`INSERT INTO mask(name, value) VALUES(?, ?)
|
|
437
|
-
ON CONFLICT(name)
|
|
438
|
-
DO UPDATE SET value=excluded.value;`,
|
|
439
|
-
[value, maskValue]
|
|
440
|
-
);
|
|
580
|
+
await insert.run(value, maskValue);
|
|
441
581
|
}
|
|
582
|
+
maskDb.close();
|
|
583
|
+
|
|
442
584
|
console.log(`${value}:`, maskString);
|
|
443
585
|
return maskString;
|
|
444
586
|
}
|
|
@@ -804,7 +804,7 @@ async function updateOracleDatabaseConfiguration(args) {
|
|
|
804
804
|
case "--name":
|
|
805
805
|
case "--configurationname":
|
|
806
806
|
case "--configuration-name":
|
|
807
|
-
callParams.
|
|
807
|
+
callParams.configurationName = args[++i];
|
|
808
808
|
break;
|
|
809
809
|
case "--action":
|
|
810
810
|
if (callParams.actions === undefined) callParams.actions = [];
|
|
@@ -901,7 +901,7 @@ async function updateVCenterConfiguration(args) {
|
|
|
901
901
|
case "--name":
|
|
902
902
|
case "--configurationname":
|
|
903
903
|
case "--configuration-name":
|
|
904
|
-
callParams.
|
|
904
|
+
callParams.configurationName = args[++i];
|
|
905
905
|
break;
|
|
906
906
|
case "--action":
|
|
907
907
|
if (callParams.actions === undefined) callParams.actions = [];
|
|
@@ -1506,10 +1506,10 @@ async function printHelp() {
|
|
|
1506
1506
|
);
|
|
1507
1507
|
console.log("Parameters:");
|
|
1508
1508
|
console.log(
|
|
1509
|
-
"--id [vcenter_configuration_id | oracle_database_configuration_id |
|
|
1509
|
+
"--id [vcenter_configuration_id | oracle_database_configuration_id | mssql_configuration_id | mssql_default_credential_id | oracle_default_credential_id]"
|
|
1510
1510
|
);
|
|
1511
1511
|
console.log(
|
|
1512
|
-
"--record-type ['oracle_database_configuration' | 'vcenter_configuration' | '
|
|
1512
|
+
"--record-type ['oracle_database_configuration' | 'vcenter_configuration' | 'mssql_configuration' | 'mssql_shared_monitoring_credential' | 'oracle_shared_monitoring_credential'"
|
|
1513
1513
|
);
|
|
1514
1514
|
console.log();
|
|
1515
1515
|
console.log(
|
|
@@ -1545,8 +1545,8 @@ async function printHelp() {
|
|
|
1545
1545
|
console.log("--password (optional) [string]");
|
|
1546
1546
|
console.log();
|
|
1547
1547
|
console.log(
|
|
1548
|
-
"create-
|
|
1549
|
-
"Creates
|
|
1548
|
+
"create-mssql-shared-credential",
|
|
1549
|
+
"Creates MS SQL shared credentials"
|
|
1550
1550
|
);
|
|
1551
1551
|
console.log(
|
|
1552
1552
|
"--monitoring-configuration-id monitoring configuration ID to make the shared credentials for"
|
|
@@ -1556,24 +1556,24 @@ async function printHelp() {
|
|
|
1556
1556
|
console.log("--directory-auth (optional) 'SESSION' | null");
|
|
1557
1557
|
console.log();
|
|
1558
1558
|
console.log(
|
|
1559
|
-
"delete-
|
|
1560
|
-
"Delete a
|
|
1559
|
+
"delete-mssql-shared-credential",
|
|
1560
|
+
"Delete a MS SQL shared credential"
|
|
1561
1561
|
);
|
|
1562
|
-
console.log("--id ID of the
|
|
1562
|
+
console.log("--id ID of the mssql shared credential to delete");
|
|
1563
1563
|
console.log();
|
|
1564
1564
|
console.log(
|
|
1565
|
-
"get-
|
|
1566
|
-
"Get
|
|
1565
|
+
"get-mssql-default-credential",
|
|
1566
|
+
"Get MS SQL default credential record"
|
|
1567
1567
|
);
|
|
1568
1568
|
console.log(
|
|
1569
1569
|
"--monitoring-configuration-id monitoring configuration ID to get the default credentials for"
|
|
1570
1570
|
);
|
|
1571
1571
|
console.log();
|
|
1572
1572
|
console.log(
|
|
1573
|
-
"update-
|
|
1574
|
-
"Update
|
|
1573
|
+
"update-mssql-shared-credential",
|
|
1574
|
+
"Update MS SQL shared credential record"
|
|
1575
1575
|
);
|
|
1576
|
-
console.log("--id ID of the
|
|
1576
|
+
console.log("--id ID of the mssql shared credential to update");
|
|
1577
1577
|
console.log("--user (optional) [string]");
|
|
1578
1578
|
console.log("--password (optional) [string]");
|
|
1579
1579
|
console.log("--directory-auth (optional) 'SESSION' | null");
|
|
@@ -1727,15 +1727,15 @@ async function printHelp() {
|
|
|
1727
1727
|
console.log("--password (optional) [connection password]");
|
|
1728
1728
|
console.log();
|
|
1729
1729
|
console.log(
|
|
1730
|
-
"list-
|
|
1731
|
-
"Lists all of the
|
|
1730
|
+
"list-mssql-configurations",
|
|
1731
|
+
"Lists all of the mssql configurations associated with the given monitoring configuration"
|
|
1732
1732
|
);
|
|
1733
1733
|
console.log("Parameters:");
|
|
1734
1734
|
console.log("--monitoring-configuration-id [monitoring_configuration_id]");
|
|
1735
1735
|
console.log();
|
|
1736
1736
|
console.log(
|
|
1737
|
-
"create-
|
|
1738
|
-
"Create a single
|
|
1737
|
+
"create-mssql-configuration",
|
|
1738
|
+
"Create a single mssql configuration associated with the given monitoring configuration."
|
|
1739
1739
|
);
|
|
1740
1740
|
console.log("Parameters:");
|
|
1741
1741
|
console.log("--monitoring-configuration-id [monitoring_configuration_id]");
|
|
@@ -1749,11 +1749,11 @@ async function printHelp() {
|
|
|
1749
1749
|
console.log("--directory-auth (optional) ['SESSION' or NULL]");
|
|
1750
1750
|
console.log();
|
|
1751
1751
|
console.log(
|
|
1752
|
-
"get-
|
|
1753
|
-
"Get a single
|
|
1752
|
+
"get-mssql-configuration",
|
|
1753
|
+
"Get a single mssql configuration associated with the given monitoring configuration"
|
|
1754
1754
|
);
|
|
1755
1755
|
console.log("Parameters:");
|
|
1756
|
-
console.log("--id [
|
|
1756
|
+
console.log("--id [mssql_configuration_id]");
|
|
1757
1757
|
console.log();
|
|
1758
1758
|
console.log(
|
|
1759
1759
|
"create-oracle-database-configuration",
|
|
@@ -1909,13 +1909,13 @@ async function printHelp() {
|
|
|
1909
1909
|
console.log("Parameters:");
|
|
1910
1910
|
console.log("--id [vcenter_configuration_id]");
|
|
1911
1911
|
console.log();
|
|
1912
|
-
console.log("delete-
|
|
1912
|
+
console.log("delete-mssql-configuration", "Delete a mssql configuration");
|
|
1913
1913
|
console.log("Parameters:");
|
|
1914
|
-
console.log("--id [
|
|
1914
|
+
console.log("--id [mssql_configuration_id]");
|
|
1915
1915
|
console.log();
|
|
1916
1916
|
console.log(
|
|
1917
|
-
"update-
|
|
1918
|
-
"Update a single
|
|
1917
|
+
"update-mssql-configuration",
|
|
1918
|
+
"Update a single mssql configuration."
|
|
1919
1919
|
);
|
|
1920
1920
|
console.log("Parameters:");
|
|
1921
1921
|
console.log("--id [configuration id]");
|
|
@@ -1929,7 +1929,10 @@ async function printHelp() {
|
|
|
1929
1929
|
console.log("--directory-auth (optional) ['SESSION' or NULL]");
|
|
1930
1930
|
console.log();
|
|
1931
1931
|
console.log();
|
|
1932
|
-
console.log(
|
|
1932
|
+
console.log(
|
|
1933
|
+
"update-mssql-configurations",
|
|
1934
|
+
"Bulk Update MS SQL Configurations."
|
|
1935
|
+
);
|
|
1933
1936
|
console.log("Parameters:");
|
|
1934
1937
|
console.log("--id [configuration id]");
|
|
1935
1938
|
console.log("--name or --configuration-name (optional) [unique name]");
|
|
@@ -1943,13 +1946,13 @@ async function printHelp() {
|
|
|
1943
1946
|
console.log("OR --json-updates [stringified json objects with your updates]");
|
|
1944
1947
|
console.log("For quick updates, you may use the above parameters");
|
|
1945
1948
|
console.log(
|
|
1946
|
-
`e.g. opscompass license-manager update-
|
|
1949
|
+
`e.g. opscompass license-manager update-mssql-configurations --id 31 --name "newname" --server "233.533.343" --user "joe" --action "skip" --id 25 --name "secondname" --action "skip" --action "dblicensing"`
|
|
1947
1950
|
);
|
|
1948
1951
|
console.log(
|
|
1949
1952
|
"For larger updates, JavaScript Object Notation (JSON) may be used with the --json-updates flag"
|
|
1950
1953
|
);
|
|
1951
1954
|
console.log(
|
|
1952
|
-
`e.g. opscompass license-manager update-
|
|
1955
|
+
`e.g. opscompass license-manager update-mssql-configurations --json-updates '[{\"id\":\"25\",\"configurationName\":\"25\", \"server\":\"100.232.2423\", \"user\":\"tony\", \"actions\":[\"skip\", \"dblicensing\"]}, {\"id\":\"31\",\"configurationName\":\"31\", \"server\":\"100.232.2423\", \"user\":\"tony\", \"actions\":[\"skip\", \"dblicensing\"]}]'`
|
|
1953
1956
|
);
|
|
1954
1957
|
console.log();
|
|
1955
1958
|
console.log(
|
|
@@ -2103,12 +2106,16 @@ const licenseManagerModule = (action, ...args) => {
|
|
|
2103
2106
|
case "update-oracle-shared-credential":
|
|
2104
2107
|
return updateOracleSharedCredential(args);
|
|
2105
2108
|
case "create-msql-shared-credential":
|
|
2109
|
+
case "create-mssql-shared-credential":
|
|
2106
2110
|
return createMsqlSharedCredential(args);
|
|
2107
2111
|
case "delete-msql-shared-credential":
|
|
2112
|
+
case "delete-mssql-shared-credential":
|
|
2108
2113
|
return deleteMsqlSharedCredential(args);
|
|
2109
2114
|
case "get-msql-default-credential":
|
|
2115
|
+
case "get-mssql-default-credential":
|
|
2110
2116
|
return getMsqlDefaultCredential(args);
|
|
2111
2117
|
case "update-msql-shared-credential":
|
|
2118
|
+
case "update-mssql-shared-credential":
|
|
2112
2119
|
return updateMsqlSharedCredential(args);
|
|
2113
2120
|
case "create-network-discovery-configuration":
|
|
2114
2121
|
return createNetworkDiscoveryConfiguration(args);
|
|
@@ -2143,10 +2150,13 @@ const licenseManagerModule = (action, ...args) => {
|
|
|
2143
2150
|
case "create-vcenter-configuration":
|
|
2144
2151
|
return createVCenterConfiguration(args);
|
|
2145
2152
|
case "list-msql-configurations":
|
|
2153
|
+
case "list-mssql-configurations":
|
|
2146
2154
|
return listMsqlConfigurations(args);
|
|
2147
2155
|
case "create-msql-configuration":
|
|
2156
|
+
case "create-mssql-configuration":
|
|
2148
2157
|
return createMsqlConfiguration(args);
|
|
2149
2158
|
case "get-msql-configuration":
|
|
2159
|
+
case "get-mssql-configuration":
|
|
2150
2160
|
return getMsqlConfiguration(args);
|
|
2151
2161
|
case "get-network-discovery-configuration":
|
|
2152
2162
|
return getNetworkDiscoveryConfiguration(args);
|
|
@@ -2177,10 +2187,13 @@ const licenseManagerModule = (action, ...args) => {
|
|
|
2177
2187
|
case "delete-vcenter-configuration":
|
|
2178
2188
|
return deleteVCenterConfiguration(args);
|
|
2179
2189
|
case "delete-msql-configuration":
|
|
2190
|
+
case "delete-mssql-configuration":
|
|
2180
2191
|
return deleteMsqlConfiguration(args);
|
|
2181
2192
|
case "update-msql-configuration":
|
|
2193
|
+
case "update-mssql-configuration":
|
|
2182
2194
|
return updateMsqlConfiguration(args);
|
|
2183
2195
|
case "update-msql-configurations":
|
|
2196
|
+
case "update-mssql-configurations":
|
|
2184
2197
|
return updateMsqlConfigurations(args);
|
|
2185
2198
|
case "get-mssql-entitlement-components":
|
|
2186
2199
|
return getMssqlEntitlementComponents(args);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opscompass/opscompass-cli",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.40",
|
|
4
4
|
"description": "Calls OpsCompass's APIs",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"author": "opscompass",
|
|
17
17
|
"license": "SEE LICENSE IN license.txt",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@opscompass/opscompass-api": "^1.0.
|
|
20
|
-
"adm-zip": "0.5.
|
|
19
|
+
"@opscompass/opscompass-api": "^1.0.40",
|
|
20
|
+
"adm-zip": "^0.5.16",
|
|
21
21
|
"axios": "^0.28.1",
|
|
22
|
-
"
|
|
22
|
+
"better-sqlite3": "^11.8.0",
|
|
23
|
+
"find-remove": "^5.0.0",
|
|
23
24
|
"fs-extra": "^10.1.0",
|
|
24
25
|
"https-proxy-agent": "^5.0.1",
|
|
25
26
|
"open": "^8.2.1",
|
|
26
27
|
"openpgp": "^5.11.0",
|
|
27
|
-
"semver": "^7.3.7"
|
|
28
|
-
"sqlite3": "^5.1.7"
|
|
28
|
+
"semver": "^7.3.7"
|
|
29
29
|
},
|
|
30
30
|
"bin": {
|
|
31
31
|
"opscompass": "index.js"
|