Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validateRole should use the new "token_period" instead of "period" #6570

Closed
khicks opened this issue Oct 26, 2019 · 3 comments · Fixed by #6574
Closed

validateRole should use the new "token_period" instead of "period" #6570

khicks opened this issue Oct 26, 2019 · 3 comments · Fixed by #6574
Assignees
Milestone

Comments

@khicks
Copy link

khicks commented Oct 26, 2019

Nomad version

Nomad v0.10.0 (25ee121)

Issue

The validateRole function checks that the deprecated "period" attribute of the Vault token role is non-zero instead of the new "token_period" attribute. If "period" is zero and "token_period" is non-zero, the job will fail.

Reproduction steps

Create a Vault token role in Terraform.

resource "vault_policy" "nomad_job" {
  name   = "nomad/job"
  policy = file("policies/nomad-job.hcl")
}

resource "vault_token_auth_backend_role" "nomad_job" {
  role_name              = "nomad-job"
  token_explicit_max_ttl = "0"
  token_period           = "259200"
  #period                = "259200"
  renewable = true
  orphan    = true

  allowed_policies = [
    vault_policy.nomad_job.name,
  ]
}

Since the "period" attribute is not set in Terraform, it will be set to 0 in Vault, resulting in an error in Nomad:

Vault: server failed to derive vault token: failed to establish connection to Vault: 1 error(s) occurred: * Role must have a non-zero period to make tokens periodic.

Both attributes cannot be used at the same time, and using "period" throws a deprecation warning.

Thanks for reading and your hard work!

@djenriquez
Copy link

@notnoop did this make it to 0.10.1? I do not see a reference for it in the changelog.

@notnoop
Copy link
Contributor

notnoop commented Nov 8, 2019

Nope - it'll be in 0.10.2 and it's captured in changelog updates in https://github.com/hashicorp/nomad/pull/6652/files .

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants