Commit Graph

389 Commits

Author SHA1 Message Date
Becca Petrin
fb89af7cfa Run all builtins as plugins (#5536) 2018-11-06 17:21:24 -08:00
Jim Kalafut
583003cf42 Update OpenAPI path parsing of alternation parameters (#5710)
This will handle patterns of the form:
  `^plugins/catalog/(?P<type>auth|database|secret)/(?P<name>.+)$`
2018-11-06 15:04:30 -08:00
Jim Kalafut
35328c50e7 Framework and API changes to support OpenAPI (#5546) 2018-11-05 12:24:39 -08:00
Vishal Nayak
448eb98987 Remove namespace.TestContext and namespace.TestNamespace (#5682) 2018-11-05 11:11:32 -05:00
Vishal Nayak
9a222b0faf Allow @ to be part of key name in TOTP secret engine (#5652)
* Allow @ to be part of key name in TOTP secret engine

* Allow @ for key name while generating the code
2018-10-31 12:57:18 -04:00
Jeff Mitchell
9975ace215 Add token type to sentinel docs, fix up some names, and better codify what Sentinel reports for various token types (#5630) 2018-10-27 11:07:27 -07:00
Matthew Irish
8c78bb54b2 Merge branch 'oss-master' into 1.0-beta-oss 2018-10-19 20:40:36 -05:00
Brian Kassouf
3dcb20fdd2 Plugin version negotiation (#5434)
* Plugin version updates

* Update datatbase plugins

* Revert netRPC deletions

* Revert netRPC deletions

* Update plugins to serve both versions

* Update database plugins

* Add Initialize back in

* revert pointer changes

* Add deprecation warning

* Update tests

* Update go-plugin

* Review Feedback
2018-10-19 15:56:17 -07:00
Jeff Mitchell
231c325770 Merge branch 'master-oss' into 1.0-beta-oss 2018-10-16 10:08:03 -04:00
Calvin Leung Huang
334e43a646 Update field data behavior (#5489)
* Update Get and getPrimitive to correctly handle nil and error values

* Return empty slice on zero length decode result
2018-10-15 10:36:13 -07:00
Jeff Mitchell
a58d313d2b Batch tokens (#755) 2018-10-15 12:56:24 -04:00
Joel Thompson
0510b7ec35 logical/aws: Harden WAL entry creation (#5202)
* logical/aws: Harden WAL entry creation

If AWS IAM user creation failed in any way, the WAL corresponding to the
IAM user would get left around and Vault would try to roll it back.
However, because the user never existed, the rollback failed. Thus, the
WAL would essentially get "stuck" and Vault would continually attempt to
roll it back, failing every time. A similar situation could arise if the
IAM user that Vault created got deleted out of band, or if Vault deleted
it but was unable to write the lease revocation back to storage (e.g., a
storage failure).

This attempts to harden it in two ways. One is by deleting the WAL log
entry if the IAM user creation fails. However, the WAL deletion could
still fail, and this wouldn't help where the user is deleted out of
band, so second, consider the user rolled back if the user just doesn't
exist, under certain circumstances.

Fixes #5190

* Fix segfault in expiration unit tests

TestExpiration_Tidy was passing in a leaseEntry that had a nil Secret,
which then caused a segfault as the changes to revokeEntry didn't check
whether Secret was nil; this is probably unlikely to occur in real life,
but good to be extra cautious.

* Fix potential segfault

Missed the else...

* Respond to PR feedback
2018-09-27 09:54:59 -05:00
Jeff Mitchell
e7c4158e60 Fix compilation/protobuf 2018-09-22 17:58:39 -04:00
andrejvanderzee
b194b27e2d Fix for using ExplicitMaxTTL in auth method plugins. (#5379)
* Fix for using ExplicitMaxTTL in auth method plugins.

* Reverted pb.go files for readability of PR.

* Fixed indenting of comment.

* Reverted unintended change by go test.
2018-09-21 14:31:29 -07:00
Jeff Mitchell
f9d85c3d68 BoundCidrs -> BoundCIDRs 2018-09-20 12:45:49 -04:00
Clint
f39bafbf9c Translate AWS Rate limiting errors to 502 errors (#5270)
* Initial implemntation of returning 529 for rate limits

- bump aws iam and sts packages to v1.14.31 to get mocking interface
- promote the iam and sts clients to the aws backend struct, for mocking in tests
- this also promotes some functions to methods on the Backend struct, so
  that we can use the injected client

Generating creds requires reading config/root for credentials to contact
IAM. Here we make pathConfigRoot a method on aws/backend so we can clear
the clients on successful update of config/root path. Adds a mutex to
safely clear the clients

* refactor locking and unlocking into methods on *backend

* refactor/simply the locking

* check client after grabbing lock
2018-09-18 15:26:06 -05:00
Jeff Mitchell
b7d6d55ac1 The big one (#5346) 2018-09-17 23:03:00 -04:00
Clint Shryock
c5ad933ab0 Add error logical.ErrUpstreamRateLimited and return 502 from RespondCommonError 2018-09-05 11:07:50 -05:00
Jeff Mitchell
2d9ed65175 Re-add injecting into top routes (#5244) 2018-09-05 11:45:17 -04:00
Jeff Mitchell
b80170787b Move sort from listresponse to file backend to solve 5141 2018-08-24 13:37:15 -04:00
Jeff Mitchell
c3eae776e2 Order list responses (#5178)
We do this already in the CLI, but because we do it there the UI doesn't
have ordered responses.

We could put it in the UI, but it seems like we might as well just make
it nice for all API users.

Fixes #5141
2018-08-24 13:31:28 -04:00
Jeff Mitchell
9cf497f688 Remove injection into top routes (#5101) 2018-08-14 15:29:22 -04:00
Becca Petrin
13a2bb152e Add a header type field (#4993) 2018-08-13 11:02:44 -07:00
Jeff Mitchell
a8c1f7bed5 Port over ns identity proto info 2018-08-10 12:45:34 -04:00
Jim Kalafut
bb180b8661 Add PluginEnv to SystemView (#5028) 2018-08-03 09:32:17 -07:00
Jeff Mitchell
b9adaf9c69 Add request timeouts in normal request path and to expirations (#4971)
* Add request timeouts in normal request path and to expirations

* Add ability to adjust default max request duration

* Some test fixes

* Ensure tests have defaults set for max request duration

* Add context cancel checking to inmem/file

* Fix tests

* Fix tests

* Set default max request duration to basically infinity for this release for BC

* Address feedback
2018-07-24 14:50:49 -07:00
Jeff Mitchell
24b032aad5 Pass identity metadata through to plugins (#4967)
It's not obvious why this should be secret, and if it were considered
secret, when and what anything would ever be allowed to access it.
Likely the right way to tie secret values to particular
entities/aliases/groups would be to use the upcoming templated ACL
feature.
2018-07-23 12:45:06 -04:00
Brian Kassouf
e3dc93c50c plugins: Allow the server to receive large messages (#4958) 2018-07-20 14:11:00 -04:00
Becca Petrin
d78934de05 Disallow negative TypeDurationSecond (#4910)
* add mount ttl helper

* disallow negative TypeDurationSecond values
2018-07-17 17:46:03 -07:00
Jeff Mitchell
5269abb64c Fix tests 2018-07-12 10:18:50 -04:00
Jeff Mitchell
a831fb4c5a Make single-lease revocation behave like expiration (#4883)
This change makes it so that if a lease is revoked through user action,
we set the expiration time to now and update pending, just as we do with
tokens. This allows the normal retry logic to apply in these cases as
well, instead of just erroring out immediately. The idea being that once
you tell Vault to revoke something it should keep doing its darndest to
actually make that happen.
2018-07-11 15:45:35 -04:00
Jeff Mitchell
ff8becca15 Make proto
It appears the only thing that actually change is that the tag got
`proto3` values added.
2018-07-10 20:49:48 -04:00
Seth Vargo
8ac73469a3 Handle multierr when altering response codes (#4881) 2018-07-09 13:08:44 -07:00
Becca Petrin
b3a711d717 Add bound cidrs to tokens in AppRole (#4680) 2018-06-19 22:57:11 -04:00
Jeff Mitchell
765fe529d6 Changes the way policies are reported in audit logs (#4747)
* This changes the way policies are reported in audit logs.

Previously, only policies tied to tokens would be reported. This could
make it difficult to perform after-the-fact analysis based on both the
initial response entry and further requests. Now, the full set of
applicable policies from both the token and any derived policies from
Identity are reported.

To keep things consistent, token authentications now also return the
full set of policies in api.Secret.Auth responses, so this both makes it
easier for users to understand their actual full set, and it matches
what the audit logs now report.
2018-06-14 09:49:33 -04:00
Jeff Mitchell
e1a89e0d55 Some atomic cleanup (#4732)
Taking inspiration from
https://github.com/golang/go/issues/17604#issuecomment-256384471
suggests that taking the address of a stack variable for use in atomics
works (at least, the race detector doesn't complain) but is doing it
wrong.

The only other change is a change in Leader() detecting if HA is enabled
to fast-path out. This value never changes after NewCore, so we don't
need to grab the read lock to check it.
2018-06-09 15:35:22 -04:00
Jeff Mitchell
a73d55b591 Move TokenEntry into logical. (#4729)
This allows the HTTP logicalAuth handler to cache the value in the
logical.Request, avoiding a lookup later when performing acl
checks/counting a use.
2018-06-08 17:24:27 -04:00
Jeff Mitchell
cc003bb239 Offline token revocation fix 2018-06-05 18:53:27 -04:00
Chris Hoffman
3b1ade706c adding option go_package to protos (#4687)
* adding option go_package to protos

* switching proto output dir to relative paths
2018-06-04 10:19:26 -04:00
Chris Hoffman
51bc3d8891 Add entity information request to system view (#4681)
* Add entity information request to system view

* fixing a few comments

* sharing types between plugin and logical

* sharing types between plugin and logical

* fixing output directory for proto

* removing extra replacement

* adding mount type lookup

* empty entities return nil instead of error

* adding some comments
2018-06-03 20:48:12 -04:00
Jim Kalafut
5d973885b4 Add TypeLowerCaseString (#4683) 2018-06-01 18:30:59 -07:00
Brian Kassouf
aeb29a5048 Update proto files (#4651) 2018-05-29 18:23:51 -04:00
Becca Petrin
5f342b4aa0 Shorten code by using ParseAddrs (#4546) 2018-05-10 13:21:55 -07:00
Jeff Mitchell
146e8f6c9c Fix response wrapping from K/V version 2 (#4511)
This takes place in two parts, since working on this exposed an issue
with response wrapping when there is a raw body set. The changes are (in
diff order):

* A CurrentWrappingLookupFunc has been added to return the current
value. This is necessary for the lookahead call since we don't want the
lookahead call to be wrapped.

* Support for unwrapping < 0.6.2 tokens via the API/CLI has been
removed, because we now have backends returning 404s with data and can't
rely on the 404 trick. These can still be read manually via
cubbyhole/response.

* KV preflight version request now ensures that its calls is not
wrapped, and restores any given function after.

* When responding with a raw body, instead of always base64-decoding a
string value and erroring on failure, on failure we assume that it
simply wasn't a base64-encoded value and use it as is.

* A test that fails on master and works now that ensures that raw body
responses that are wrapped and then unwrapped return the expected
values.

* A flag for response data that indicates to the wrapping handling that
the data contained therein is already JSON decoded (more later).

* RespondWithStatusCode now defaults to a string so that the value is
HMAC'd during audit. The function always JSON encodes the body, so
before now it was always returning []byte which would skip HMACing. We
don't know what's in the data, so this is a "better safe than sorry"
issue. If different behavior is needed, backends can always manually
populate the data instead of relying on the helper function.

* We now check unwrapped data after unwrapping to see if there were raw
flags. If so, we try to detect whether the value can be unbase64'd. The
reason is that if it can it was probably originally a []byte and
shouldn't be audit HMAC'd; if not, it was probably originally a string
and should be. In either case, we then set the value as the raw body and
hit the flag indicating that it's already been JSON decoded so not to
try again before auditing. Doing it this way ensures the right typing.

* There is now a check to see if the data coming from unwrapping is
already JSON decoded and if so the decoding is skipped before setting
the audit response.
2018-05-10 15:40:03 -04:00
Becca Petrin
df4b650e61 Restrict cert auth by CIDR (#4478) 2018-05-09 15:39:55 -07:00
Jeff Mitchell
b61b541581 Revert "proto changes (#4503)" (#4504)
This reverts commit 14594bd76e.
2018-05-03 15:38:53 -04:00
Vishal Nayak
14594bd76e proto changes (#4503) 2018-05-03 15:23:14 -04:00
Becca Petrin
ab9b638dbb New proto version (#4501) 2018-05-03 10:19:39 -07:00
Calvin Leung Huang
1bbdc2ce84 Early skip mssql test if not on acceptance, defer Teardown() early in testing.Test (#4457) 2018-04-26 12:17:44 -04:00
Jeff Mitchell
b82bd7420e Use permission denied for entity disabling 2018-04-23 16:50:04 -04:00