github.com/outbrain/consul@v1.4.5/website/source/api/acl-legacy.html.md (about) 1 --- 2 layout: api 3 page_title: Legacy ACLs - HTTP API 4 sidebar_current: api-acls-legacy 5 description: |- 6 The /acl endpoints create, update, destroy, and query Legacy ACL tokens in Consul. 7 --- 8 9 -> **Consul 1.4.0 deprecates the legacy ACL system completely.** It's _strongly_ 10 recommended you do not build anything using the legacy system and consider using 11 the new ACL [Token](/docs/api/acl-token.html) and [Policy](/docs/api/acl-policy.html) APIs instead. 12 13 # ACL HTTP API 14 15 These `/acl` endpoints create, update, destroy, and query ACL tokens in Consul. For more information about ACLs, please see the [ACL Guide](/docs/guides/acl.html). 16 17 ## Bootstrap ACLs 18 19 This endpoint does a special one-time bootstrap of the ACL system, making the first 20 management token if the [`acl_master_token`](/docs/agent/options.html#acl_master_token) 21 is not specified in the Consul server configuration, and if the cluster has not been 22 bootstrapped previously. This is available in Consul 0.9.1 and later, and requires all 23 Consul servers to be upgraded in order to operate. 24 25 This provides a mechanism to bootstrap ACLs without having any secrets present in Consul's 26 configuration files. 27 28 | Method | Path | Produces | 29 | ------ | ---------------------------- | -------------------------- | 30 | `PUT` | `/acl/bootstrap` | `application/json` | 31 32 The table below shows this endpoint's support for 33 [blocking queries](/api/index.html#blocking-queries), 34 [consistency modes](/api/index.html#consistency-modes), 35 [agent caching](/api/index.html#agent-caching), and 36 [required ACLs](/api/index.html#acls). 37 38 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 39 | ---------------- | ----------------- | ------------- | ------------ | 40 | `NO` | `none` | `none` | `none` | 41 42 ### Sample Request 43 44 ```text 45 $ curl \ 46 --request PUT \ 47 http://127.0.0.1:8500/v1/acl/bootstrap 48 ``` 49 50 ### Sample Response 51 52 ```json 53 { 54 "ID": "adf4238a-882b-9ddc-4a9d-5b6758e4159e" 55 } 56 ``` 57 58 You can detect if something has interfered with the ACL bootstrapping process by 59 checking the response code. A 200 response means that the bootstrap was a success, and 60 a 403 means that the cluster has already been bootstrapped, at which point you should 61 consider the cluster in a potentially compromised state. 62 63 The returned token will be a management token which can be used to further configure the 64 ACL system. Please see the [ACL Guide](/docs/guides/acl.html) for more details. 65 66 ## Create ACL Token 67 68 This endpoint makes a new ACL token. 69 70 | Method | Path | Produces | 71 | ------ | ---------------------------- | -------------------------- | 72 | `PUT` | `/acl/create` | `application/json` | 73 74 The table below shows this endpoint's support for 75 [blocking queries](/api/index.html#blocking-queries), 76 [consistency modes](/api/index.html#consistency-modes), 77 [agent caching](/api/index.html#agent-caching), and 78 [required ACLs](/api/index.html#acls). 79 80 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 81 | ---------------- | ----------------- | ------------- | ------------ | 82 | `NO` | `none` | `none` | `management` | 83 84 ### Parameters 85 86 - `ID` `(string: "")` - Specifies the ID of the ACL. If not provided, a UUID is 87 generated. 88 89 - `Name` `(string: "")` - Specifies a human-friendly name for the ACL token. 90 91 - `Type` `(string: "client")` - Specifies the type of ACL token. Valid values 92 are: `client` and `management`. 93 94 - `Rules` `(string: "")` - Specifies rules for this ACL token. The format of the 95 `Rules` property is documented in the [ACL Guide](/docs/guides/acl.html). 96 97 ### Sample Payload 98 99 ```json 100 { 101 "Name": "my-app-token", 102 "Type": "client", 103 "Rules": "" 104 } 105 ``` 106 107 ### Sample Request 108 109 ```text 110 $ curl \ 111 --request PUT \ 112 --data @payload.json \ 113 http://127.0.0.1:8500/v1/acl/create 114 ``` 115 116 ### Sample Response 117 118 ```json 119 { 120 "ID": "adf4238a-882b-9ddc-4a9d-5b6758e4159e" 121 } 122 ``` 123 124 ## Update ACL Token 125 126 This endpoint is used to modify the policy for a given ACL token. Instead of 127 generating a new token ID, the `ID` field must be provided. 128 129 | Method | Path | Produces | 130 | ------ | ---------------------------- | -------------------------- | 131 | `PUT` | `/acl/update` | `application/json` | 132 133 The table below shows this endpoint's support for 134 [blocking queries](/api/index.html#blocking-queries), 135 [consistency modes](/api/index.html#consistency-modes), 136 [agent caching](/api/index.html#agent-caching), and 137 [required ACLs](/api/index.html#acls). 138 139 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 140 | ---------------- | ----------------- | ------------- | ------------ | 141 | `NO` | `none` | `none` | `management` | 142 143 ### Parameters 144 145 The parameters are the same as the _create_ endpoint, except the `ID` field is 146 required. 147 148 ### Sample Payload 149 150 ```json 151 { 152 "ID": "adf4238a-882b-9ddc-4a9d-5b6758e4159e", 153 "Name": "my-app-token-updated", 154 "Type": "client", 155 "Rules": "# New Rules", 156 } 157 ``` 158 159 ### Sample Request 160 161 ```text 162 $ curl \ 163 --request PUT \ 164 --data @payload.json \ 165 http://127.0.0.1:8500/v1/acl/update 166 ``` 167 168 ### Sample Response 169 170 ```json 171 { 172 "ID": "adf4238a-882b-9ddc-4a9d-5b6758e4159e" 173 } 174 ``` 175 176 ## Delete ACL Token 177 178 This endpoint deletes an ACL token with the given ID. 179 180 | Method | Path | Produces | 181 | ------ | ---------------------------- | -------------------------- | 182 | `PUT` | `/acl/destroy/:uuid` | `application/json` | 183 184 Even though the return type is application/json, the value is either true or false, indicating whether the delete succeeded. 185 186 The table below shows this endpoint's support for 187 [blocking queries](/api/index.html#blocking-queries), 188 [consistency modes](/api/index.html#consistency-modes), 189 [agent caching](/api/index.html#agent-caching), and 190 [required ACLs](/api/index.html#acls). 191 192 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 193 | ---------------- | ----------------- | ------------- | ------------ | 194 | `NO` | `none` | `none` | `management` | 195 196 ### Parameters 197 198 - `uuid` `(string: <required>)` - Specifies the UUID of the ACL token to 199 destroy. This is required and is specified as part of the URL path. 200 201 ### Sample Request 202 203 ```text 204 $ curl \ 205 --request PUT \ 206 http://127.0.0.1:8500/v1/acl/destroy/8f246b77-f3e1-ff88-5b48-8ec93abf3e05 207 ``` 208 209 ### Sample Response 210 211 ```json 212 true 213 ``` 214 215 216 ## Read ACL Token 217 218 This endpoint reads an ACL token with the given ID. 219 220 | Method | Path | Produces | 221 | ------ | ---------------------------- | -------------------------- | 222 | `GET` | `/acl/info/:uuid` | `application/json` | 223 224 The table below shows this endpoint's support for 225 [blocking queries](/api/index.html#blocking-queries), 226 [consistency modes](/api/index.html#consistency-modes), 227 [agent caching](/api/index.html#agent-caching), and 228 [required ACLs](/api/index.html#acls). 229 230 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 231 | ---------------- | ----------------- | ------------- | ------------ | 232 | `YES` | `all` | `none` | `none` | 233 234 Note: No ACL is required because the ACL is specified in the URL path. 235 236 ### Parameters 237 238 - `uuid` `(string: <required>)` - Specifies the UUID of the ACL token to 239 read. This is required and is specified as part of the URL path. 240 241 ### Sample Request 242 243 ```text 244 $ curl \ 245 http://127.0.0.1:8500/v1/acl/info/8f246b77-f3e1-ff88-5b48-8ec93abf3e05 246 ``` 247 248 ### Sample Response 249 250 ```json 251 [ 252 { 253 "CreateIndex": 3, 254 "ModifyIndex": 3, 255 "ID": "8f246b77-f3e1-ff88-5b48-8ec93abf3e05", 256 "Name": "Client Token", 257 "Type": "client", 258 "Rules": "..." 259 } 260 ] 261 ``` 262 263 ## Clone ACL Token 264 265 This endpoint clones an ACL and returns a new token `ID`. This allows a token to 266 serve as a template for others, making it simple to generate new tokens without 267 complex rule management. 268 269 | Method | Path | Produces | 270 | ------ | ---------------------------- | -------------------------- | 271 | `PUT` | `/acl/clone/:uuid` | `application/json` | 272 273 The table below shows this endpoint's support for 274 [blocking queries](/api/index.html#blocking-queries), 275 [consistency modes](/api/index.html#consistency-modes), 276 [agent caching](/api/index.html#agent-caching), and 277 [required ACLs](/api/index.html#acls). 278 279 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 280 | ---------------- | ----------------- | ------------- | ------------ | 281 | `NO` | `none` | `none` | `management` | 282 283 ### Parameters 284 285 - `uuid` `(string: <required>)` - Specifies the UUID of the ACL token to 286 be cloned. This is required and is specified as part of the URL path. 287 288 ### Sample Request 289 290 ```text 291 $ curl \ 292 --request PUT \ 293 http://127.0.0.1:8500/v1/acl/clone/8f246b77-f3e1-ff88-5b48-8ec93abf3e05 294 ``` 295 296 ### Sample Response 297 298 ```json 299 { 300 "ID": "adf4238a-882b-9ddc-4a9d-5b6758e4159e" 301 } 302 ``` 303 304 ## List ACLs 305 306 This endpoint lists all the active ACL tokens. 307 308 | Method | Path | Produces | 309 | ------ | ---------------------------- | -------------------------- | 310 | `GET` | `/acl/list` | `application/json` | 311 312 The table below shows this endpoint's support for 313 [blocking queries](/api/index.html#blocking-queries), 314 [consistency modes](/api/index.html#consistency-modes), 315 [agent caching](/api/index.html#agent-caching), and 316 [required ACLs](/api/index.html#acls). 317 318 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 319 | ---------------- | ----------------- | ------------- | ------------ | 320 | `YES` | `all` | `none` | `management` | 321 322 ### Sample Request 323 324 ```text 325 $ curl \ 326 http://127.0.0.1:8500/v1/acl/list 327 ``` 328 329 ### Sample Response 330 331 ```json 332 [ 333 { 334 "CreateIndex": 3, 335 "ModifyIndex": 3, 336 "ID": "8f246b77-f3e1-ff88-5b48-8ec93abf3e05", 337 "Name": "Client Token", 338 "Type": "client", 339 "Rules": "..." 340 } 341 ] 342 ``` 343 344 ## Check ACL Replication 345 346 This endpoint returns the status of the ACL replication process in the 347 datacenter. This is intended to be used by operators, or by automation checking 348 the health of ACL replication. 349 350 Please see the [ACL Guide](/docs/guides/acl.html#replication) replication 351 section for more details. 352 353 | Method | Path | Produces | 354 | ------ | ---------------------------- | -------------------------- | 355 | `GET` | `/acl/replication` | `application/json` | 356 357 The table below shows this endpoint's support for 358 [blocking queries](/api/index.html#blocking-queries), 359 [consistency modes](/api/index.html#consistency-modes), 360 [agent caching](/api/index.html#agent-caching), and 361 [required ACLs](/api/index.html#acls). 362 363 | Blocking Queries | Consistency Modes | Agent Caching | ACL Required | 364 | ---------------- | ----------------- | ------------- | ------------ | 365 | `NO` | `consistent` | `none` | `none` | 366 367 ### Parameters 368 369 - `dc` `(string: "")` - Specifies the datacenter to query. This will default to 370 the datacenter of the agent being queried. This is specified as part of the 371 URL as a query parameter. 372 373 ### Sample Request 374 375 ```text 376 $ curl \ 377 http://127.0.0.1:8500/v1/acl/replication 378 ``` 379 380 ### Sample Response 381 382 ```json 383 { 384 "Enabled": true, 385 "Running": true, 386 "SourceDatacenter": "dc1", 387 "ReplicatedIndex": 1976, 388 "LastSuccess": "2016-08-05T06:28:58Z", 389 "LastError": "2016-08-05T06:28:28Z" 390 } 391 ``` 392 393 - `Enabled` reports whether ACL replication is enabled for the datacenter. 394 395 - `Running` reports whether the ACL replication process is running. The process 396 may take approximately 60 seconds to begin running after a leader election 397 occurs. 398 399 - `SourceDatacenter` is the authoritative ACL datacenter that ACLs are being 400 replicated from, and will match the 401 [`primary_datacenter`](/docs/agent/options.html#primary_datacenter) configuration. 402 403 - `ReplicatedIndex` is the last index that was successfully replicated. You can 404 compare this to the `X-Consul-Index` header returned by the 405 [`/v1/acl/list`](#acl_list) endpoint to determine if the replication process 406 has gotten all available ACLs. Replication runs as a background process 407 approximately every 30 seconds, and that local updates are rate limited to 100 408 updates/second, so so it may take several minutes to perform the initial sync 409 of a large set of ACLs. After the initial sync, replica lag should be on the 410 order of about 30 seconds. 411 412 - `LastSuccess` is the UTC time of the last successful sync operation. Since ACL 413 replication is done with a blocking query, this may not update for up to 5 414 minutes if there have been no ACL changes to replicate. A zero value of 415 "0001-01-01T00:00:00Z" will be present if no sync has been successful. 416 417 - `LastError` is the UTC time of the last error encountered during a sync 418 operation. If this time is later than `LastSuccess`, you can assume the 419 replication process is not in a good state. A zero value of 420 "0001-01-01T00:00:00Z" will be present if no sync has resulted in an error.