-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Database token TTL displays incorrectly #4051
Comments
Can you provide the role configuration? |
path = "database/config/rds-staging"
data_json = <<EOF
{
"plugin_name": "postgresql-database-plugin",
"allowed_roles": "rds-staging",
"connection_url": "postgresql://${data.vault_generic_secret.rds_user.data["value"]}:${data.vault_generic_secret.rds_password.data["value"]}@${module.rds.address}:${module.rds.port}/${data.vault_generic_secret.rds_dbname.data["value"]} "
}
EOF
}
resource "vault_generic_secret" "rds_access_role" {
path = "database/roles/rds-staging"
data_json = <<EOF
{
"db_name": "rds-staging",
"creation_statements": "[\"...
"default_ttl": "10h",
"max_ttl": "24h",
"revocation_statements": "[\"...]"
}
EOF
} |
'Now' ( IIUC, I think is not a display issue. |
I'm not sure where you're getting 8 hours from, but the current logic in the database backend uses the default ttl you're setting on the role, which is 10 hours. The PR that I referenced here will cause it to fall back to the mount-set default TTL if a role default TTL isn't set. |
Database credentials generation (i.e. |
This was more confusion about how TTL is handled. I assumed that it would generate 8h since that's as long as my authorization to Vault is good for, meaning it would revoke anything I had attached to me at that time |
Tokens can be renewed! So lifetimes of secrets are not tied at issuance to lifetimes of tokens, however, if your token does get revoked the associated secrets will too. |
Environment:
0.9.4
ubuntu client, aws linux server
Vault Config File:
Expected Behavior:
It should generate a TTL based on the lowest TTL between the mount, my token, and the TTL set for the role above.
Actual Behavior:
It generates the TTL and user correctly, but displays the wrong TTL on generate
Steps to Reproduce:
My token TTL is 8h:
My database mount tune is 60s default, 30d max:
My role (above) is 10h. It should generate a user with an expiration time of now + 8h (because my lowest max is my token at 8h). However when I generate the credentials it shows
10h
even though it correctly generated an 8h user:The text was updated successfully, but these errors were encountered: