@p0security/cli 0.18.10 → 0.18.12
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/README.md +8 -0
- package/build/dist/commands/ls.js +21 -23
- package/build/dist/commands/ls.js.map +1 -1
- package/build/dist/commands/shared/ssh.d.ts +6 -2
- package/build/dist/commands/shared/ssh.js +5 -5
- package/build/dist/commands/shared/ssh.js.map +1 -1
- package/build/dist/commands/ssh-resolve.js +9 -3
- package/build/dist/commands/ssh-resolve.js.map +1 -1
- package/build/dist/common/__mocks__/keys.d.ts +2 -0
- package/build/dist/common/__mocks__/keys.js +5 -1
- package/build/dist/common/__mocks__/keys.js.map +1 -1
- package/build/dist/common/keys.d.ts +15 -0
- package/build/dist/common/keys.js +85 -8
- package/build/dist/common/keys.js.map +1 -1
- package/build/dist/drivers/api.d.ts +6 -6
- package/build/dist/drivers/api.js +53 -51
- package/build/dist/drivers/api.js.map +1 -1
- package/build/dist/opentelemetry/instrumentation.js +6 -14
- package/build/dist/opentelemetry/instrumentation.js.map +1 -1
- package/build/dist/plugins/aws/idc/index.js +5 -1
- package/build/dist/plugins/aws/idc/index.js.map +1 -1
- package/build/dist/plugins/aws/ssh.js +15 -4
- package/build/dist/plugins/aws/ssh.js.map +1 -1
- package/build/dist/plugins/aws/types.d.ts +2 -0
- package/build/dist/plugins/azure/keygen.d.ts +0 -4
- package/build/dist/plugins/azure/keygen.js +1 -13
- package/build/dist/plugins/azure/keygen.js.map +1 -1
- package/build/dist/plugins/azure/ssh.js +6 -5
- package/build/dist/plugins/azure/ssh.js.map +1 -1
- package/build/dist/plugins/google/ssh.js +1 -1
- package/build/dist/plugins/google/ssh.js.map +1 -1
- package/build/dist/plugins/self-hosted/keygen.d.ts +6 -0
- package/build/dist/plugins/self-hosted/keygen.js +39 -0
- package/build/dist/plugins/self-hosted/keygen.js.map +1 -0
- package/build/dist/plugins/self-hosted/ssh.d.ts +1 -0
- package/build/dist/plugins/self-hosted/ssh.js +55 -16
- package/build/dist/plugins/self-hosted/ssh.js.map +1 -1
- package/build/dist/plugins/ssh/index.js +11 -5
- package/build/dist/plugins/ssh/index.js.map +1 -1
- package/build/dist/plugins/ssh/shared.d.ts +4 -0
- package/build/dist/plugins/ssh/shared.js +38 -0
- package/build/dist/plugins/ssh/shared.js.map +1 -0
- package/build/dist/types/ssh.d.ts +11 -3
- package/build/tsconfig.tsbuildinfo +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -74,6 +74,14 @@ You can now request access via
|
|
|
74
74
|
p0 request
|
|
75
75
|
```
|
|
76
76
|
|
|
77
|
+
#### Using Non-Firebase Auth Tokens
|
|
78
|
+
|
|
79
|
+
By default, the CLI performs a login with your auth issuer, then exchanges that token
|
|
80
|
+
with firebase for a firebase token to use with the API.
|
|
81
|
+
|
|
82
|
+
To use your auth issuer's token directly, set `ssoPassthrough` to `true` in your org's
|
|
83
|
+
discover doc.
|
|
84
|
+
|
|
77
85
|
## CLI Reference
|
|
78
86
|
|
|
79
87
|
### Usage
|
|
@@ -37,6 +37,11 @@ const lsArgs = (yargs) => yargs
|
|
|
37
37
|
array: true,
|
|
38
38
|
string: true,
|
|
39
39
|
default: [],
|
|
40
|
+
})
|
|
41
|
+
.option("size", {
|
|
42
|
+
type: "number",
|
|
43
|
+
default: DEFAULT_RESPONSE_SIZE,
|
|
44
|
+
description: "Number of results to return",
|
|
40
45
|
})
|
|
41
46
|
.option("json", {
|
|
42
47
|
type: "boolean",
|
|
@@ -45,43 +50,36 @@ const lsArgs = (yargs) => yargs
|
|
|
45
50
|
});
|
|
46
51
|
const lsCommand = (yargs) => yargs.command("ls [arguments..]", "List request-command arguments", lsArgs, ls);
|
|
47
52
|
exports.lsCommand = lsCommand;
|
|
48
|
-
/**
|
|
49
|
-
* If the user has requested a size, replace it with double the requested size,
|
|
50
|
-
* otherwise request double the default.
|
|
51
|
-
*
|
|
52
|
-
* This is done so that we can give the user a sense of the number of results
|
|
53
|
-
* that are not displayed.
|
|
54
|
-
*/
|
|
55
|
-
const convertLsSizeArg = (args) => {
|
|
56
|
-
var _a;
|
|
57
|
-
const convertedArgs = [...args];
|
|
58
|
-
const sizeIndex = convertedArgs.findIndex((a) => a === "--size");
|
|
59
|
-
const requestedSize = +((_a = (sizeIndex >= 0
|
|
60
|
-
? (0, lodash_1.pullAt)(convertedArgs, sizeIndex, sizeIndex + 1)[1]
|
|
61
|
-
: undefined)) !== null && _a !== void 0 ? _a : DEFAULT_RESPONSE_SIZE);
|
|
62
|
-
convertedArgs.push("--size", String(requestedSize * 2));
|
|
63
|
-
return { convertedArgs, requestedSize };
|
|
64
|
-
};
|
|
65
53
|
const ls = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
54
|
const authn = yield (0, auth_1.authenticate)();
|
|
67
|
-
const { convertedArgs, requestedSize } = convertLsSizeArg(args.arguments);
|
|
68
55
|
const isAdminCommand = args.arguments.includes("--all") || args.arguments.includes("--principal");
|
|
69
56
|
const command = isAdminCommand ? api_1.fetchAdminLsCommand : api_1.fetchCommand;
|
|
70
|
-
const
|
|
57
|
+
const allArguments = [
|
|
58
|
+
...args._,
|
|
59
|
+
...args.arguments,
|
|
60
|
+
/**
|
|
61
|
+
* If the user has requested a size, replace it with double the requested size,
|
|
62
|
+
* otherwise request double the default.
|
|
63
|
+
*
|
|
64
|
+
* This is done so that we can give the user a sense of the number of results
|
|
65
|
+
* that are not displayed.
|
|
66
|
+
*/
|
|
67
|
+
...(args.size ? ["--size", args.size * 2] : []),
|
|
68
|
+
].map(String); // make sure all elements are strings to satisfy command line args
|
|
69
|
+
const responsePromise = command(authn, args, allArguments);
|
|
71
70
|
const data = yield (0, stdio_1.spinUntil)("Listing accessible resources", responsePromise);
|
|
72
71
|
if (data && "ok" in data && data.ok) {
|
|
73
72
|
if (args.json) {
|
|
74
73
|
(0, stdio_1.print1)(JSON.stringify(data, null, 2));
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
const allArguments = [...args._, ...args.arguments];
|
|
78
76
|
const label = (0, pluralize_1.default)(data.arg);
|
|
79
77
|
if (data.items.length === 0) {
|
|
80
78
|
(0, stdio_1.print2)(`No ${label}`);
|
|
81
79
|
return;
|
|
82
80
|
}
|
|
83
|
-
const truncationPart = data.items.length >
|
|
84
|
-
? ` the first ${
|
|
81
|
+
const truncationPart = data.items.length > args.size
|
|
82
|
+
? ` the first ${args.size} (of ${data.isTruncated ? "many" : data.items.length})`
|
|
85
83
|
: "";
|
|
86
84
|
const postfixPart = data.term
|
|
87
85
|
? ` matching '${data.term}'`
|
|
@@ -89,7 +87,7 @@ const ls = (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
89
87
|
? ` (use \`p0 ${allArguments.join(" ")} <like>\` to narrow results)`
|
|
90
88
|
: "";
|
|
91
89
|
(0, stdio_1.print2)(`Showing${truncationPart} ${label}${postfixPart}.\nResources labeled with * are already accessible to you:`);
|
|
92
|
-
const truncated = (0, lodash_1.slice)(data.items, 0,
|
|
90
|
+
const truncated = (0, lodash_1.slice)(data.items, 0, args.size);
|
|
93
91
|
const sortedItems = (0, lodash_1.orderBy)(truncated, "isPreexisting", "desc");
|
|
94
92
|
const isSameValue = sortedItems.every((i) => !i.group && i.key === i.value);
|
|
95
93
|
const maxLength = (0, lodash_1.max)(sortedItems.map((i) => i.key.length)) || 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/commands/ls.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,0CAA0C;AAC1C,wCAAmE;AACnE,0CAA+C;AAC/C,4CAA6D;AAC7D,
|
|
1
|
+
{"version":3,"file":"ls.js","sourceRoot":"","sources":["../../../src/commands/ls.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,0CAA0C;AAC1C,wCAAmE;AACnE,0CAA+C;AAC/C,4CAA6D;AAC7D,mCAA6C;AAC7C,0D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IAAI,CAAC;KACZ;AACH,CAAC,CAAA,CAAC"}
|
|
@@ -36,9 +36,9 @@ export type SshAdditionalSetup = {
|
|
|
36
36
|
/** A list of SSH configuration options, as would be used after '-o' in an SSH command */
|
|
37
37
|
sshOptions: string[];
|
|
38
38
|
/** The path to the private key file to use for the SSH connection, instead of the default P0 CLI managed key */
|
|
39
|
-
identityFile
|
|
39
|
+
identityFile?: string;
|
|
40
40
|
/** The port to connect to, overriding the default */
|
|
41
|
-
port
|
|
41
|
+
port?: string;
|
|
42
42
|
/** Perform any teardown required after the SSH command exits but before terminating the P0 CLI */
|
|
43
43
|
teardown: () => Promise<void>;
|
|
44
44
|
};
|
|
@@ -57,6 +57,10 @@ export declare const prepareRequest: (authn: Authn, args: yargs.ArgumentsCamelCa
|
|
|
57
57
|
request: any;
|
|
58
58
|
sshProvider: SshProvider<any, any, any, any>;
|
|
59
59
|
provisionedRequest: PermissionRequest<PluginSshRequest>;
|
|
60
|
+
hostKeys: {
|
|
61
|
+
alias: string;
|
|
62
|
+
path: string;
|
|
63
|
+
} | undefined;
|
|
60
64
|
requestId: string;
|
|
61
65
|
publicKey: string;
|
|
62
66
|
privateKey: string;
|
|
@@ -95,7 +95,7 @@ const provisionRequest = (authn, args, destination, approvedOnly, quiet) => __aw
|
|
|
95
95
|
});
|
|
96
96
|
exports.provisionRequest = provisionRequest;
|
|
97
97
|
const prepareRequest = (authn, args, destination, approvedOnly, quiet) => __awaiter(void 0, void 0, void 0, function* () {
|
|
98
|
-
var _a;
|
|
98
|
+
var _a, _b;
|
|
99
99
|
const result = yield (0, exports.provisionRequest)(authn, args, destination, approvedOnly, quiet);
|
|
100
100
|
if (!result) {
|
|
101
101
|
throw `Server did not return a request id. ${(0, config_1.getContactMessage)()}`;
|
|
@@ -104,11 +104,11 @@ const prepareRequest = (authn, args, destination, approvedOnly, quiet) => __awai
|
|
|
104
104
|
const sshProvider = exports.SSH_PROVIDERS[provisionedRequest.permission.provider];
|
|
105
105
|
yield ((_a = sshProvider.submitPublicKey) === null || _a === void 0 ? void 0 : _a.call(sshProvider, authn, provisionedRequest, requestId, publicKey));
|
|
106
106
|
yield sshProvider.ensureInstall();
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
});
|
|
107
|
+
const options = { debug: args.debug };
|
|
108
|
+
const cliRequest = yield pluginToCliRequest(provisionedRequest, options);
|
|
110
109
|
const request = sshProvider.requestToSsh(cliRequest);
|
|
111
|
-
|
|
110
|
+
const hostKeys = yield ((_b = sshProvider.saveHostKeys) === null || _b === void 0 ? void 0 : _b.call(sshProvider, request, options));
|
|
111
|
+
return Object.assign(Object.assign({}, result), { request, sshProvider, provisionedRequest, hostKeys });
|
|
112
112
|
});
|
|
113
113
|
exports.prepareRequest = prepareRequest;
|
|
114
114
|
//# sourceMappingURL=ssh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh.js","sourceRoot":"","sources":["../../../../src/commands/shared/ssh.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,wBAA0C;AAC1C,4CAAkD;AAClD,2CAA2D;AAC3D,iDAAyD;AACzD,+CAA6C;AAC7C,+CAAuD;AACvD,iDAA2D;AAC3D,kDAA0D;AAC1D,uDAAsE;AAItE,yCAMyB;AACzB,uCAAoC;AACpC,mCAA8B;AAC9B,2CAAiC;AAqDpB,QAAA,aAAa,GAGtB;IACF,GAAG,EAAE,oBAAc;IACnB,KAAK,EAAE,sBAAgB;IACvB,MAAM,EAAE,oBAAc;IACtB,aAAa,EAAE,2BAAqB;CACrC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CACzB,KAAY,EACZ,IAAkD,EAClD,EAAE;IACF,MAAM,SAAS,GAAG,MAAM,IAAA,4BAAsB,EAC5C,KAAK,EACL,KAAK,CACN,CAAC;IACF,MAAM,WAAW,GAAG,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAEnD,MAAM,gBAAg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CAAC;IACtC,MAAM,UAAU,GAAG,MAAM,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;IAEzE,MAAM,OAAO,GAAG,WAAW,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAErD,MAAM,QAAQ,GAAG,MAAM,CAAA,MAAA,WAAW,CAAC,YAAY,4DAAG,OAAO,EAAE,OAAO,CAAC,CAAA,CAAC;IAEpE,uCAAY,MAAM,KAAE,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,QAAQ,IAAG;AAC3E,CAAC,CAAA,CAAC;AAvCW,QAAA,cAAc,kBAuCzB"}
|
|
@@ -92,12 +92,13 @@ const sshResolveAction = (args) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
92
92
|
noRefresh: true,
|
|
93
93
|
debug: args.debug,
|
|
94
94
|
}).catch(silentlyExit);
|
|
95
|
-
const { request, requestId, provisionedRequest } = yield (0, ssh_1.prepareRequest)(authn, args, args.destination, true, args.quiet).catch(requestErrorHandler);
|
|
95
|
+
const { request, requestId, provisionedRequest, hostKeys } = yield (0, ssh_1.prepareRequest)(authn, args, args.destination, true, args.quiet).catch(requestErrorHandler);
|
|
96
96
|
const sshProvider = ssh_1.SSH_PROVIDERS[provisionedRequest.permission.provider];
|
|
97
97
|
if (args.debug) {
|
|
98
98
|
(0, stdio_1.print2)("Generating Keys");
|
|
99
99
|
}
|
|
100
|
-
const keys = yield ((_b = sshProvider === null || sshProvider === void 0 ? void 0 : sshProvider.generateKeys) === null || _b === void 0 ? void 0 : _b.call(sshProvider, provisionedRequest.permission.resource, {
|
|
100
|
+
const keys = yield ((_b = sshProvider === null || sshProvider === void 0 ? void 0 : sshProvider.generateKeys) === null || _b === void 0 ? void 0 : _b.call(sshProvider, authn, provisionedRequest.permission.resource, {
|
|
101
|
+
requestId,
|
|
101
102
|
debug: args.debug,
|
|
102
103
|
}));
|
|
103
104
|
const tmpFile = tmp_promise_1.default.fileSync();
|
|
@@ -109,6 +110,9 @@ const sshResolveAction = (args) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
109
110
|
const certificateInfo = (keys === null || keys === void 0 ? void 0 : keys.certificatePath)
|
|
110
111
|
? `CertificateFile ${keys.certificatePath}`
|
|
111
112
|
: "";
|
|
113
|
+
const hostKeysInfo = hostKeys
|
|
114
|
+
? `UserKnownHostsFile ${hostKeys.path}\nHostKeyAlias ${hostKeys.alias}`
|
|
115
|
+
: "";
|
|
112
116
|
const appPath = (0, util_1.getAppPath)();
|
|
113
117
|
// The config file name must be a valid file name (without forward slashes) so we can create it.
|
|
114
118
|
// The config file will be deleted by the ssh-proxy command. Sanitization here and upon deletion must match.
|
|
@@ -124,7 +128,9 @@ const sshResolveAction = (args) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
124
128
|
IdentityFile ${identityFile}
|
|
125
129
|
${certificateInfo}
|
|
126
130
|
PasswordAuthentication no
|
|
127
|
-
ProxyCommand ${appPath} ssh-proxy %h --port %p --provider ${provisionedRequest.permission.provider} --identity-file ${identityFile} --request-json ${tmpFile.name} ${args.debug ? "--debug" : ""}
|
|
131
|
+
ProxyCommand ${appPath} ssh-proxy %h --port %p --provider ${provisionedRequest.permission.provider} --identity-file ${identityFile} --request-json ${tmpFile.name} ${args.debug ? "--debug" : ""}
|
|
132
|
+
${hostKeysInfo}
|
|
133
|
+
`;
|
|
128
134
|
yield fs_1.default.promises.mkdir(path_1.default.join(util_1.P0_PATH, "ssh", "configs"), {
|
|
129
135
|
recursive: true,
|
|
130
136
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ssh-resolve.js","sourceRoot":"","sources":["../../../src/commands/ssh-resolve.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,uDAA2D;AAC3D,yCAAkD;AAClD,0CAA+C;AAC/C,4CAA0C;AAC1C,kCAA2E;AAC3E,sCAIsB;AACtB,4CAAoB;AACpB,gDAAwB;AACxB,8DAA8B;AAC9B,2CAAiC;A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copy of the GNU General Public License along with @p0
|
|
|
11
11
|
**/
|
|
12
12
|
export declare const TEST_PUBLIC_KEY = "test-public-key";
|
|
13
13
|
export declare const createKeyPair: jest.Mock<any, any, any>;
|
|
14
|
+
export declare const saveHostKeys: jest.Mock<any, any, any>;
|
|
15
|
+
export declare const getKnownHostsFilePath: jest.Mock<any, any, any>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createKeyPair = exports.TEST_PUBLIC_KEY = void 0;
|
|
3
|
+
exports.getKnownHostsFilePath = exports.saveHostKeys = exports.createKeyPair = exports.TEST_PUBLIC_KEY = void 0;
|
|
4
4
|
/** Copyright © 2024-present P0 Security
|
|
5
5
|
|
|
6
6
|
This file is part of @p0security/cli
|
|
@@ -16,4 +16,8 @@ exports.createKeyPair = jest.fn().mockImplementation(() => ({
|
|
|
16
16
|
publicKey: "test-public-key",
|
|
17
17
|
privateKey: "test-private-key",
|
|
18
18
|
}));
|
|
19
|
+
exports.saveHostKeys = jest.fn().mockResolvedValue(undefined);
|
|
20
|
+
exports.getKnownHostsFilePath = jest
|
|
21
|
+
.fn()
|
|
22
|
+
.mockReturnValue("/mock/path/to/known_hosts/instance");
|
|
19
23
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../src/common/__mocks__/keys.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACU,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,aAAa,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/D,SAAS,EAAE,iBAAiB;IAC5B,UAAU,EAAE,kBAAkB;CAC/B,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../../src/common/__mocks__/keys.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACU,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,aAAa,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC;IAC/D,SAAS,EAAE,iBAAiB;IAC5B,UAAU,EAAE,kBAAkB;CAC/B,CAAC,CAAC,CAAC;AACS,QAAA,YAAY,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACtD,QAAA,qBAAqB,GAAG,IAAI;KACtC,EAAE,EAAE;KACJ,eAAe,CAAC,oCAAoC,CAAC,CAAC"}
|
|
@@ -8,3 +8,18 @@ export declare const createKeyPair: () => Promise<{
|
|
|
8
8
|
publicKey: string;
|
|
9
9
|
privateKey: string;
|
|
10
10
|
}>;
|
|
11
|
+
export declare const KNOWN_HOSTS_DIR: string;
|
|
12
|
+
export declare const KNOWN_HOSTS_PATH: string;
|
|
13
|
+
/**
|
|
14
|
+
* Save host keys to separate files in the P0 SSH known_hosts directory
|
|
15
|
+
* - Creates a separate file for each host in known_hosts/ directory
|
|
16
|
+
* - Replaces the entire file with the most up-to-date host keys for that host
|
|
17
|
+
* - Creates an SSH config file that includes all host key files
|
|
18
|
+
*/
|
|
19
|
+
export declare const saveHostKeys: (instanceId: string, hostKeys: string[], options?: {
|
|
20
|
+
debug?: boolean;
|
|
21
|
+
}) => Promise<string | undefined>;
|
|
22
|
+
/**
|
|
23
|
+
* Get the known_hosts file path for a specific instance ID
|
|
24
|
+
*/
|
|
25
|
+
export declare const getKnownHostsFilePath: (instanceId: string) => string;
|
|
@@ -31,11 +31,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.createKeyPair = exports.PRIVATE_KEY_PATH = exports.PUBLIC_KEY_PATH = exports.P0_KEY_FOLDER = void 0;
|
|
35
|
+
exports.getKnownHostsFilePath = exports.saveHostKeys = exports.KNOWN_HOSTS_PATH = exports.KNOWN_HOSTS_DIR = exports.createKeyPair = exports.PRIVATE_KEY_PATH = exports.PUBLIC_KEY_PATH = exports.P0_KEY_FOLDER = void 0;
|
|
39
36
|
/** Copyright © 2024-present P0 Security
|
|
40
37
|
|
|
41
38
|
This file is part of @p0security/cli
|
|
@@ -46,9 +43,10 @@ This file is part of @p0security/cli
|
|
|
46
43
|
|
|
47
44
|
You should have received a copy of the GNU General Public License along with @p0security/cli. If not, see <https://www.gnu.org/licenses/>.
|
|
48
45
|
**/
|
|
46
|
+
const stdio_1 = require("../drivers/stdio");
|
|
49
47
|
const util_1 = require("../util");
|
|
48
|
+
const crypto = __importStar(require("crypto"));
|
|
50
49
|
const fs = __importStar(require("fs/promises"));
|
|
51
|
-
const node_forge_1 = __importDefault(require("node-forge"));
|
|
52
50
|
const path = __importStar(require("path"));
|
|
53
51
|
exports.P0_KEY_FOLDER = path.join(util_1.P0_PATH, "ssh");
|
|
54
52
|
exports.PUBLIC_KEY_PATH = path.join(exports.P0_KEY_FOLDER, "id_rsa.pub");
|
|
@@ -64,9 +62,14 @@ const createKeyPair = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
64
62
|
return { publicKey, privateKey };
|
|
65
63
|
}
|
|
66
64
|
else {
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
|
|
65
|
+
const keyPair = crypto.generateKeyPairSync("rsa", {
|
|
66
|
+
modulusLength: 2048,
|
|
67
|
+
});
|
|
68
|
+
const privateKey = keyPair.privateKey.export({
|
|
69
|
+
type: "pkcs8",
|
|
70
|
+
format: "pem",
|
|
71
|
+
});
|
|
72
|
+
const publicKey = toOpenSshFormat(keyPair.publicKey);
|
|
70
73
|
yield fs.mkdir(path.dirname(exports.PUBLIC_KEY_PATH), { recursive: true });
|
|
71
74
|
yield fs.writeFile(exports.PUBLIC_KEY_PATH, publicKey, { mode: 0o600 });
|
|
72
75
|
yield fs.writeFile(exports.PRIVATE_KEY_PATH, privateKey, { mode: 0o600 });
|
|
@@ -83,4 +86,78 @@ const fileExists = (path) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
83
86
|
return false;
|
|
84
87
|
}
|
|
85
88
|
});
|
|
89
|
+
/**
|
|
90
|
+
* Convert a crypto.KeyObject RSA public key to OpenSSH format
|
|
91
|
+
*/
|
|
92
|
+
const toOpenSshFormat = (keyObject) => {
|
|
93
|
+
// Export the key in JWK format to get n and e values
|
|
94
|
+
const jwk = keyObject.export({ format: "jwk" });
|
|
95
|
+
// Convert base64url to buffer
|
|
96
|
+
const nBuffer = Buffer.from(jwk.n, "base64url");
|
|
97
|
+
const eBuffer = Buffer.from(jwk.e, "base64url");
|
|
98
|
+
// Create SSH wire format
|
|
99
|
+
const keyType = "ssh-rsa";
|
|
100
|
+
const keyTypeBuffer = Buffer.from(keyType);
|
|
101
|
+
// SSH wire format: [key_type_len][key_type][e_len][e][n_len][n]
|
|
102
|
+
const keyTypeLen = Buffer.alloc(4);
|
|
103
|
+
keyTypeLen.writeUInt32BE(keyTypeBuffer.length, 0);
|
|
104
|
+
const eLen = Buffer.alloc(4);
|
|
105
|
+
eLen.writeUInt32BE(eBuffer.length, 0);
|
|
106
|
+
const nLen = Buffer.alloc(4);
|
|
107
|
+
nLen.writeUInt32BE(nBuffer.length, 0);
|
|
108
|
+
const sshWireFormat = Buffer.concat([
|
|
109
|
+
keyTypeLen,
|
|
110
|
+
keyTypeBuffer,
|
|
111
|
+
eLen,
|
|
112
|
+
eBuffer,
|
|
113
|
+
nLen,
|
|
114
|
+
nBuffer,
|
|
115
|
+
]);
|
|
116
|
+
// Base64 encode and format as OpenSSH key
|
|
117
|
+
const base64Key = sshWireFormat.toString("base64");
|
|
118
|
+
return `${keyType} ${base64Key} p0-generated-key`;
|
|
119
|
+
};
|
|
120
|
+
exports.KNOWN_HOSTS_DIR = path.join(exports.P0_KEY_FOLDER, "known_hosts");
|
|
121
|
+
exports.KNOWN_HOSTS_PATH = path.join(exports.P0_KEY_FOLDER, "known_hosts_config");
|
|
122
|
+
/**
|
|
123
|
+
* Save host keys to separate files in the P0 SSH known_hosts directory
|
|
124
|
+
* - Creates a separate file for each host in known_hosts/ directory
|
|
125
|
+
* - Replaces the entire file with the most up-to-date host keys for that host
|
|
126
|
+
* - Creates an SSH config file that includes all host key files
|
|
127
|
+
*/
|
|
128
|
+
const saveHostKeys = (instanceId, hostKeys, options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
129
|
+
if (!hostKeys || hostKeys.length === 0) {
|
|
130
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
131
|
+
(0, stdio_1.print2)("No host keys provided, skipping saving of host keys");
|
|
132
|
+
}
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
136
|
+
(0, stdio_1.print2)(`Processing ${hostKeys.length} host keys`);
|
|
137
|
+
(0, stdio_1.print2)(`Known hosts directory: ${exports.KNOWN_HOSTS_DIR}`);
|
|
138
|
+
}
|
|
139
|
+
yield fs.mkdir(exports.KNOWN_HOSTS_DIR, { recursive: true });
|
|
140
|
+
const hostFilePath = (0, exports.getKnownHostsFilePath)(instanceId);
|
|
141
|
+
// Always overwrite the file with the latest host keys
|
|
142
|
+
if (yield fileExists(hostFilePath)) {
|
|
143
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
144
|
+
(0, stdio_1.print2)(`Host keys file for instance ${instanceId} already exists, overwriting`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
const content = hostKeys.join("\n") + "\n";
|
|
148
|
+
yield fs.writeFile(hostFilePath, content, { mode: 0o600 });
|
|
149
|
+
if (options === null || options === void 0 ? void 0 : options.debug) {
|
|
150
|
+
(0, stdio_1.print2)(`Saved ${hostKeys.length} host keys for instance ${instanceId} to ${hostFilePath}`);
|
|
151
|
+
}
|
|
152
|
+
return hostFilePath;
|
|
153
|
+
});
|
|
154
|
+
exports.saveHostKeys = saveHostKeys;
|
|
155
|
+
/**
|
|
156
|
+
* Get the known_hosts file path for a specific instance ID
|
|
157
|
+
*/
|
|
158
|
+
const getKnownHostsFilePath = (instanceId) => {
|
|
159
|
+
const sanitizedId = instanceId.replace(/[^a-zA-Z0-9.-]/g, "_");
|
|
160
|
+
return path.join(exports.KNOWN_HOSTS_DIR, sanitizedId);
|
|
161
|
+
};
|
|
162
|
+
exports.getKnownHostsFilePath = getKnownHostsFilePath;
|
|
86
163
|
//# sourceMappingURL=keys.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/common/keys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"keys.js","sourceRoot":"","sources":["../../../src/common/keys.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,4CAA0C;AAC1C,kCAAkC;AAClC,+CAAiC;AACjC,gDAAkC;AAClC,2CAA6B;AAEhB,QAAA,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAO,EAAE,KAAK,CAAC,CAAC;AAC1C,QAAA,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAa,EAAE,YAAY,CAAC,CAAC;AACzD,QAAA,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,qBAAa,EAAE,QAAQ,CAAC,CAAC;AAEnE;;GAEG;AACI,MAAM,aAAa,GAAG,GAG1B,EAAE;IACH,IACE,CAAC,MAAM,UAAU,CAAC,uBAAe,CAAC,CAAC;QACnC,CAAC,MAAM,UAAU,CAAC,wBAAgB,CAAC,CAAC,EACpC;QAC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Y,EAAE,CACnF,CAAC;KACH;IACD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAA,CAAC;AAvCW,QAAA,YAAY,gBAuCvB;AAEF;;GAEG;AACI,MAAM,qBAAqB,GAAG,CAAC,UAAkB,EAAU,EAAE;IAClE,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IAC/D,OAAO,IAAI,CAAC,IAAI,CAAC,uBAAe,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC,CAAC;AAHW,QAAA,qBAAqB,yBAGhC"}
|
|
@@ -23,6 +23,12 @@ export declare const submitPublicKey: <T>(authn: Authn, args: {
|
|
|
23
23
|
publicKey: string;
|
|
24
24
|
requestId: string;
|
|
25
25
|
}) => Promise<T>;
|
|
26
|
+
export declare const certificateSigningRequest: (authn: Authn, args: {
|
|
27
|
+
publicKey: string;
|
|
28
|
+
requestId: string;
|
|
29
|
+
}) => Promise<{
|
|
30
|
+
signedCertificate: string;
|
|
31
|
+
}>;
|
|
26
32
|
export declare const fetchWithStreaming: <T>(authn: Authn, args: {
|
|
27
33
|
url: string;
|
|
28
34
|
method: string;
|
|
@@ -36,9 +42,3 @@ export declare const auditSshSessionActivity: (args: {
|
|
|
36
42
|
action: `ssh.session.${"end" | "start"}`;
|
|
37
43
|
debug: boolean | undefined;
|
|
38
44
|
}) => Promise<void>;
|
|
39
|
-
export declare const baseFetch: <T>(authn: Authn, args: {
|
|
40
|
-
url: string;
|
|
41
|
-
method: string;
|
|
42
|
-
body?: string;
|
|
43
|
-
maxTimeoutMs?: number;
|
|
44
|
-
}) => Promise<T>;
|