Skip to content

Lease cache not working for PKI engine #238

@dnlopes

Description

@dnlopes

Hello,

I have been struggling to integrate the PKI engine with csi-driver using Vault.

For context, this is what I have on my test setup:

  • csi-driver polling interval set to 1m and auto-rotation enabled
  • a MySQL secrets engine and a role with lease time of 5m
  • a PKI engine and a role with lease time of 1h

For the MySQL use case everything works smoothly: my pod initializes, fetches credentials, and every minute, the csi-driver-vault replies with the cached reply, and does not request new credentials from Vault. Close to the final of the lease duration, the csi-driver actually requests a new credentials from Vault and its refreshed inside the pod.

For my PKI use case, I'm not able to make this work. Every minute, the csi-driver ignores the lease of the certificate and always fetches a new one from Vault.

See the logs below:

MySQL logs

2024-01-25T12:00:14.800Z [INFO]  agent.apiproxy: received request: method=GET path=/v1/mysql/creds/god
2024-01-25T12:00:14.800Z [DEBUG] agent.cache.leasecache: returning cached response: path=/v1/mysql/creds/god
2024-01-25T12:00:59.849Z [DEBUG] agent.cache.leasecache: secret renewed: path=/v1/mysql/creds/god
2024-01-25T12:01:14.801Z [INFO]  agent.apiproxy: received request: method=GET path=/v1/mysql/creds/god
2024-01-25T12:01:14.802Z [DEBUG] agent.cache.leasecache: returning cached response: path=/v1/mysql/creds/god

PKI logs

2024-01-25T11:48:23.567Z [INFO]  agent.apiproxy: received request: method=POST path=/v1/nats/issue/david
2024-01-25T11:48:23.568Z [DEBUG] agent.cache.leasecache: forwarding request from cache: method=POST path=/v1/nats/issue/david
2024-01-25T11:48:23.568Z [INFO]  agent.apiproxy: forwarding request to Vault: method=POST path=/v1/nats/issue/david
2024-01-25T11:48:23.568Z [DEBUG] agent.apiproxy.client: performing request: method=POST url=http://vault-server.vault-server.svc.cluster.local:8200/v1/nats/issue/david
2024-01-25T11:48:27.188Z [DEBUG] agent.cache.leasecache: pass-through response; secret not renewable: method=POST path=/v1/nats/issue/david

The log entry that catches my attention is this one: pass-through response; secret not renewable. Indeed, the PKI secret is not renewable, but looking at the documentation here I was expecting a new certificate to be fetched only when close to 85% of the lease duration.

I have gona through a lot of issues around this topic (#90, #82, #202), but I can't figure out what's wrong in my setup.

Can you help?

Thanks.

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