我如何从 Vault 中批量删除过期的证书
how can i bulk remove expired certificates from Vault
我们的保险库存储不断堆满大量过期证书。
有一个选项可以使用 api 或租用 ID 吊销证书,但它们仍然可用并且可以查询。
以下只会吊销证书,
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/pki/revoke
有没有办法永久删除过期的证书?
有一个endpoint,
tidy
This endpoint allows tidying up the storage backend and/or CRL by removing certificates that have expired
and are past a certain buffer period beyond their expiration time.
因此,要删除所有过期的证书,请向 https://<vault-api-url>:<api-port>/v1/<pki-role>/tidy
发出 POST
请求,并使用 "tidy_cert_store": true
作为负载,
使用 cURL,
curl -X POST \
https://<vault-api-url>:<api-port>/v1/<pki-role>/tidy \
-H 'content-type: application/json' \
-H 'x-vault-token: c32165c4-212f-2dc2e-cd9f-acf63bdce91c' \
-d '{
"tidy_cert_store": true
}'
Sufiyan 提供的语法似乎不正确(或针对旧版本)。在 Vault >1.2(可能更早)中,它应该是:
curl -X POST \
-H "X-Vault-Token: $VAULT_TOKEN" \
-d '{"tidy_cert_store":true}' \
$VAULT_ADDR/v1/pki/tidy
这应该会导致整洁的过程开始,并且 return 这个响应:
{
"request_id": "",
"lease_id": "",
"renewable": false,
"lease_duration": 0,
"data": null,
"wrap_info": null,
"warnings": [
"Tidy operation successfully started. Any information from the operation will be printed to Vault's server logs."
],
"auth": null
}
关于 Tidy 的最新文档是 https://www.vaultproject.io/api/secret/pki/index.html#tidy
我们的保险库存储不断堆满大量过期证书。
有一个选项可以使用 api 或租用 ID 吊销证书,但它们仍然可用并且可以查询。
以下只会吊销证书,
$ curl \
--header "X-Vault-Token: ..." \
--request POST \
--data @payload.json \
http://127.0.0.1:8200/v1/pki/revoke
有没有办法永久删除过期的证书?
有一个endpoint,
tidy
This endpoint allows tidying up the storage backend and/or CRL by removing certificates that have expired and are past a certain buffer period beyond their expiration time.
因此,要删除所有过期的证书,请向 https://<vault-api-url>:<api-port>/v1/<pki-role>/tidy
发出 POST
请求,并使用 "tidy_cert_store": true
作为负载,
使用 cURL,
curl -X POST \
https://<vault-api-url>:<api-port>/v1/<pki-role>/tidy \
-H 'content-type: application/json' \
-H 'x-vault-token: c32165c4-212f-2dc2e-cd9f-acf63bdce91c' \
-d '{
"tidy_cert_store": true
}'
Sufiyan 提供的语法似乎不正确(或针对旧版本)。在 Vault >1.2(可能更早)中,它应该是:
curl -X POST \
-H "X-Vault-Token: $VAULT_TOKEN" \
-d '{"tidy_cert_store":true}' \
$VAULT_ADDR/v1/pki/tidy
这应该会导致整洁的过程开始,并且 return 这个响应:
{
"request_id": "",
"lease_id": "",
"renewable": false,
"lease_duration": 0,
"data": null,
"wrap_info": null,
"warnings": [
"Tidy operation successfully started. Any information from the operation will be printed to Vault's server logs."
],
"auth": null
}
关于 Tidy 的最新文档是 https://www.vaultproject.io/api/secret/pki/index.html#tidy