Skip to content

003 · Domain 4: Vault leases · 7% of the exam

Task 4.2: Describe how to renew leases

vault lease renew and sys/leases/renew, the increment measured from now, limits set by the engine and the max TTL, and checking the returned duration.

Study it

  • Renewing leases: increments, limits and returned durations

    Lesson coming

Sample questions

Try each one before opening the answer. Every option is explained, with the HashiCorp documentation page that proves it.

Question 1 · choose 1

A database role issues credentials with a default TTL of 1 hour and a max TTL of 4 hours. Three and a half hours after a credential was issued, the application runs vault lease renew -increment=2h with its lease ID. What lease duration does Vault return?

  1. A2 hours, since the increment is counted from the renewal
  2. BNone, because Vault rejects an increment that would pass the max TTL
  3. C1 hour, the role's default TTL, because renewals ignore the increment
  4. DAbout 30 minutes, the time left before the 4-hour max TTL
Show the answer and why
  • A2 hours, since the increment is counted from the renewal

    Incorrect

    The increment is counted from now, but the max TTL still caps the result.

  • BNone, because Vault rejects an increment that would pass the max TTL

    Incorrect

    Vault does not reject the request; it returns a shorter lease that stays within the limit.

  • C1 hour, the role's default TTL, because renewals ignore the increment

    Incorrect

    Engines try to honor the increment within their limits rather than resetting to the default.

  • DAbout 30 minutes, the time left before the 4-hour max TTL

    Correct

    The increment is advisory and counted from now; the engine limits it so the lease cannot pass its max TTL.

Always read the duration a renewal returns: the requested increment starts at the time of renewal, but the engine and the max TTL decide what is granted. Near the max TTL, request a new credential instead.

Question 2 · choose 1

A PostgreSQL role creates users with VALID UNTIL '{{expiration}}'. When an application renews its credential's lease, the DBA wants the user's expiry in the database to move along with it. Which role parameter holds the statements Vault runs at renewal?

  1. Arenew_statements
  2. Brevocation_statements
  3. Crollback_statements
  4. Ddefault_ttl
Show the answer and why
  • Arenew_statements

    Correct

    These are the database statements Vault executes to renew a user, for plugins that support them.

  • Brevocation_statements

    Incorrect

    These run when a lease is revoked or expires, to remove the user.

  • Crollback_statements

    Incorrect

    These undo a create operation that failed part-way.

  • Ddefault_ttl

    Incorrect

    This sets the lease length Vault grants; it runs nothing in the database.

If a role leaves its statements out, Vault inserts generic ones that may not suit the database, so production roles define each set explicitly.

Question 3 · choose 1

A Python service renews its database credential's lease through POST /v1/sys/leases/renew. It tries the same endpoint to renew the service token it got from an AppRole login, and the call is rejected. Which request should it send for the token?

  1. APOST /v1/sys/leases/renew with the token's accessor instead of a lease ID
  2. BPOST /v1/auth/approle/login again, passing the current token
  3. CPOST /v1/auth/token/renew-self, authenticated with that token
  4. DPOST /v1/sys/leases/renew-prefix with the auth/approle/ prefix
Show the answer and why
  • APOST /v1/sys/leases/renew with the token's accessor instead of a lease ID

    Incorrect

    This endpoint does not renew token leases, whichever identifier is sent.

  • BPOST /v1/auth/approle/login again, passing the current token

    Incorrect

    A new login issues a new token; it does not renew the existing one.

  • CPOST /v1/auth/token/renew-self, authenticated with that token

    Correct

    Token leases are renewed through the token endpoints, such as auth/token/renew-self or auth/token/renew.

  • DPOST /v1/sys/leases/renew-prefix with the auth/approle/ prefix

    Incorrect

    sys/leases offers prefix revocation, not prefix renewal, and token leases cannot be renewed through sys/leases at all.

The leases endpoint documents that it cannot renew token leases and points to the token endpoints instead.

Question 4 · choose 1

An application renews the lease on its database username and password. What happens to the credential itself?

  1. AVault rotates the password and returns the new one
  2. BVault returns a new username with the same password
  3. CIt is revoked and replaced by a credential with a new lease ID
  4. DIt stays the same and remains valid for longer
Show the answer and why
  • AVault rotates the password and returns the new one

    Incorrect

    Rotation is not part of renewal; a new credential needs a new read.

  • BVault returns a new username with the same password

    Incorrect

    Renewal returns lease information, not new credentials.

  • CIt is revoked and replaced by a credential with a new lease ID

    Incorrect

    Renewal keeps the lease ID and the credential.

  • DIt stays the same and remains valid for longer

    Correct

    Renewing a lease does not change the contents of the secret.

Renewal stretches the life of an existing secret; requesting the path again creates a different one.

Question 5 · choose 1

A secret's lease lasts 1 hour and is not renewable. The job using it runs for three hours. What should the job do?

  1. ARenew the lease with a larger -increment
  2. BRequest a new secret before the hour ends
  3. CRenew its token, which also renews the lease
  4. DNothing, since the lease extends while the secret is in use
Show the answer and why
  • ARenew the lease with a larger -increment

    Incorrect

    No increment applies to a lease that is not renewable.

  • BRequest a new secret before the hour ends

    Correct

    A non-renewable lease cannot be extended, so the consumer needs a replacement secret.

  • CRenew its token, which also renews the lease

    Incorrect

    Token renewal does not make a non-renewable lease renewable.

  • DNothing, since the lease extends while the secret is in use

    Incorrect

    Leases expire at their TTL unless renewed.

Consumers check whether a lease is renewable and how long it lasts, and plan either renewals or fresh requests.

Practice domain 4 →Practice all domains →