【问题标题】:Ruby Docker image does not communiate with VaultRuby Docker 映像不与 Vault 通信
【发布时间】:2018-08-25 12:36:55
【问题描述】:

我有一个在 docker 映像中运行的 ruby​​ 应用程序。 我正在我的 Ubuntu 开发环境中运行此映像。

Ubuntu env 已配置 Vault 并且运行良好(在开发模式和下面发布的日志)。

我将 VAULT_ADDR 和 VAULT_TOKEN 暴露给 docker 映像,但我的应用程序在 Vault 实例上引发异常。

ruby 代码:

#Check if OTP key already exists for given uid
  def exist?(uid)
    Vault.logical.read("totp/keys/#{uid}").present? // Exception is here

Exception: no implicit conversion of nil into String

我是这样配置保险库的,

vault server -dev
vault login 50921e0b-d79b-a5d1-1b86-ef986c4844c4
vault secrets enable totp

导出了 VAULT_ADDR 和 VAULT_TOKEN,以便我的 docker 映像可以访问它们。

export VAULT_ADDR='http://127.0.0.1:8200'
export VAULT_TOKEN='50921e0b-d79b-a5d1-1b86-ef986c4844c4'

保险库日志:

==> Vault 服务器配置:

                 Cgo: disabled
     Cluster Address: https://127.0.0.1:8201
          Listener 1: tcp (addr: "127.0.0.1:8200", cluster address: "127.0.0.1:8201", tls: "disabled")
           Log Level: info
               Mlock: supported: true, enabled: false
    Redirect Address: http://127.0.0.1:8200
             Storage: inmem
             Version: Vault v0.9.5
         Version Sha: 36edb4d42380d89a897e7f633046423240b710d9

WARNING! dev mode is enabled! In this mode, Vault runs entirely in-memory
and starts unsealed with a single unseal key. The root token is already
authenticated to the CLI, so you can immediately begin using Vault.

You may need to set the following environment variable:

$ export VAULT_ADDR='http://127.0.0.1:8200'

The unseal key and root token are displayed below in case you want to
seal/unseal the Vault or re-authenticate.

Unseal Key: 0o+LdZPhvQBEjVZtUlX5UPac9dcXBLqpU1i1jqBw/2s=
Root Token: 50921e0b-d79b-a5d1-1b86-ef986c4844c4

Development mode should NOT be used in production installations!

【问题讨论】:

  • 这里有同样的问题。你找到解决办法了吗?

标签: ruby-on-rails docker-compose hashicorp-vault


【解决方案1】:

尝试使用命令禁用通用秘密后端。

vault secrets disable secret

我的猜测是您的 ruby​​ 应用程序正在尝试连接到默认机密后端,即 secret,在我的 java 应用程序中也发生了同样的情况,在禁用通用后端后,我可以从我的自定义秘密路径。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-21
    • 1970-01-01
    • 1970-01-01
    • 2022-11-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多