opal-security 2.0.17 → 2.0.18
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 +15 -15
- package/lib/lib/apollo.js +10 -4
- package/oclif.manifest.json +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ $ npm install -g opal-security
|
|
|
22
22
|
$ opal COMMAND
|
|
23
23
|
running command...
|
|
24
24
|
$ opal (-v|--version|version)
|
|
25
|
-
opal-security/2.0.
|
|
25
|
+
opal-security/2.0.18 darwin-x64 node-v14.16.1
|
|
26
26
|
$ opal --help [COMMAND]
|
|
27
27
|
USAGE
|
|
28
28
|
$ opal COMMAND
|
|
@@ -88,7 +88,7 @@ EXAMPLE
|
|
|
88
88
|
opal aws:identity
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
91
|
+
_See code: [src/commands/aws/identity.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/aws/identity.ts)_
|
|
92
92
|
|
|
93
93
|
## `opal curl-example`
|
|
94
94
|
|
|
@@ -102,7 +102,7 @@ OPTIONS
|
|
|
102
102
|
-h, --help show CLI help
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
-
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
105
|
+
_See code: [src/commands/curl-example.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/curl-example.ts)_
|
|
106
106
|
|
|
107
107
|
## `opal help [COMMAND]`
|
|
108
108
|
|
|
@@ -141,7 +141,7 @@ EXAMPLES
|
|
|
141
141
|
opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName "custom-profile"
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
-
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
144
|
+
_See code: [src/commands/iam-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/iam-roles/start.ts)_
|
|
145
145
|
|
|
146
146
|
## `opal kube-roles:start`
|
|
147
147
|
|
|
@@ -164,7 +164,7 @@ EXAMPLES
|
|
|
164
164
|
"arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role"
|
|
165
165
|
```
|
|
166
166
|
|
|
167
|
-
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
167
|
+
_See code: [src/commands/kube-roles/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/kube-roles/start.ts)_
|
|
168
168
|
|
|
169
169
|
## `opal login`
|
|
170
170
|
|
|
@@ -181,7 +181,7 @@ EXAMPLE
|
|
|
181
181
|
$ opal login
|
|
182
182
|
```
|
|
183
183
|
|
|
184
|
-
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
184
|
+
_See code: [src/commands/login.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/login.ts)_
|
|
185
185
|
|
|
186
186
|
## `opal logout`
|
|
187
187
|
|
|
@@ -198,7 +198,7 @@ EXAMPLE
|
|
|
198
198
|
$ opal logout
|
|
199
199
|
```
|
|
200
200
|
|
|
201
|
-
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
201
|
+
_See code: [src/commands/logout.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/logout.ts)_
|
|
202
202
|
|
|
203
203
|
## `opal postgres-instances:start`
|
|
204
204
|
|
|
@@ -220,7 +220,7 @@ EXAMPLES
|
|
|
220
220
|
opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId "fullaccess"
|
|
221
221
|
```
|
|
222
222
|
|
|
223
|
-
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
223
|
+
_See code: [src/commands/postgres-instances/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/postgres-instances/start.ts)_
|
|
224
224
|
|
|
225
225
|
## `opal resources:get`
|
|
226
226
|
|
|
@@ -238,7 +238,7 @@ EXAMPLE
|
|
|
238
238
|
opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4
|
|
239
239
|
```
|
|
240
240
|
|
|
241
|
-
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
241
|
+
_See code: [src/commands/resources/get.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/resources/get.ts)_
|
|
242
242
|
|
|
243
243
|
## `opal set-custom-header`
|
|
244
244
|
|
|
@@ -256,7 +256,7 @@ EXAMPLE
|
|
|
256
256
|
$ opal set-custom-header --header 'cf-access-token: $TOKEN'
|
|
257
257
|
```
|
|
258
258
|
|
|
259
|
-
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
259
|
+
_See code: [src/commands/set-custom-header.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/set-custom-header.ts)_
|
|
260
260
|
|
|
261
261
|
## `opal set-token`
|
|
262
262
|
|
|
@@ -273,7 +273,7 @@ EXAMPLE
|
|
|
273
273
|
$ opal set-token
|
|
274
274
|
```
|
|
275
275
|
|
|
276
|
-
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
276
|
+
_See code: [src/commands/set-token.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/set-token.ts)_
|
|
277
277
|
|
|
278
278
|
## `opal set-url`
|
|
279
279
|
|
|
@@ -297,7 +297,7 @@ EXAMPLE
|
|
|
297
297
|
$ opal set-url
|
|
298
298
|
```
|
|
299
299
|
|
|
300
|
-
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
300
|
+
_See code: [src/commands/set-url.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/set-url.ts)_
|
|
301
301
|
|
|
302
302
|
## `opal ssh:copyFrom`
|
|
303
303
|
|
|
@@ -324,7 +324,7 @@ EXAMPLES
|
|
|
324
324
|
opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
325
325
|
```
|
|
326
326
|
|
|
327
|
-
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
327
|
+
_See code: [src/commands/ssh/copyFrom.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/ssh/copyFrom.ts)_
|
|
328
328
|
|
|
329
329
|
## `opal ssh:copyTo`
|
|
330
330
|
|
|
@@ -351,7 +351,7 @@ EXAMPLES
|
|
|
351
351
|
opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
352
352
|
```
|
|
353
353
|
|
|
354
|
-
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
354
|
+
_See code: [src/commands/ssh/copyTo.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/ssh/copyTo.ts)_
|
|
355
355
|
|
|
356
356
|
## `opal ssh:start`
|
|
357
357
|
|
|
@@ -371,5 +371,5 @@ EXAMPLES
|
|
|
371
371
|
opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398
|
|
372
372
|
```
|
|
373
373
|
|
|
374
|
-
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.
|
|
374
|
+
_See code: [src/commands/ssh/start.ts](https://github.com/opalsecurity/opal-cli/blob/v2.0.18/src/commands/ssh/start.ts)_
|
|
375
375
|
<!-- commandsstop -->
|
package/lib/lib/apollo.js
CHANGED
|
@@ -4,9 +4,6 @@ exports.printRequestOutput = exports.initClient = exports.client = void 0;
|
|
|
4
4
|
const core_1 = require("@apollo/client/core");
|
|
5
5
|
const context_1 = require("@apollo/client/link/context");
|
|
6
6
|
const error_1 = require("@apollo/client/link/error");
|
|
7
|
-
const fetch = require('node-fetch');
|
|
8
|
-
const https = require('https');
|
|
9
|
-
const http = require('http');
|
|
10
7
|
const prettyjson_1 = require("prettyjson");
|
|
11
8
|
const config_1 = require("../lib/config");
|
|
12
9
|
const credentials_1 = require("../lib/credentials");
|
|
@@ -15,6 +12,9 @@ const semver_1 = require("semver");
|
|
|
15
12
|
const chalk_1 = require("chalk");
|
|
16
13
|
const cmd_1 = require("../lib/cmd");
|
|
17
14
|
const moment = require("moment");
|
|
15
|
+
const fetch = require('node-fetch');
|
|
16
|
+
const https = require('https');
|
|
17
|
+
const http = require('http');
|
|
18
18
|
exports.client = null;
|
|
19
19
|
exports.initClient = async (command) => {
|
|
20
20
|
const configDir = command.config.configDir;
|
|
@@ -43,8 +43,14 @@ exports.initClient = async (command) => {
|
|
|
43
43
|
},
|
|
44
44
|
});
|
|
45
45
|
const authLink = context_1.setContext((_, { headers }) => {
|
|
46
|
+
const baseHeaders = Object.assign(Object.assign({}, headers), { authorization: `Bearer ${accessToken}`, 'X-Opal-Organization-ID': organizationID });
|
|
47
|
+
if (customHeaderKey) {
|
|
48
|
+
return {
|
|
49
|
+
headers: Object.assign(Object.assign({}, baseHeaders), { [customHeaderKey]: customHeaderValue }),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
46
52
|
return {
|
|
47
|
-
headers: Object.assign(
|
|
53
|
+
headers: Object.assign({}, baseHeaders),
|
|
48
54
|
};
|
|
49
55
|
});
|
|
50
56
|
const checkCLIVersion = (operation) => {
|
package/oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"2.0.
|
|
1
|
+
{"version":"2.0.18","commands":{"curl-example":{"id":"curl-example","description":"Prints out an example cURL command containing the parameters the CLI uses to query the Opal server.","pluginName":"opal-security","pluginType":"core","aliases":[],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"login":{"id":"login","description":"Authenticates you with the Opal server.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["$ opal login"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"logout":{"id":"logout","description":"Clears locally stored Opal server authentication credentials.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["$ opal logout"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"set-custom-header":{"id":"set-custom-header","description":"Sets a custom HTTP header to connect to the Opal server.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["$ opal set-custom-header --header 'cf-access-token: $TOKEN'"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"header":{"name":"header","type":"option"}},"args":[]},"set-token":{"id":"set-token","description":"Sets an API token to authenticate with the Opal server - alternative auth flow for headless environments.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["$ opal set-token"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"set-url":{"id":"set-url","description":"Sets the url of the Opal server. Defaults to https://app.opal.dev.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["$ opal set-url"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"custom":{"name":"custom","type":"option"},"allowSelfSignedCerts":{"name":"allowSelfSignedCerts","type":"boolean","allowNo":false},"prod":{"name":"prod","type":"boolean","allowNo":false},"staging":{"name":"staging","type":"boolean","allowNo":false},"demo":{"name":"demo","type":"boolean","allowNo":false},"dev":{"name":"dev","type":"boolean","allowNo":false},"devLocal":{"name":"devLocal","type":"boolean","allowNo":false}},"args":[]},"aws:identity":{"id":"aws:identity","description":"Gets the current caller identity for the \"opal\" AWS profile.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal aws:identity"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false}},"args":[]},"iam-roles:start":{"id":"iam-roles:start","description":"Starts a session to assume an IAM role.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal iam-roles:start","opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398","opal iam-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --profileName \"custom-profile\""],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"id":{"name":"id","type":"option","description":"The ID of the Opal role resource."},"sessionId":{"name":"sessionId","type":"option","description":"SessionId of a session that has already been created via the web flow."},"profileName":{"name":"profileName","type":"option","description":"Uses a custom AWS profile name for the IAM role. Default value is the role's name."}},"args":[]},"kube-roles:start":{"id":"kube-roles:start","description":"Starts a session to assume a Kubernetes cluster IAM role.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal kube-roles:start","opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398","opal kube-roles:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId \"arn:aws:iam::712234975475:role/acme-eks-cluster-admin-role\""],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"id":{"name":"id","type":"option","description":"The ID of the Opal role resource."},"accessLevelRemoteId":{"name":"accessLevelRemoteId","type":"option","description":"The remote ID of the access level with which to access the cluster."},"sessionId":{"name":"sessionId","type":"option","description":"SessionId of a session that has already been created via the web flow."}},"args":[]},"postgres-instances:start":{"id":"postgres-instances:start","description":"Starts a session to query a Postgres database.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal postgres-instances:start","opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398","opal postgres-instances:start --id 51f7176b-0464-4a6f-8369-e951e187b398 --accessLevelRemoteId \"fullaccess\""],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"id":{"name":"id","type":"option","description":"The ID of the Opal instance resource."},"accessLevelRemoteId":{"name":"accessLevelRemoteId","type":"option","description":"The remote ID of the access level with which to access the database."},"sessionId":{"name":"sessionId","type":"option","description":"SessionId of a session that has already been created via the web flow."}},"args":[]},"resources:get":{"id":"resources:get","description":"Get resource info for a particular resource.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal resources:get --id 54052a3e-5375-4392-aeaf-0c6c44c131d4"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"id":{"name":"id","type":"option","required":true}},"args":[]},"ssh:copyFrom":{"id":"ssh:copyFrom","description":"Use SCP to copy files from a compute instance.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal ssh:copyFrom --src instance/dir --dest my/dir","opal ssh:copyFrom --src instance/dir --dest my/dir --id 51f7176b-0464-4a6f-8369-e951e187b398"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"src":{"name":"src","type":"option","description":"The path of the directory or file you would like to copy over SCP. Note we only support one file or directory at a time.","required":true},"dest":{"name":"dest","type":"option","description":"Pick which directory you want your files to be copied to.","required":false,"default":"."},"user":{"name":"user","type":"option","description":"Pick which user you want to run SCP over. Keep in mind not all users will have access to each other's home directory.","required":false,"default":"ssm-user"},"id":{"name":"id","type":"option","description":"The ID of the Opal instance resource."},"sessionId":{"name":"sessionId","type":"option","description":"SessionId of a session that has already been created via the web flow."}},"args":[]},"ssh:copyTo":{"id":"ssh:copyTo","description":"Use SCP to copy files to a compute instance.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal ssh:copyTo --src my/dir --dest instance/dir","opal ssh:copyTo --src my/dir --dest instance/dir --id 51f7176b-0464-4a6f-8369-e951e187b398"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"src":{"name":"src","type":"option","description":"The path of the directory or file you would like to copy over SCP. Note we only support one file or directory at a time.","required":true},"dest":{"name":"dest","type":"option","description":"Pick which directory you want your files to be copied to.","required":false,"default":"."},"user":{"name":"user","type":"option","description":"Pick which user you want to run SCP over. Keep in mind not all users will have access to each other's home directory.","required":false,"default":"ssm-user"},"id":{"name":"id","type":"option","description":"The ID of the Opal instance resource."},"sessionId":{"name":"sessionId","type":"option","description":"SessionId of a session that has already been created via the web flow."}},"args":[]},"ssh:start":{"id":"ssh:start","description":"Start an SSH session to access a particular compute instance.","pluginName":"opal-security","pluginType":"core","aliases":[],"examples":["opal ssh:start","opal ssh:start --id 51f7176b-0464-4a6f-8369-e951e187b398"],"flags":{"help":{"name":"help","type":"boolean","char":"h","description":"show CLI help","allowNo":false},"id":{"name":"id","type":"option","description":"The ID of the Opal instance resource."},"sessionId":{"name":"sessionId","type":"option","description":"SessionId of a session that has already been created via the web flow."}},"args":[]}}}
|