Commit Graph

51 Commits

Author SHA1 Message Date
Kris Hicks
85ed8ddd4f Add gosimple linter (#9590) 2020-12-09 11:05:18 -08:00
Yoan Blanc
77cf2f0573 vendor: vault api and sdk
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-21 17:57:48 +01:00
Seth Hoenig
674ccaa122 nomad: proxy requests for Service Identity tokens between Clients and Consul
Nomad jobs may be configured with a TaskGroup which contains a Service
definition that is Consul Connect enabled. These service definitions end
up establishing a Consul Connect Proxy Task (e.g. envoy, by default). In
the case where Consul ACLs are enabled, a Service Identity token is required
for these tasks to run & connect, etc. This changeset enables the Nomad Server
to recieve RPC requests for the derivation of SI tokens on behalf of instances
of Consul Connect using Tasks. Those tokens are then relayed back to the
requesting Client, which then injects the tokens in the secrets directory of
the Task.
2020-01-31 19:03:53 -06:00
Seth Hoenig
f8666bb1f9 client: enable nomad client to request and set SI tokens for tasks
When a job is configured with Consul Connect aware tasks (i.e. sidecar),
the Nomad Client should be able to request from Consul (through Nomad Server)
Service Identity tokens specific to those tasks.
2020-01-31 19:03:38 -06:00
Michael Schurter
523586a6e6 vault: remove dead lease code 2019-10-25 15:08:35 -07:00
Michael Schurter
b135d28450 vault: fix data races 2019-04-16 11:22:44 -07:00
Michael Schurter
0e6da17a8f vault: fix renewal time
Renewal time was being calculated as 10s+Intn(lease-10s), so the renewal
time could be very rapid or within 1s of the deadline: [10s, lease)

This commit fixes the renewal time by calculating it as:

	(lease/2) +/- 10s

For a lease of 60s this means the renewal will occur in [20s, 40s).
2019-04-16 11:22:44 -07:00
Chris Baker
2022db72b6 vault client test: minor formatting
vendor: using upstream circonus-gometrics
2019-04-10 10:34:10 -05:00
Chris Baker
20a3884559 docs: -vault-namespace, VAULT_NAMESPACE, and config
agent: added VAULT_NAMESPACE env-based configuration
2019-04-10 10:34:10 -05:00
Chris Baker
1349497152 config/docs: added namespace to vault config
server/client: process `namespace` config, setting on the instantiated vault client
2019-04-10 10:34:10 -05:00
Michael Schurter
b41308f16a tests: port TestTaskRunner_BlockForVault from 0.8
Also fix race conditions in the mock vault client.
2019-02-12 13:46:09 -08:00
Alex Dadgar
95297c608c goimports 2019-01-22 15:44:31 -08:00
Danielle Tomlinson
8a4ffea94a chore: Cleanup formatting 2019-01-17 18:43:13 +01:00
Danielle Tomlinson
dcce2d7247 vaultclient: use require for error assertions 2019-01-17 18:43:13 +01:00
Danielle Tomlinson
3078c24f79 vaultclient: Update tests for vault 1.0 2019-01-17 18:43:13 +01:00
Mahmood Ali
0fc84f4cfb address review comments 2018-11-20 17:10:54 -05:00
Mahmood Ali
88c1698ef5 Emit metric counters for Vault token and renewal failures 2018-11-20 17:10:54 -05:00
Mahmood Ali
feaf6214f9 Set User-Agent header when hitting Vault API 2018-11-20 17:10:54 -05:00
Alex Dadgar
f91b269b2a fix test compiling 2018-10-16 16:56:55 -07:00
Michael Schurter
9da25adc54 client: hclog-ify most of the client
Leaving fingerprinters in case that interface changes with plugins.
2018-10-16 16:53:30 -07:00
Alex Dadgar
98c7abe541 Tests only use testlog package logger 2018-06-13 15:40:56 -07:00
Michael Schurter
8da7335c16 non-Existent -> nonexistent
Reverting from #3963

https://www.merriam-webster.com/dictionary/existent
2018-03-12 11:59:33 -07:00
Josh Soref
02a8be09f9 spelling: semantics 2018-03-11 19:00:26 +00:00
Filip Ochnik
38996137cf Recognize renewing non-renewable Vault lease as fatal 2018-01-08 20:32:31 +01:00
Michael Schurter
04b8f8e7fc Remove structs import from api
Goes a step further and removes structs import from api's tests as well
by moving GenerateUUID to its own package.
2017-09-29 10:36:08 -07:00
Alex Dadgar
a9e3a41407 Enable more linters 2017-09-26 15:26:33 -07:00
Alex Dadgar
8c9234e319 Make test Vault pick random ports 2017-07-25 17:40:59 -07:00
Alex Dadgar
82dd0fad5a faster vaultclient 2017-07-21 19:38:37 -07:00
Alex Dadgar
c6a796e67f Stop Vault token renew on task exit
This PR fixes an oversight in which the client would attempt to renew a
token even after the task exits.

Fixes https://github.com/hashicorp/nomad/issues/2475
2017-03-28 10:53:15 -07:00
Alex Dadgar
07f7e19578 Fix vet script and fix vet problems
This PR fixes our vet script and fixes all the missed vet changes.

It also fixes pointers being printed in `nomad stop <job>` and `nomad
node-status <node>`.
2017-02-27 16:00:19 -08:00
Alex Dadgar
22b64a53cf Better derive token logging 2017-02-14 16:46:54 -08:00
Alex Dadgar
9e822a2e8f Fix race condition with Deriving vault tokens
This PR fixes a race condition in which the client was not locked while
deriving Vault tokens. This allowed the token to be set which would
cause subsequent Vault requests to fail with permission denied because
the incorrect Vault token was being used.

Further this PR makes the unsetting and unlocking of the client atomic
to avoid an even harder to hit race condition (not sure it was ever hit
but was still incorrect).
2017-02-01 16:25:59 -08:00
Alex Dadgar
4048d1db5c Comments 2016-10-18 11:36:04 -07:00
Alex Dadgar
ae288a3ee6 Tests 2016-10-18 11:24:20 -07:00
Alex Dadgar
e34902ae8a Large refactor of task runner and Vault token rehandling 2016-10-18 11:24:20 -07:00
Alex Dadgar
7daa4706a6 Tests 2016-10-11 13:28:18 -07:00
Alex Dadgar
9ff2bf0bff Fix Vault parsing of booleans 2016-10-10 18:04:39 -07:00
Alex Dadgar
cd8784894d Alloc runner tests 2016-09-15 17:24:09 -07:00
Alex Dadgar
5532e911cb Fix token renewal 2016-09-15 11:20:51 -07:00
Alex Dadgar
c89fd0eb08 Clean up vault client 2016-09-14 18:10:56 -07:00
Alex Dadgar
bec6adb2ee Vault token threaded 2016-09-14 13:30:01 -07:00
Alex Dadgar
f9391f041c Fingerprint 2016-09-01 11:10:14 -07:00
vishalnayak
13d97f01bb Print debug message only when error is non-nil 2016-08-30 13:14:34 -04:00
vishalnayak
68b1b30bf5 Addressed review feedback 2016-08-30 13:08:13 -04:00
vishalnayak
082d5e58a4 Return only fatal error to renewal error channel 2016-08-30 12:46:59 -04:00
vishalnayak
dd26f9b4bf Fix tests 2016-08-29 21:30:06 -04:00
vishalnayak
72d2e9d2dd tokenDeriver function pointer to derive tokens.
Remove rpc*, connPool, node and region from vaultclient.
2016-08-29 20:32:05 -04:00
vishalnayak
603d7b09d8 Use Job.LookupTaskGroup 2016-08-29 16:34:39 -04:00
vishalnayak
7f919c9d74 Address review feedback 2016-08-29 12:47:33 -04:00
vishalnayak
04fab3bc81 Employ DeriveVaultToken API and flesh-up DeriveToken 2016-08-24 12:29:59 -04:00