praetorian-cli 2.1.2__tar.gz → 2.1.3__tar.gz

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 (85) hide show
  1. {praetorian_cli-2.1.2/praetorian_cli.egg-info → praetorian_cli-2.1.3}/PKG-INFO +25 -19
  2. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/README.md +24 -18
  3. praetorian_cli-2.1.3/praetorian_cli/handlers/configure.py +28 -0
  4. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/jobs.py +2 -2
  5. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/keychain.py +15 -11
  6. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3/praetorian_cli.egg-info}/PKG-INFO +25 -19
  7. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/setup.cfg +1 -1
  8. praetorian_cli-2.1.2/praetorian_cli/handlers/configure.py +0 -25
  9. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/LICENSE +0 -0
  10. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/MANIFEST.in +0 -0
  11. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/__init__.py +0 -0
  12. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/__init__.py +0 -0
  13. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/add.py +0 -0
  14. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/agent.py +0 -0
  15. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/chariot.py +0 -0
  16. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/cli_decorators.py +0 -0
  17. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/delete.py +0 -0
  18. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/enrich.py +0 -0
  19. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/get.py +0 -0
  20. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/imports.py +0 -0
  21. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/link.py +0 -0
  22. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/list.py +0 -0
  23. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/script.py +0 -0
  24. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/search.py +0 -0
  25. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/test.py +0 -0
  26. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/unlink.py +0 -0
  27. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/update.py +0 -0
  28. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/handlers/utils.py +0 -0
  29. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/main.py +0 -0
  30. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/scripts/__init__.py +0 -0
  31. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/scripts/commands/__init__.py +0 -0
  32. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/scripts/commands/nmap-example.py +0 -0
  33. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/scripts/utils.py +0 -0
  34. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/__init__.py +0 -0
  35. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/chariot.py +0 -0
  36. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/__init__.py +0 -0
  37. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/accounts.py +0 -0
  38. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/agents.py +0 -0
  39. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/assets.py +0 -0
  40. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/attributes.py +0 -0
  41. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/capabilities.py +0 -0
  42. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/configurations.py +0 -0
  43. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/credentials.py +0 -0
  44. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/definitions.py +0 -0
  45. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/files.py +0 -0
  46. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/integrations.py +0 -0
  47. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/keys.py +0 -0
  48. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/preseeds.py +0 -0
  49. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/risks.py +0 -0
  50. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/search.py +0 -0
  51. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/seeds.py +0 -0
  52. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/settings.py +0 -0
  53. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/statistics.py +0 -0
  54. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/entities/webhook.py +0 -0
  55. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/model/__init__.py +0 -0
  56. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/model/globals.py +0 -0
  57. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/model/query.py +0 -0
  58. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/model/utils.py +0 -0
  59. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/__init__.py +0 -0
  60. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/pytest.ini +0 -0
  61. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_account.py +0 -0
  62. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_agent.py +0 -0
  63. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_asset.py +0 -0
  64. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_attribute.py +0 -0
  65. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_capabilities.py +0 -0
  66. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_configuration.py +0 -0
  67. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_definition.py +0 -0
  68. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_extend.py +0 -0
  69. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_file.py +0 -0
  70. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_job.py +0 -0
  71. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_key.py +0 -0
  72. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_preseed.py +0 -0
  73. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_risk.py +0 -0
  74. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_search.py +0 -0
  75. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_seed.py +0 -0
  76. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_setting.py +0 -0
  77. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_webhook.py +0 -0
  78. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/test_z_cli.py +0 -0
  79. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli/sdk/test/utils.py +0 -0
  80. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli.egg-info/SOURCES.txt +0 -0
  81. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli.egg-info/dependency_links.txt +0 -0
  82. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli.egg-info/entry_points.txt +0 -0
  83. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli.egg-info/requires.txt +0 -0
  84. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/praetorian_cli.egg-info/top_level.txt +0 -0
  85. {praetorian_cli-2.1.2 → praetorian_cli-2.1.3}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: praetorian-cli
