Started by user admin Building in workspace /var/lib/jenkins/jobs/test/workspace FATAL: could not read from vault: Vault responded with HTTP status code: 403 at path: secret/jenkins com.bettercloud.vault.VaultException: Vault responded with HTTP status code: 403 at com.bettercloud.vault.api.Logical.read(Logical.java:64) at com.datapipe.jenkins.vault.VaultAccessor.read(VaultAccessor.java:31) Caused: com.datapipe.jenkins.vault.exception.VaultPluginException: could not read from vault: Vault responded with HTTP status code: 403 at path: secret/jenkins at com.datapipe.jenkins.vault.VaultAccessor.read(VaultAccessor.java:33) at com.datapipe.jenkins.vault.VaultBuildWrapper.provideEnvironmentVariablesFromVault(VaultBuildWrapper.java:131) at com.datapipe.jenkins.vault.VaultBuildWrapper.setUp(VaultBuildWrapper.java:91) at jenkins.tasks.SimpleBuildWrapper.setUp(SimpleBuildWrapper.java:146) at hudson.model.Build$BuildExecution.doRun(Build.java:157) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:490) at hudson.model.Run.execute(Run.java:1735) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:415) Finished: FAILURE
Started by user admin Building in workspace /var/lib/jenkins/jobs/test/workspace [workspace] $ /bin/sh -xe /tmp/jenkins7754296936506828979.sh + curl -H X-Vault-Token: 98e0ef2d-5212-0dce-744b-a3977761aa88 -X GET http://1.2.3.4:8200/v1/secret/jenkins/vault_test_variable % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 100 196 100 196 0 0 87111 0 --:--:-- --:--:-- --:--:-- 98000 {"request_id":"69391266-7206-3fd0-bd25-2e02e42edad0","lease_id":"","renewable":false,"lease_duration":2764800,"data":{"value":"ThisIsTheCLIVariable"},"wrap_info":null,"warnings":null,"auth":null} Finished: SUCCESS
We dont have a com.datapipe.jenkins.vault.configuration.GlobalVaultConfiguration.xml - I assume because on the bare server, I didnt set up global credentials, just job-based ones. On our main 'dirty' server, I did try with global Vault configs and failed the same way.Here's the Vault audit log - Is it doing some weird encryption on the token that's not bein decrypted? We want to use 777c5c5d-1aea-6d2a-1c81-7e2f64add324:
{"time":"2017-07-06T22:38:49Z","type":"request","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null},"request":{"id":"da9f50d0-03a3-a3a7-11be-bff03d611c45","operation":"read","client_token":"hmac-sha256:d8ecf8341f665ee6b6eb6e4b7d93fce649a2c27cd6f72ae671e8148f0dde930c","path":"secret/jenkins","data":null,"remote_address":"5.6.7.8","wrap_ttl":0},"error":"permission denied"}{"time":"2017-07-06T22:38:49Z","type":"response","error":"1 error(s) occurred:\n\n* permission denied","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null},"request":{"id":"da9f50d0-03a3-a3a7-11be-bff03d611c45","operation":"read","client_token":"hmac-sha256:d8ecf8341f665ee6b6eb6e4b7d93fce649a2c27cd6f72ae671e8148f0dde930c","path":"secret/jenkins","data":null,"remote_address":"5.6.7.8","wrap_ttl":0},"response":{"data":{"error":"hmac-sha256:f229374491d17e573263711d8abacd2419da9df0f75ff97fae994cbba4d9bd89"}}}Here's credentials.xml:
<?xml version='1.0' encoding='UTF-8'?><com.cloudbees.plugins.credentials.SystemCredentialsProvider plugin="crede...@2.1.14"><domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash"><entry><com.cloudbees.plugins.credentials.domains.Domain><specifications/></com.cloudbees.plugins.credentials.domains.Domain><java.util.concurrent.CopyOnWriteArrayList>
<com.datapipe.jenkins.vault.credentials.VaultTokenCredential plugin="hashicorp-vault-plu...@2.1.0">
<com.datapipe.jenkins.vault.VaultBuildWrapper plugin="hashicorp-vault-plu...@2.1.0">
--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
GitHub Issues: https://github.com/hashicorp/vault/issues
IRC: #vault-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Vault" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vault-tool/88860306-d664-430b-b560-7e555043aa46%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+...@googlegroups.com.
{"request_id":"69391266-7206-3fd0-bd25-2e02e42edad0","lease_id":"","renewable":false,"lease_duration":2764800,"data":{"value":"ThisIsTheCLIVariable"},"wrap_info":null,"warnings":null,"auth":null}Is getting a different secret from your job configuration. I believe that's likely the (or a) problem. The curl command you're running (the one I pasted part of above) is getting a secret from /secret/jenkins/vault_test_variable, which has a single key in it, "value", with a value of "ThisIsTheCLIVariable".Hmm. The curl command with that token still works. Does the calling method matter for expiration/auth purposes (IE - Curl is allowed while the java call is not)?
On Thursday, July 6, 2017 at 3:54:12 PM UTC-7, Jason Antman wrote:
Unless you specifically set the audit backend to log sensitive information in the clear, by default it will only log HMAC-SHA256 hashes of anything sensitive, including the token/accessor; see https://www.vaultproject.io/docs/audit/index.htmlIf my memory serves me correctly, an audit log entry that includes:"auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null}but a HMAC-SHA256'ed client_token in the request, implies that the client used a token that was either invalid or expired, and therefore the 403 is because the client wasn't properly authenticated.First thing, I'd check that the token you've configured for Jenkins is correct (i.e. you gave Jenkins the token not the accessor, there wasn't a copy/paste error, and it hasn't expired yet).I can't see anything obviously wrong with the configs. The only thing I can see there as a possible cause for the problem, is the token configured in that credential being either wrong or expired...-Jason
On Thu, Jul 6, 2017 at 6:44 PM, <chris...@nike.com> wrote:
We dont have a com.datapipe.jenkins.vault.configuration.GlobalVaultConfiguration.xml - I assume because on the bare server, I didnt set up global credentials, just job-based ones. On our main 'dirty' server, I did try with global Vault configs and failed the same way.Here's the Vault audit log - Is it doing some weird encryption on the token that's not bein decrypted? We want to use 777c5c5d-1aea-6d2a-1c81-7e2f64add324:
{"time":"2017-07-06T22:38:49Z","type":"request","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null},"request":{"id":"da9f50d0-03a3-a3a7-11be-bff03d611c45","operation":"read","client_token":"hmac-sha256:d8ecf8341f665ee6b6eb6e4b7d93fce649a2c27cd6f72ae671e8148f0dde930c","path":"secret/jenkins","data":null,"remote_address":"5.6.7.8","wrap_ttl":0},"error":"permission denied"}{"time":"2017-07-06T22:38:49Z","type":"response","error":"1 error(s) occurred:\n\n* permission denied","auth":{"client_token":"","accessor":"","display_name":"","policies":null,"metadata":null},"request":{"id":"da9f50d0-03a3-a3a7-11be-bff03d611c45","operation":"read","client_token":"hmac-sha256:d8ecf8341f665ee6b6eb6e4b7d93fce649a2c27cd6f72ae671e8148f0dde930c","path":"secret/jenkins","data":null,"remote_address":"5.6.7.8","wrap_ttl":0},"response":{"data":{"error":"hmac-sha256:f229374491d17e573263711d8abacd2419da9df0f75ff97fae994cbba4d9bd89"}}}Here's credentials.xml:
<?xml version='1.0' encoding='UTF-8'?><com.cloudbees.plugins.credentials.SystemCredentialsProvider plugin="crede...@2.1.14"><domainCredentialsMap class="hudson.util.CopyOnWriteMap$Hash"><entry><com.cloudbees.plugins.credentials.domains.Domain><specifications/></com.cloudbees.plugins.credentials.domains.Domain><java.util.concurrent.CopyOnWriteArrayList>
<com.datapipe.jenkins.vault.credentials.VaultTokenCredential plugin="hashicorp-vault-plugin@2.1.0">
<com.datapipe.jenkins.vault.VaultBuildWrapper plugin="hashicorp-vault-plugin@2.1.0">
To unsubscribe from this group and stop receiving emails from it, send an email to vault-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vault-tool/a0946e59-ccdd-45e8-971f-50b57b47fb79%40googlegroups.com.
<com.datapipe.jenkins.vault.credentials.VaultTokenCredential plugin="hashicorp-vault-plu...@2.1.0">
<com.datapipe.jenkins.vault.VaultBuildWrapper plugin="hashicorp-vault-plu...@2.1.0">
AHA! :facepalm: You're exactly right. It was my mis-understanding of the syntax to insert keys with (I'll have to find the blog post I gleaned that from and comment on it).I thought the syntax was "vault write secret/<folder>/<keyname> value=<variable>".Should be "vault write secret/<folder> <keyname>=<value>".