Skip to content

Alicloud KMS Seal Does Not Refresh STS Credentials from ECS Metadata #30770

Open
@garfield1143

Description

@garfield1143

Describe the bug
We are using auto unseal with Alicloud KMS.
We use RAM Role attached to the ECS that grants access to the KMS key on Alibaba
We do not want to use static accesskey/secretkey
Vault seal configuration:

seal "alicloudkms" {
  region     = "cn-xxx"
  domain     = "kms-vpc.cn-xxx.aliyuncs.com"
  kms_key_id = "xxx-xxx"
}

Vault starts up correctly and can use the KMS seal initially.
However, after ~6 hours, the STS credentials expire, and Vault does not refresh them.
We start seeing this error in logs:

[WARN] core.autoseal: seal wrapper health check failed: seal_name=alicloudkms
err=failed to encrypt test value, seal wrapper may be unreachable: error encrypting data: SDK.ServerError
ErrorCode: InvalidAccessKeyId.NotFound
Message: The Access Key ID provided does not exist in our records.

The ECS metadata service still returns valid credentials with a new expiration (curl http://100.100.100.200/latest/meta-data/ram/security-credentials/role_name).

Vault does not re-read or refresh those credentials after startup.

If we restart Vault, it will unseal automatically but we got the errors after 6h again

To Reproduce
Steps to reproduce the behavior:

  1. Deploy Vault on ECS with a RAM Role that can access KMS.
  2. Configure alicloudkms seal without static credentials.
    seal "alicloudkms" {
    region = "cn-xxx"
    domain = "kms-vpc.cn-xxx.aliyuncs.com"
    kms_key_id = "xxx-xxx"
    }
  3. Start Vault – everything works.
  4. wait for 6h (STS expiration)
  5. Observe errors like InvalidAccessKeyId.NotFound in the logs.

Expected behavior
Vault should re-fetch STS credentials from the ECS metadata service when the current token expires.

Environment:

  • Vault Server Version (retrieve with vault status): v1.17
  • Server Operating System/Architecture: Linux Redhat8

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions