Skip to content

Vault removes created AWS IAM user with a valid lease when the ldap credential expires #9728

@nshazly

Description

@nshazly

Describe the bug
LDAP is configured with a ttl of 5m and a max_tll of 1h and AWS engine is used to generate keys for an IAM user, the aws user is removed when the ldap token expires after 5m. The AWS engine is set to have a default ttl of 1h and a max of 8h.

To Reproduce
Steps to reproduce the behavior:

  1. Configure the ldap/aws ttl's, enable the aws plugin
vault auth tune -max-lease-ttl=1h -default-lease-ttl=5m ldap 
vault secrets enable -path=aws-development-users \
    -description="Access consul-backup S3 bucket" \
    -default-lease-ttl="1h" \
    -max-lease-ttl="12h" \
    -plugin-name=aws aws
 * role setup
vault write aws/roles/mydevrole \
    credential_type=iam_user \
    user_path=/vault-users/ \
    policy_arns=arn:aws:iam:::policy/mypolicy
vault write aws-development-users/config/lease lease=1h lease_max=12h
  1. Run vault login....
vault login -method=ldap username=testuser
#get the s3 keys
vault read aws/roles/mydevrole
OUTPUT:
Key                Value
lease_id           aws/creds/mydevrole/aKk2OaZKRQf8AumWSb1BA589
lease_duration     1h
lease_renewable    true
access_key         xxxxxxxxxxxxx
secret_key         xxxxxxxxxxxxxxxxxxx
security_token     <nil>
  1. See error
    After 5 minutes, this user is removed from AWS. IF the ldap session is renewed, the user will stay. If the ldap token is revoked. The user is removed.
    Expected behavior
    The created s3 user should not be removed until the lease id expires. I expect this to be independent of the ldap token.

Environment:

  • Vault Server Version (retrieve with vault status):
Key                      Value
Recovery Seal Type       shamir
Initialized              true
Sealed                   false
Total Recovery Shares    5
Threshold                3
Version                  1.4.3
Cluster Name             vault-cluster
Cluster ID               xxxxxxxxxxxxxxxxxxxxxxxxxxx
HA Enabled               true
HA Cluster               https://vault-1.vault-internal:8201
HA Mode                  standby
Active Node Address      https://10.206.25.190:8200

  • Vault CLI Version (retrieve with vault version):
    v1.4.3
  • Server Operating System/Architecture:
    Kubernetes, running in HA with Consul

Vault server configuration file(s):
ui = true

  listener "tcp" {
    tls_disable = "false"
    address = "[::]:8200"
    cluster_address = "[::]:8201"
    tls_cert_file = "/vault/userconfig/ingrooves/tls.crt"
    tls_key_file = "/vault/userconfig/ingrooves/tls.key"
    tls_client_ca_file = "/vault/userconfig/ingrooves/tls.crt"
  }
  storage "consul" {
    path = "vault/"
    address = "consul.ingrooves.com:443"
    scheme = "https"
    tls_ca_file = "/vault/userconfig/ingrooves/tls.crt"
    tls_key_file = "/vault/userconfig/ingrooves/tls.key"
    tls_cert_file = "/vault/userconfig/ingrooves/tls.crt"
    tls_skip_verify = "false"
    token = ""
    service = "vault"
  }

  seal "awskms" {
    region  = ""
    kms_key_id = ""
  }
# Paste your Vault config here.
# Be sure to scrub any sensitive values

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions