|
| 1 | +# Passwords |
| 2 | + |
| 3 | +Passwords are a part for the Secret Manager service. The service allows to generate and manage passwords, store them in specified storage and use them for different purposes. |
| 4 | + |
| 5 | +The current implementation supports three methods to create passwords: `AUTO_HEX`, `AUTO_URL_SAFE` and `MANUAL`. |
| 6 | + |
| 7 | +Examples: |
| 8 | + |
| 9 | +```bash |
| 10 | +curl --location 'http://10.20.0.2:11010/v1/secret/passwords/' \ |
| 11 | +--header 'Content-Type: application/json' \ |
| 12 | +--header 'Authorization: Bearer MY_TOKEN' \ |
| 13 | +--data-raw '{ |
| 14 | + "name": "my-password", |
| 15 | + "project_id": "00000000-0000-0000-0000-000000000000", |
| 16 | + "method": "AUTO_HEX", |
| 17 | + "constructor": { |
| 18 | + "kind": "plain" |
| 19 | + }, |
| 20 | + "default_length": 32 |
| 21 | +}' |
| 22 | +``` |
| 23 | + |
| 24 | +The main fields are: |
| 25 | + |
| 26 | +- **name** - name of the password. |
| 27 | +- **project_id** - it's a project the password belongs to. |
| 28 | +- **method** - the method to generate or specify the password value. |
| 29 | +- **constructor** - in the context of the passwords, the constructor object creates and stores the password. The `plain` means create and store in the plain format. |
| 30 | +- **default_length** - the length of the auto-generated password value (default is `32`, maximum is `512`). |
| 31 | + |
| 32 | +## Examples for passwords in manifest |
| 33 | + |
| 34 | +### AUTO_HEX |
| 35 | + |
| 36 | +```yaml |
| 37 | +# AUTO_HEX generates a random hex-encoded string via secrets.token_hex() |
| 38 | +# After processing, target value will be something like: |
| 39 | +# value: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6" |
| 40 | +auto_hex_password: |
| 41 | + name: "auto-hex-password" |
| 42 | + project_id: "12345678-c625-4fee-81d5-f691897b8142" |
| 43 | + method: "AUTO_HEX" |
| 44 | + constructor: |
| 45 | + kind: plain |
| 46 | + default_length: 32 |
| 47 | +``` |
| 48 | +
|
| 49 | +### AUTO_URL_SAFE |
| 50 | +
|
| 51 | +```yaml |
| 52 | +# AUTO_URL_SAFE generates a random URL-safe base64 string via secrets.token_urlsafe() |
| 53 | +# After processing, target value will be something like: |
| 54 | +# value: "a1b2c3d4-e5f6_a7b8c9d0e1f2a3b4c5d6a1b2c3d4e5f6a7b8" |
| 55 | +auto_url_safe_password: |
| 56 | + name: "auto-url-safe-password" |
| 57 | + project_id: "12345678-c625-4fee-81d5-f691897b8142" |
| 58 | + method: "AUTO_URL_SAFE" |
| 59 | + constructor: |
| 60 | + kind: plain |
| 61 | + default_length: 48 |
| 62 | +``` |
| 63 | +
|
| 64 | +### MANUAL |
| 65 | +
|
| 66 | +```yaml |
| 67 | +# MANUAL uses the exact value provided by the user |
| 68 | +# After processing, target value will be: |
| 69 | +# value: "my-strong-password-value" |
| 70 | +manual_password: |
| 71 | + name: "manual-password" |
| 72 | + project_id: "12345678-c625-4fee-81d5-f691897b8142" |
| 73 | + method: "MANUAL" |
| 74 | + constructor: |
| 75 | + kind: plain |
| 76 | + value: "my-strong-password-value" |
| 77 | +``` |
| 78 | +
|
| 79 | +### LONG_AUTO_HEX |
| 80 | +
|
| 81 | +```yaml |
| 82 | +# AUTO_HEX with longer length |
| 83 | +# After processing, target value will be something like: |
| 84 | +# value: "a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6..." |
| 85 | +long_auto_hex_password: |
| 86 | + name: "long-auto-hex-password" |
| 87 | + project_id: "12345678-c625-4fee-81d5-f691897b8142" |
| 88 | + method: "AUTO_HEX" |
| 89 | + constructor: |
| 90 | + kind: plain |
| 91 | + default_length: 128 |
| 92 | +``` |
| 93 | +
|
| 94 | +## Methods / Generation Strategies |
| 95 | +
|
| 96 | +The Exordos Core supports the following methods to generate or provide passwords: |
| 97 | +
|
| 98 | +### AUTO_HEX |
| 99 | +
|
| 100 | +The `AUTO_HEX` method auto-generates a random hex-encoded string. The password value is generated using Python's `secrets.token_hex()` function. This is the default method. |
| 101 | + |
| 102 | +```bash |
| 103 | +curl --location 'http://10.20.0.2:11010/v1/secret/passwords/' \ |
| 104 | +--header 'Content-Type: application/json' \ |
| 105 | +--header 'Authorization: Bearer MY_TOKEN' \ |
| 106 | +--data-raw '{ |
| 107 | + "name": "auto-hex-password", |
| 108 | + "project_id": "00000000-0000-0000-0000-000000000000", |
| 109 | + "method": "AUTO_HEX", |
| 110 | + "constructor": { |
| 111 | + "kind": "plain" |
| 112 | + }, |
| 113 | + "default_length": 48 |
| 114 | +}' |
| 115 | +``` |
| 116 | + |
| 117 | +### AUTO_URL_SAFE |
| 118 | + |
| 119 | +The `AUTO_URL_SAFE` method auto-generates a random URL-safe base64-encoded string. The password value is generated using Python's `secrets.token_urlsafe()` function. |
| 120 | + |
| 121 | +```bash |
| 122 | +curl --location 'http://10.20.0.2:11010/v1/secret/passwords/' \ |
| 123 | +--header 'Content-Type: application/json' \ |
| 124 | +--header 'Authorization: Bearer MY_TOKEN' \ |
| 125 | +--data-raw '{ |
| 126 | + "name": "auto-url-safe-password", |
| 127 | + "project_id": "00000000-0000-0000-0000-000000000000", |
| 128 | + "method": "AUTO_URL_SAFE", |
| 129 | + "constructor": { |
| 130 | + "kind": "plain" |
| 131 | + }, |
| 132 | + "default_length": 32 |
| 133 | +}' |
| 134 | +``` |
| 135 | + |
| 136 | +### MANUAL |
| 137 | + |
| 138 | +The `MANUAL` method allows to specify a custom password value explicitly. When using this method, the `value` field is required and must be provided in the request. |
| 139 | + |
| 140 | +```bash |
| 141 | +curl --location 'http://10.20.0.2:11010/v1/secret/passwords/' \ |
| 142 | +--header 'Content-Type: application/json' \ |
| 143 | +--header 'Authorization: Bearer MY_TOKEN' \ |
| 144 | +--data-raw '{ |
| 145 | + "name": "manual-password", |
| 146 | + "project_id": "00000000-0000-0000-0000-000000000000", |
| 147 | + "method": "MANUAL", |
| 148 | + "constructor": { |
| 149 | + "kind": "plain" |
| 150 | + }, |
| 151 | + "value": "my-strong-password-value" |
| 152 | +}' |
| 153 | +``` |
| 154 | + |
| 155 | +## Status Lifecycle |
| 156 | + |
| 157 | +A password goes through the following statuses during its lifecycle: |
| 158 | + |
| 159 | +- **NEW** - the password has been created and is waiting to be processed. |
| 160 | +- **IN_PROGRESS** - the password value is being generated or stored by the agent. |
| 161 | +- **ACTIVE** - the password has been successfully generated and is ready to use. |
| 162 | +- **ERROR** - an error occurred during password processing. |
| 163 | + |
| 164 | +The `status` field is read-only and automatically managed by the system. |
| 165 | + |
| 166 | +## Updating a Password |
| 167 | + |
| 168 | +When updating a password, the status is automatically reset to `NEW` to trigger regeneration of the value. |
| 169 | + |
| 170 | +```bash |
| 171 | +curl --location --request PUT 'http://10.20.0.2:11010/v1/secret/passwords/<PASSWORD_UUID>' \ |
| 172 | +--header 'Content-Type: application/json' \ |
| 173 | +--header 'Authorization: Bearer MY_TOKEN' \ |
| 174 | +--data-raw '{ |
| 175 | + "default_length": 48 |
| 176 | +}' |
| 177 | +``` |
| 178 | + |
| 179 | +## Deleting a Password |
| 180 | + |
| 181 | +```bash |
| 182 | +curl --location --request DELETE 'http://10.20.0.2:11010/v1/secret/passwords/<PASSWORD_UUID>' \ |
| 183 | +--header 'Authorization: Bearer MY_TOKEN' |
| 184 | +``` |
0 commit comments