Open chrisbecke opened 3 years ago
Hi,
Thanks for reporting this! I was able to reproduce with your configuration. For some reason Vault won't show the underlying problem without the log level turned up, so adding VAULT_LOG_LEVEL: debug
to the environment variables was helpful here. Then docker-compose logs
shows:
vault_1 | 2021-09-08T21:44:20.853Z [DEBUG] secrets.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64_fbda3210.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64: 2021-09-08T21:44:20.853Z [ERROR] plugin shutting down: error="cannot allocate memory": metadata=true
This is because the plugin isn't configured with the ability to use mlock(2)
. From the documentation, we need to enable it on the plugin file as well:
# setcap cap_ipc_lock=+ep /vault/plugins/vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64
This solves your initial problem. Trying again, we now get the following error:
vault_1 | 2021-09-08T21:53:57.984Z [ERROR] secrets.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64_8bd160c7.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64.vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64: plugin tls init: error="error during token unwrap request: Put "vault:///v1/sys/wrapping/unwrap": unsupported protocol scheme "vault"" timestamp=2021-09-08T21:53:57.984Z
In this case, you forgot the URL scheme in your VAULT_API_ADDR
. It should be set to http://vault:8200. After updating it, we can successfully write and read to the plugin:
/ # vault write -force oauth2/config
Success! Data written to: oauth2/config
/ # vault read oauth2/config
Key Value
--- -----
tune_provider_timeout_expiry_leeway_factor 1.5
tune_provider_timeout_seconds 30
tune_reap_check_interval_seconds 300
tune_reap_dry_run false
tune_reap_non_refreshable_seconds 86400
tune_reap_revoked_seconds 3600
tune_reap_transient_error_attempts 10
tune_reap_transient_error_seconds 86400
tune_refresh_check_interval_seconds 60
tune_refresh_expiry_delta_factor 1.2
It would probably be helpful to mention turning up the log level and checking the memory locking configuration as troubleshooting steps explicitly. I'll turn this into a docs issue. Let me know if you have any other questions!
Describe the Bug
I am trying to build this plugin for inclusion in a vault image. When I attempt to enable the secrets plugin it responds with the message:
Expected Behavior
One of
Steps to Reproduce
docker-compose.yml
andvault/Dockerfile
.docker compose build
to build the vault image.docker compose up -d
to run the vault image.docker compose exec vault sh
to access the shell in the running vault container.vault operator init -n 1 -t 1
to initialize the vault.vault operator unseal <unseal-ket>
to unseal the vault.vault login <token>
to set the login token.sha256sum /vault/plugins/vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64
to get the hash of the binary.vault plugin register -sha256=<hash> secret vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64
to register the plugin.vault secrets enable -path=oauth2 vault-plugin-secrets-oauthapp-v3.0.0-beta.3-linux-amd64
Files
vault/Dockerfile
docker-compose.yml