如何重置或“取消初始化”保险库?

时间:2017-08-10 04:48:44

标签: consul hashicorp-vault

我正在尝试使用consul v0.9.1后端自动执行vault v0.8.0部署(来自Hashicorp的vaultproject)。

因为这是一个试错过程,我需要多次运行“vault init”(直到我做对了)并获得密钥。

不幸的是我丢失了密钥和根令牌。

我试图阻止金库和领事服务 - 什么都没有 “* Vault已初始化”和“* Vault已密封”

我停止了保险库,从领事处删除了保险库路径,启动了保险库 - 结果相同 - 而在“保险库保险库初始”我收到此错误:

* expiration state restore failed: failed to scan for leases: list failed at path '': Unexpected response code: 403

并且它在领事中再次创建了保险库/路径并保持密封。

如何“重置”保险库或使其进行联合初始化并重新启动“vault init”?

这是日志:

Aug 10 05:01:49 TSLASOWROMM01 vault[9156]: ==> Vault server started! Log data will stream in below:
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.238436 [INFO ] core: security barrier not initialized
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.271844 [INFO ] core: security barrier initialized: shares=5 threshold=3
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.320363 [INFO ] core: post-unseal setup starting
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.342931 [INFO ] core: loaded wrapping token key
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.356895 [INFO ] core: successfully mounted backend: type=generic path=secret/
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.357342 [INFO ] core: successfully mounted backend: type=cubbyhole path=cubbyhole/
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.357736 [INFO ] core: successfully mounted backend: type=system path=sys/
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.358293 [INFO ] rollback: starting rollback manager
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.381808 [INFO ] expiration: restoring leases
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.383943 [INFO ] core: pre-seal teardown starting
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.384154 [INFO ] core: cluster listeners not running
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.384365 [INFO ] rollback: stopping rollback manager
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.384633 [INFO ] core: pre-seal teardown complete
Aug 10 05:03:26 TSLASOWROMM01 vault[9156]: 2017/08/10 05:03:26.384909 [ERROR] core: post-unseal setup failed during init: error=expiration state restore failed: failed to scan for leases: list failed at path '': Unexpected response code: 403

4 个答案:

答案 0 :(得分:6)

根据同一问题的讨论:https://groups.google.com/forum/#!msg/vault-tool/xuO8IInubDg/SBHMP2PKAwAJ,答案是:

  

Vault正在Consul中存储其状态,因此如果您关闭Vault并删除Consul中的Vault的密钥前缀,则应该再次开始清理。

答案 1 :(得分:2)

使用Vault的任何存储后端,您应该能够删除您的存储空间。看起来你遇到了旧版Consul的错误。

答案 2 :(得分:1)

以防万一有人以与我相同的意图阅读此帖子->寻找“文件”后端

如果您查看文件库配置文件(例如/etc/vault.d/vault.hcl

有一条指令storage "file" { path = "/some/file/name" ......

只需备份目录/some/file/name并将其清空(请勿删除,只需清空即可)。

然后将浏览器定向至http://localhost:8820/ui/vault/init重新初始化

答案 3 :(得分:0)

使用 Vault 版本 Vault v1.7.3。我注意到它创建了一个文件夹 vault-data,我不得不将它重命名为 un-initialize。