3
- Version: 2.1.2
3
+ Version: 2.1.3
4
4
  Summary: For interacting with the Chariot API
5
5
  Home-page: https://github.com/praetorian-inc/praetorian-cli
6
6
  Author: Praetorian
@@ -70,20 +70,26 @@ pip install praetorian-cli
70
70
  ## Signing up
71
71
 
72
72
  Register for an account for [Chariot](http://chariot.praetorian.com) using the instructions
73
- in [our documentation](https://docs.praetorian.com/hc/en-us/articles/25784233986587-Account-Creation-and-Attack-Surface-Setup).
73
+ in [our documentation](https://docs.praetorian.com/hc/en-us/articles/38048335323547-Account-Creation-and-Attack-Surface-Setup).
74
74
 
75
75
  ## Authentication
76
76
 
77
- Once you have signed up and chosen your username and password, you will need to
78
- provide the credentials to the CLI for interacting with Chariot. Depending on your
79
- use cases and security requirements, you can use one of the following methods:
77
+ Once you can properly access Chariot through the UI. You can obtain API credentials through the UI under
78
+ Settings -> User Settings -> API Keys. Be sure to careful copy the API credentials you created as
79
+ you will need to provide them to the CLI for interacting with Chariot.
80
80
 
81
- ### Using the keychain file
81
+ **Note**: SSO Organizations should provision access through API Keys as well.
82
82
 
83
- This method stores credentials in a keychain file.
83
+ ### Using API Keys
84
84
 
85
- 1. Run `praetorian configure` and follow the prompts. In most use cases, use the
86
- default values for `profile name`, `URL of backend API`, and `client ID`.
85
+ This is the authentication method for CLI. You can authenticate using either a keychain file or environment variables.
86
+
87
+ #### Using the keychain file
88
+
89
+ This method stores your API key in a keychain file.
90
+
91
+ 1. Run `praetorian configure` and follow the prompts to set up authentication.
92
+ Use the default values for `profile name`, `URL of backend API`, and `client ID`.
87
93
  2. It creates `~/.praetorian/keychain.ini`, which should read like this:
88
94
 
89
95
  ```
@@ -91,23 +97,23 @@ This method stores credentials in a keychain file.
91
97
  name = chariot
92
98
  client_id = 795dnnr45so7m17cppta0b295o
93
99
  api = https://d0qcl2e18h.execute-api.us-east-2.amazonaws.com/chariot
94
- username = lara.lynch@acme.com
95
- password = 8epu9bQ2kqb8qwd.GR
100
+ api_key_id = your-api-key-id-here
101
+ api_key_secret = your-api-key-here
96
102
  ```
97
103
 
98
- ### Using environment variables
104
+ #### Using environment variables
99
105
 
100
- This method uses in-memory environment variables to pass credentials to
101
- the CLI. There is no need for a keychain file on disk. This enables the users to choose
102
- a credential storage method suitable for their use cases. To use this method, set the
103
- following environment variables:
106
+ This method uses in-memory environment variables to pass your API key to
107
+ the CLI. There is no need for a keychain file on disk. This enables you to choose
108
+ a credential storage method suitable for your use cases. To use this method, set the
109
+ following environment variable:
104
110
 
105
111
  ```zsh
106
- export PRAETORIAN_CLI_USERNAME=lara.lynch@acme.com
107
- export PRAETORIAN_CLI_PASSWORD=8epu9bQ2kqb8qwd.GR
112
+ export PRAETORIAN_CLI_API_KEY_ID=your-api-key-id-here
113
+ export PRAETORIAN_CLI_API_KEY_SECRET=your-api-key-here
108
114
  ```
109
115
 
110
- For more advanced configuration options, as well as SSO. See
116
+ For more advanced configuration options or managing access in SSO organizations see
111
117
  [the documentation on configuration](https://github.com/praetorian-inc/praetorian-cli/blob/main/docs/configure.md).
112
118
 
113
119
  # Using the CLI
@@ -51,20 +51,26 @@ pip install praetorian-cli
51
51
  ## Signing up
52
52
 
53
53
  Register for an account for [Chariot](http://chariot.praetorian.com) using the instructions
54
- in [our documentation](https://docs.praetorian.com/hc/en-us/articles/25784233986587-Account-Creation-and-Attack-Surface-Setup).
54
+ in [our documentation](https://docs.praetorian.com/hc/en-us/articles/38048335323547-Account-Creation-and-Attack-Surface-Setup).
55
55
 
56
56
  ## Authentication
57
57
 
58
- Once you have signed up and chosen your username and password, you will need to
59
- provide the credentials to the CLI for interacting with Chariot. Depending on your
60
- use cases and security requirements, you can use one of the following methods:
58
+ Once you can properly access Chariot through the UI. You can obtain API credentials through the UI under
59
+ Settings -> User Settings -> API Keys. Be sure to careful copy the API credentials you created as
60
+ you will need to provide them to the CLI for interacting with Chariot.
61
61
 
62
- ### Using the keychain file
62
+ **Note**: SSO Organizations should provision access through API Keys as well.
63
63
 
64
- This method stores credentials in a keychain file.
64
+ ### Using API Keys
65
65
 
66
- 1. Run `praetorian configure` and follow the prompts. In most use cases, use the
67
- default values for `profile name`, `URL of backend API`, and `client ID`.
66
+ This is the authentication method for CLI. You can authenticate using either a keychain file or environment variables.
67
+
68
+ #### Using the keychain file
69
+
70
+ This method stores your API key in a keychain file.
71
+
72
+ 1. Run `praetorian configure` and follow the prompts to set up authentication.
73
+ Use the default values for `profile name`, `URL of backend API`, and `client ID`.
68
74
  2. It creates `~/.praetorian/keychain.ini`, which should read like this:
69
75
 
70
76
  ```
@@ -72,23 +78,23 @@ This method stores credentials in a keychain file.
72
78
  name = chariot
73
79
  client_id = 795dnnr45so7m17cppta0b295o
74
80
  api = https://d0qcl2e18h.execute-api.us-east-2.amazonaws.com/chariot
75
- username = lara.lynch@acme.com
76
- password = 8epu9bQ2kqb8qwd.GR
81
+ api_key_id = your-api-key-id-here
82
+ api_key_secret = your-api-key-here
77
83
  ```
78
84
 
79
- ### Using environment variables
85
+ #### Using environment variables
80
86
 
81
- This method uses in-memory environment variables to pass credentials to
82
- the CLI. There is no need for a keychain file on disk. This enables the users to choose
83
- a credential storage method suitable for their use cases. To use this method, set the
84
- following environment variables:
87
+ This method uses in-memory environment variables to pass your API key to
88
+ the CLI. There is no need for a keychain file on disk. This enables you to choose
89
+ a credential storage method suitable for your use cases. To use this method, set the
90
+ following environment variable:
85
91
 
86
92
  ```zsh
87
- export PRAETORIAN_CLI_USERNAME=lara.lynch@acme.com
88
- export PRAETORIAN_CLI_PASSWORD=8epu9bQ2kqb8qwd.GR
93
+ export PRAETORIAN_CLI_API_KEY_ID=your-api-key-id-here
94
+ export PRAETORIAN_CLI_API_KEY_SECRET=your-api-key-here
89
95
  ```
90
96
 
91
- For more advanced configuration options, as well as SSO. See
97
+ For more advanced configuration options or managing access in SSO organizations see
92
98
  [the documentation on configuration](https://github.com/praetorian-inc/praetorian-cli/blob/main/docs/configure.md).
93
99
 
94
100
  # Using the CLI
@@ -0,0 +1,28 @@
1
+ import click
2
+ from praetorian_cli.sdk.keychain import Keychain, DEFAULT_API, DEFAULT_CLIENT_ID, DEFAULT_PROFILE
3
+
4
+ @click.command()
5
+ @click.option('--email', is_flag=True, help='Use email/password authentication instead of API key')
6
+ @click.pass_context
7
+ def configure(click_context, email):
8
+ """ Configure the CLI with API key (default) or email/password authentication """
9
+
10
+ if email:
11
+ email_address = click.prompt("Enter your email")
12
+ password = click.prompt("Enter your password", hide_input=True)
13
+ api_key_id = None
14
+ api_key_secret = None
15
+ else:
16
+ api_key_id = click.prompt("Enter your API Key ID")
17
+ api_key_secret = click.prompt("Enter your API Key secret", hide_input=True)
18
+ email_address = None
19
+ password = None
20
+
21
+ profile_name = click.prompt("Enter the profile name to configure", default=DEFAULT_PROFILE, show_default=True)
22
+ url = click.prompt("Enter the URL of backend API", default=DEFAULT_API, show_default=True)
23
+ client_id = click.prompt("Enter the client ID", default=DEFAULT_CLIENT_ID, show_default=True)
24
+ assume_role = click.prompt("Enter the assume-role account, if any", default='', show_default=False)
25
+
26
+ Keychain.configure(email_address, password, profile_name, url, client_id, assume_role, api_key_id, api_key_secret)
27
+
28
+
@@ -33,10 +33,10 @@ class Jobs:
33
33
  return self.api.search.by_key_prefix(f'#job#{prefix_filter}', offset, pages)
34
34
 
35
35
  def is_failed(self, job):
36
- return job['status'].startswith('JF')
36
+ return job and job['status'] and job['status'].startswith('JF')
37
37
 
38
38
  def is_passed(self, job):
39
- return job['status'].startswith('JP')
39
+ return job and job['status'] and job['status'].startswith('JP')
40
40
 
41
41
  def system_job_key(self, source, id):
42
42
  return f'#job#{id}#system#{source}'
@@ -15,6 +15,10 @@ DEFAULT_CLIENT_ID = '795dnnr45so7m17cppta0b295o'
15
15
  DEFAULT_PROFILE = 'United States'
16
16
  DEFAULT_KEYCHAIN_FILEPATH = join(Path.home(), '.praetorian', 'keychain.ini')
17
17
 
18
+ API_KEY_ID = 'api_key_id'
19
+ API_KEY_SECRET = 'api_key_secret'
20
+
21
+
18
22
 
19
23
  class Keychain:
20
24
 
@@ -66,8 +70,8 @@ class Keychain:
66
70
 
67
71
  self.load_env('username', 'PRAETORIAN_CLI_USERNAME', required=False)
68
72
  self.load_env('password', 'PRAETORIAN_CLI_PASSWORD', required=False)
69
- self.load_env('api_key_id', 'PRAETORIAN_CLI_API_KEY_ID', required=False)
70
- self.load_env('api_key_secret', 'PRAETORIAN_CLI_API_KEY_SECRET', required=False)
73
+ self.load_env(API_KEY_ID, 'PRAETORIAN_CLI_API_KEY_ID', required=False)
74
+ self.load_env(API_KEY_SECRET, 'PRAETORIAN_CLI_API_KEY_SECRET', required=False)
71
75
 
72
76
  if self.account is None:
73
77
  self.account = self.config.get(self.profile, 'account', fallback=None)
@@ -88,7 +92,7 @@ class Keychain:
88
92
  if self.has_api_key():
89
93
  response = requests.get(
90
94
  f"{self.base_url()}/token",
91
- params={'id': self.api_key_id(), 'key': self.api_key()}
95
+ params={'id': self.api_key_id(), 'key': self.api_key_secret()}
92
96
  )
93
97
  if response.status_code != 200:
94
98
  error(f"API key authentication failed: {response.text}")
@@ -123,15 +127,15 @@ class Keychain:
123
127
 
124
128
  def api_key_id(self):
125
129
  """ Get the api_key_id field from the keychain profile """
126
- return self.get_option('api_key_id')
130
+ return self.get_option(API_KEY_ID)
127
131
 
128
- def api_key(self):
132
+ def api_key_secret(self):
129
133
  """ Get the api_key field from the keychain profile """
130
- return self.get_option('api_key_secret')
134
+ return self.get_option(API_KEY_SECRET)
131
135
 
132
136
  def has_api_key(self):
133
137
  """ Check if API key credentials are available """
134
- return bool(self.api_key_id() and self.api_key())
138
+ return bool(self.api_key_id() and self.api_key_secret())
135
139
 
136
140
  def get_option(self, option_name):
137
141
  return self.load().config.get(self.profile, option_name, fallback=None)
@@ -146,7 +150,7 @@ class Keychain:
146
150
 
147
151
  @staticmethod
148
152
  def configure(username, password, profile=DEFAULT_PROFILE, api=DEFAULT_API, client_id=DEFAULT_CLIENT_ID,
149
- account=None, api_key_id=None, api_key=None):
153
+ account=None, api_key_id=None, api_key_secret=None):
150
154
  """ Update or insert a new profile to the keychain file at the default location.
151
155
  If the keychain file does not exist, create it. """
152
156
  new_profile = {
@@ -165,10 +169,10 @@ class Keychain:
165
169
  new_profile['account'] = account
166
170
 
167
171
  if api_key_id:
168
- new_profile['api_key_id'] = api_key_id
172
+ new_profile[API_KEY_ID] = api_key_id
169
173
 
170
- if api_key:
171
- new_profile['api_key'] = api_key
174
+ if api_key_secret:
175
+ new_profile[API_KEY_SECRET] = api_key_secret
172
176
 
173
177
  config = ConfigParser()
174
178
  config.read(DEFAULT_KEYCHAIN_FILEPATH)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: praetorian-cli
3
- Version: 2.1.2
3
+ Version: 2.1.3
4
4
  Summary: For interacting with the Chariot API
5
5
  Home-page: https://github.com/praetorian-inc/praetorian-cli
6
6
  Author: Praetorian
@@ -70,20 +70,26 @@ pip install praetorian-cli
70
70
  ## Signing up
71
71
 
72
72
  Register for an account for [Chariot](http://chariot.praetorian.com) using the instructions
73
- in [our documentation](https://docs.praetorian.com/hc/en-us/articles/25784233986587-Account-Creation-and-Attack-Surface-Setup).
73
+ in [our documentation](https://docs.praetorian.com/hc/en-us/articles/38048335323547-Account-Creation-and-Attack-Surface-Setup).
74
74
 
75
75
  ## Authentication
76
76
 
77
- Once you have signed up and chosen your username and password, you will need to
78
- provide the credentials to the CLI for interacting with Chariot. Depending on your
79
- use cases and security requirements, you can use one of the following methods:
77
+ Once you can properly access Chariot through the UI. You can obtain API credentials through the UI under
78
+ Settings -> User Settings -> API Keys. Be sure to careful copy the API credentials you created as
79
+ you will need to provide them to the CLI for interacting with Chariot.
80
80
 
81
- ### Using the keychain file
81
+ **Note**: SSO Organizations should provision access through API Keys as well.
82
82
 
83
- This method stores credentials in a keychain file.
83
+ ### Using API Keys
84
84
 
85
- 1. Run `praetorian configure` and follow the prompts. In most use cases, use the
86
- default values for `profile name`, `URL of backend API`, and `client ID`.
85
+ This is the authentication method for CLI. You can authenticate using either a keychain file or environment variables.
86
+
87
+ #### Using the keychain file
88
+
89
+ This method stores your API key in a keychain file.
90
+
91
+ 1. Run `praetorian configure` and follow the prompts to set up authentication.
92
+ Use the default values for `profile name`, `URL of backend API`, and `client ID`.
87
93
  2. It creates `~/.praetorian/keychain.ini`, which should read like this:
88
94
 
89
95
  ```
@@ -91,23 +97,23 @@ This method stores credentials in a keychain file.
91
97
  name = chariot
92
98
  client_id = 795dnnr45so7m17cppta0b295o
93
99
  api = https://d0qcl2e18h.execute-api.us-east-2.amazonaws.com/chariot
94
- username = lara.lynch@acme.com
95
- password = 8epu9bQ2kqb8qwd.GR
100
+ api_key_id = your-api-key-id-here
101
+ api_key_secret = your-api-key-here
96
102
  ```
97
103
 
98
- ### Using environment variables
104
+ #### Using environment variables
99
105
 
100
- This method uses in-memory environment variables to pass credentials to
101
- the CLI. There is no need for a keychain file on disk. This enables the users to choose
102
- a credential storage method suitable for their use cases. To use this method, set the
103
- following environment variables:
106
+ This method uses in-memory environment variables to pass your API key to
107
+ the CLI. There is no need for a keychain file on disk. This enables you to choose
108
+ a credential storage method suitable for your use cases. To use this method, set the
109
+ following environment variable:
104
110
 
105
111
  ```zsh
106
- export PRAETORIAN_CLI_USERNAME=lara.lynch@acme.com
107
- export PRAETORIAN_CLI_PASSWORD=8epu9bQ2kqb8qwd.GR
112
+ export PRAETORIAN_CLI_API_KEY_ID=your-api-key-id-here
113
+ export PRAETORIAN_CLI_API_KEY_SECRET=your-api-key-here
108
114
  ```
109
115
 
110
- For more advanced configuration options, as well as SSO. See
116
+ For more advanced configuration options or managing access in SSO organizations see
111
117
  [the documentation on configuration](https://github.com/praetorian-inc/praetorian-cli/blob/main/docs/configure.md).
112
118
 
113
119
  # Using the CLI
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = praetorian-cli
3
- version = 2.1.2
3
+ version = 2.1.3
4
4
  author = Praetorian
5
5
  author_email = support@praetorian.com
6
6
  description = For interacting with the Chariot API
@@ -1,25 +0,0 @@
1
- import click
2
-
3
- from praetorian_cli.sdk.keychain import Keychain, DEFAULT_API, DEFAULT_CLIENT_ID, DEFAULT_PROFILE
4
-
5
-
6
- @click.command()
7
- @click.option('--email', help='Email you used to register for Chariot', default='',
8
- prompt='Enter your email (Type ENTER if this is set in the PRAETORIAN_CLI_USERNAME environment variable)')
9
- @click.option('--password', help='Password you used to register for Chariot', default='',
10
- prompt='Enter your password (Type ENTER if this is set in the PRAETORIAN_CLI_PASSWORD environment variable)',
11
- hide_input=True)
12
- @click.option('--profile-name', help='Profile name.', required=True,
13
- prompt='Enter the profile name to configure', default=DEFAULT_PROFILE, show_default=True)
14
- @click.option('--url', help='URL to the backend API. Default provided.', required=True,
15
- prompt='Enter the URL of backend API', default=DEFAULT_API)
16
- @click.option('--client-id', help='Client ID of the backend. Default provided.', required=True,
17
- prompt='Enter the client ID', default=DEFAULT_CLIENT_ID)
18
- @click.option('--assume-role', help='Email address of the account to assume-role into', required=True,
19
- prompt='Enter the assume-role account, if any', default='')
20
- @click.option('--api-key-id', help='API Key ID for authentication', default='')
21
- @click.option('--api-key', help='API Key for authentication', default='', hide_input=True)
22
- @click.pass_context
23
- def configure(click_context, email, password, profile_name, url, client_id, assume_role, api_key_id, api_key):
24
- """ Configure the CLI """
25
- Keychain.configure(email, password, profile_name, url, client_id, assume_role, api_key_id, api_key)
File without changes