github.com/dahs81/otto@v0.2.1-0.20160126165905-6400716cf085/website/source/docs/concepts/lease.html.md (about) 1 --- 2 layout: "docs" 3 page_title: "Lease, Renew, and Revoke" 4 sidebar_current: "docs-concepts-lease" 5 description: |- 6 Vault provides a lease with every secret. When this lease is expired, Vault will revoke that secret. 7 --- 8 9 # Lease, Renew, and Revoke 10 11 With every secret and authentication token, Vault provides a _lease_: 12 an amount of time that Vault promises that the data will be valid for. 13 Once the lease is up, Vault can automatically revoke the data, and the 14 consumer of the secret can no longer be certain that it is valid. 15 16 The benefit should be clear: consumers of secrets need to check in with 17 Vault routinely to either renew the lease (if allowed) or request a 18 replacement secret. This makes the Vault audit logs more valuable and 19 also makes key rolling a lot easier. 20 21 All secrets in Vault are required to have a lease. Even if the data is 22 meant to be valid for eternity, a lease is required to force the consumer 23 to check in routinely. 24 25 In addition to renewals, a lease can be _revoked_. When a lease is revoked, 26 it invalidates that secret immediately and prevents any further renewals. 27 For 28 [dynamic secrets](#), 29 the secrets themselves are often immediately disabled. For example, with 30 the 31 [AWS secret backend](/docs/secrets/aws/index.html), the access keys will 32 be deleted from AWS the moment a secret is revoked. This renders the access 33 keys invalid from that point forward. 34 35 Revocation can happen manually via the API or `vault revoke`, or automatically 36 by Vault. When a lease is expired, Vault will automatically revoke that 37 lease. 38 39 ## Lease IDs 40 41 When reading a secret, such as via `vault read`, Vault always returns 42 a `lease_id`. This is the ID used with commands such as `vault renew` and 43 `vault revoke` to manage the lease of the secret. 44 45 ## Lease Durations and Renewal 46 47 Along with the lease ID, a _lease duration_ can be read. The lease duration 48 is the time in seconds that the lease is valid for. A consumer of this 49 secret must renew the lease within that time. 50 51 When renewing the lease, the user can request a specific amount of time 52 from now to extend the lease. For example: `vault renew my-lease-id 3600` 53 would request to extend the lease of "my-lease-id" by 1 hour (3600 seconds). 54 55 The requested increment is completely advisory. The backend in charge 56 of the secret can choose to completely ignore it. For most secrets, the 57 backend does its best to respect the increment, but often limits it to 58 ensure renewals every so often. 59 60 As a result, the return value of renews should be carefully inspected 61 to determine what the new lease is. 62 63 ## Prefix-based Revocation 64 65 In addition to revoking a single secret, operators with proper access 66 control can revoke multiple secrets based on their lease ID prefix. 67 68 Lease IDs are structured in a way that their prefix is always the path 69 where the secret was requested from. This lets you revoke trees of 70 secrets. For example, to revoke all AWS access keys, you can do 71 `vault revoke -prefix aws/`. 72 73 This is very useful if there is an intrusion within a specific system: 74 all secrets of a specific backend or a certain configured backend can 75 be revoked quickly and easily.