duandao2083 2018-06-20 21:03
浏览 88
已采纳

未检测到保管库令牌助手?

Problem:

I have three files in a vault:0.10.2 docker image at the following locations:

/home/myuser/token_helper: A token helper binary in Go that implements the token helper interface according to this documentation

/home/myuser/vault_start: A Go script that runs os.exec("vault", "operator", "init") and os.exec("vault", "server", "-config=myconfig.hcl")

/home/myuser/.vault: The token helper config file specifying the token helper binary location, and I've exported VAULT_CONFIG_PATH to point to this path. The file reads token_helper = "/home/myuser/token_helper".

The problem I'm seeing is while running the vault_start script, I get the following error:

failed to get token helper: error expanding config path "": exec: "getent": executable file not found in $PATH

Debugging Done So Far:

This error doesn't seem to be correct. which getent returns /usr/bin/getent, and the image $PATH contains it, proving that both exist. In addition, the config path is not "", it's set as /home/myuser/.vault but Vault detects it as empty apparently.

I've traced that error output to this file in Vault's command directory: . According to that block of code, it only errors out when $HOME is not set, but I've confirmed that $HOME is set in the shell.

In addition, I've specified everything that Vault has asked in order to implement the token helper according to this document, but it doesn't seem to be detecting the config file to run it. This seems to be an error with Vault, or am I missing something?

  • 写回答

1条回答 默认 最新

  • doutan3463 2018-06-22 14:59
    关注

    Figured this out, it was because the os.exec("vault", "operator", "init") line did not inherit the VAULT_CONFIG_PATH variable setting from the host, and so it was empty.

    The following shows how to give os.Exec environment variables during it's run:

        vaultInitCmd := exec.Command("vault", "operator", "init")
        vaultInitCmd.Env = []string{
        fmt.Sprintf(`VAULT_ADDR=%s`, addr),
        fmt.Sprintf(`VAULT_CONFIG_PATH=%s`, `/home/myuser/.vault`)}
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 这是哪个作者做的宝宝起名网站
  • ¥60 版本过低apk如何修改可以兼容新的安卓系统
  • ¥25 由IPR导致的DRIVER_POWER_STATE_FAILURE蓝屏
  • ¥50 有数据,怎么建立模型求影响全要素生产率的因素
  • ¥50 有数据,怎么用matlab求全要素生产率
  • ¥15 TI的insta-spin例程
  • ¥15 完成下列问题完成下列问题
  • ¥15 C#算法问题, 不知道怎么处理这个数据的转换
  • ¥15 YoloV5 第三方库的版本对照问题
  • ¥15 请完成下列相关问题!