如何解封 Vault 服务器,在 docker 容器中运行

Fry*_*rye 5 configuration docker consul

我有一个成功启动 consul 的 docker compose 设置(在此处配置)。Vault 似乎启动正常,除了设置 TTL 时出现一些错误(此处记录)。

再往后, consul 在尝试访问 时似乎打嗝/v1/agent/check/fail/vault:127.0.0.1:8200:vault-sealed-check?note=Vault+Sealed。显然'vault:127.0.0.1:8200:vault-sealed-check' status is now critical

consul1    |     2016/11/05 20:50:04 [DEBUG] agent: Check 'vault:127.0.0.1:8200:vault-sealed-check' status is now critical
consul1    |     2016/11/05 20:50:04 [DEBUG] agent: Service 'vault:127.0.0.1:8200' in sync
consul1    |     2016/11/05 20:50:04 [DEBUG] agent: Service 'consul' in sync
consul1    |     2016/11/05 20:50:04 [DEBUG] agent: Check 'vault:127.0.0.1:8200:vault-sealed-check' in sync
consul1    |     2016/11/05 20:50:04 [DEBUG] agent: Node info in sync
consul1    |     2016/11/05 20:50:04 [DEBUG] http: Request PUT /v1/agent/check/fail/vault:127.0.0.1:8200:vault-sealed-check?note=Vault+Sealed (92.314µs) from=172.18.0.3:48742
Run Code Online (Sandbox Code Playgroud)

当 vault 容器启动时(使用 consul 后端)1)我们如何获得初始i)密钥和ii)根令牌。我正在将 Hashicorp 的官方保险库映像与我的自定义/vault/config/vault.hcl(和consul image)一起使用。

最终,我想知道2)如何解封 Vault 服务器。在这种情况下,我想解封在 docker 容器中运行的保管库服务器。而3)这是我所需要的,开始写秘密金库。

Fry*_*rye 0

所以我找到了一个可行的解决方案。与 i 的工作设置领事节点,ii。一个与之对话的保险库实例iii. 连接到金库并生成初始解封和根令牌的能力。

A)有了这个dockerfile,我可以 docker-compose build && docker-compose up

B)然后在另一个 shell 中,我可以连接$ docker exec -i -t gently_vault_1 /bin/sh.

C)然后,在该 shell 中,只需运行vault init.

/ # vault init
Unseal Key 1: asdf...
Unseal Key 2: qwer...
Unseal Key 3: zxcv...
Unseal Key 4: piou...
Unseal Key 5: lkjh...
Initial Root Token: mbnv...

Vault initialized with 5 keys and a key threshold of 3. Please
securely distribute the above keys. When the Vault is re-sealed,
restarted, or stopped, you must provide at least 3 of these keys
to unseal it again.

Vault does not store the master key. Without at least 3 keys,
your Vault will remain permanently sealed.
Run Code Online (Sandbox Code Playgroud)