Skip to content

003 · Domain 3: Vault tokens · 15% of the exam

Task 3.2: Describe root token uses and lifecycle

The initial root token from operator init, generating one with a quorum of key holders, using it only for set-up and emergencies, and revoking it afterwards.

Study it

  • Root tokens: initial set-up, generate-root and revocation

    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

After initial set-up the team revoked the initial root token. Months later, a bad policy change locks every administrator out of sys/policy. The cluster uses Shamir unseal keys held by five officers, with a threshold of three. How does the team obtain a root token?

  1. ARun vault operator init again to get a fresh root token
  2. BRun vault operator generate-root and have three key holders enter their unseal keys
  3. CRun vault token create -policy=root with an administrator's token
  4. DRestart the cluster, because a root token is printed once the unseal keys are entered again
Show the answer and why
  • ARun vault operator init again to get a fresh root token

    Incorrect

    Initialization happens once per cluster; an initialized Vault does not issue a new root token through init.

  • BRun vault operator generate-root and have three key holders enter their unseal keys

    Correct

    generate-root creates a root token once a quorum of unseal key holders authorizes it.

  • CRun vault token create -policy=root with an administrator's token

    Incorrect

    Only an existing root token can create a root token, and the administrators' tokens are not root.

  • DRestart the cluster, because a root token is printed once the unseal keys are entered again

    Incorrect

    Unsealing prints no token; restarting only makes every node sealed again.

generate-root needs a quorum of unseal key holders, which keeps the creation of root access under shared control.

Question 2 · choose 1

An operator initializes a new cluster with vault operator init and receives the initial root token. When does that token expire?

  1. ANever; it has no expiration
  2. BAfter 32 days, the system max TTL
  3. CAfter 24 hours, unless it is renewed
  4. DAt the first restart, when the cluster seals
Show the answer and why
  • ANever; it has no expiration

    Correct

    The initial root token generated at init time has no expiration.

  • BAfter 32 days, the system max TTL

    Incorrect

    The initial root token has no TTL, so no max TTL applies to it.

  • CAfter 24 hours, unless it is renewed

    Incorrect

    The initial root token needs no renewal.

  • DAt the first restart, when the cluster seals

    Incorrect

    Sealing does not expire or revoke tokens.

Only root tokens can be set to never expire, which is why the initial root token is guarded so closely.

Question 3 · choose 1

An operator has finished the initial set-up of a new cluster while logged in with the initial root token, which is now the CLI's current token. She must revoke it before handing over, without pasting its value into any command. Which command does it?

  1. Avault policy delete root
  2. Bvault operator seal
  3. Cvault token revoke -self
  4. Dvault token renew -increment=0
Show the answer and why
  • Avault policy delete root

    Incorrect

    Deleting a policy changes what the tokens that carry it may do; it never revokes a token.

  • Bvault operator seal

    Incorrect

    Sealing makes the node stop serving requests until it is unsealed; it revokes no token.

  • Cvault token revoke -self

    Correct

    -self revokes the token the command authenticates with, here the root token.

  • Dvault token renew -increment=0

    Incorrect

    Renewal adjusts a token's TTL; it never revokes the token.

With -self, vault token revoke acts on the token the CLI is using, so the value never has to be typed or pasted.

Question 4 · choose 1

Integration tests start a throwaway Vault dev server on every run and must know its root token in advance instead of reading a random value from the server's output. How is that done?

  1. AExport VAULT_TOKEN=root in the shell before starting the server
  2. BRun vault operator init against the dev server with the chosen value
  3. CCreate one after start with vault token create -policy=root -orphan
  4. DStart it with vault server -dev -dev-root-token-id=root
Show the answer and why
  • AExport VAULT_TOKEN=root in the shell before starting the server

    Incorrect

    VAULT_TOKEN sets the token the CLI sends; it does not choose the server's initial root token.

  • BRun vault operator init against the dev server with the chosen value

    Incorrect

    A dev server is initialized for you, and init has no option that chooses the root token's value.

  • CCreate one after start with vault token create -policy=root -orphan

    Incorrect

    The new token would still get a random value, and creating it needs the printed root token first.

  • DStart it with vault server -dev -dev-root-token-id=root

    Correct

    -dev-root-token-id sets the dev server's initial root token, here the literal string root.

Root tokens belong in development and in emergencies. -dev-root-token-id, or VAULT_DEV_ROOT_TOKEN_ID, applies only in dev mode, which must never run in production.

Question 5 · choose 1

An administrator holds a root token that expires in 2 hours and tries to create a second root token with no expiry. What happens?

  1. AIt succeeds, because any root token can do anything
  2. BIt is refused; only a non-expiring root can mint a non-expiring root
  3. CIt succeeds once the administrator adds -orphan to the token create command
  4. DIt fails, because root tokens can only come from generate-root
Show the answer and why
  • AIt succeeds, because any root token can do anything

    Incorrect

    Root can do almost anything, but this limit is documented.

  • BIt is refused; only a non-expiring root can mint a non-expiring root

    Correct

    Root tokens can create root tokens, but a root token with an expiration cannot create a non-expiring one.

  • CIt succeeds once the administrator adds -orphan to the token create command

    Incorrect

    Making the new token an orphan does not lift the limit on non-expiring root tokens.

  • DIt fails, because root tokens can only come from generate-root

    Incorrect

    Root tokens can also be created by another root token.

A root token with an expiration cannot mint a root token without one, which keeps permanent root access hard to create.

Practice domain 3 →Practice all domains →