2015-09-14 15:47:49 +00:00
|
|
|
---
|
|
|
|
layout: "docs"
|
|
|
|
page_title: "Secret Backend: Cubbyhole"
|
|
|
|
sidebar_current: "docs-secrets-cubbyhole"
|
|
|
|
description: |-
|
|
|
|
The cubbyhole secret backend can store arbitrary secrets scoped to a single token.
|
|
|
|
---
|
|
|
|
|
|
|
|
# Cubbyhole Secret Backend
|
|
|
|
|
|
|
|
Name: `cubbyhole`
|
|
|
|
|
|
|
|
The `cubbyhole` secret backend is used to store arbitrary secrets within
|
|
|
|
the configured physical storage for Vault. It is mounted at the `cubbyhole/`
|
|
|
|
prefix by default and cannot be mounted elsewhere or removed.
|
|
|
|
|
|
|
|
This backend differs from the `generic` backend in that the `generic` backend's
|
|
|
|
values are accessible to any token with read privileges on that path. In this
|
|
|
|
backend, paths are scoped per token; no token can read secrets placed in
|
|
|
|
another token's cubbyhole. When the token expires, its cubbyhole is destroyed.
|
|
|
|
|
|
|
|
Also unlike the `generic` backend, because the cubbyhole's lifetime is linked
|
|
|
|
to an authentication token, there is no concept of a lease or lease TTL for
|
|
|
|
values contained in the token's cubbyhole.
|
|
|
|
|
2016-01-14 19:18:27 +00:00
|
|
|
Writing to a key in the `cubbyhole` backend will replace the old value;
|
2015-09-14 15:47:49 +00:00
|
|
|
the sub-fields are not merged together.
|
|
|
|
|
|
|
|
## Quick Start
|
|
|
|
|
|
|
|
The `cubbyhole` backend allows for writing keys with arbitrary values.
|
|
|
|
|
|
|
|
As an example, we can write a new key "foo" to the `cubbyhole` backend, which
|
|
|
|
is mounted at `cubbyhole/`:
|
|
|
|
|
|
|
|
```
|
2015-10-12 16:10:22 +00:00
|
|
|
$ vault write cubbyhole/foo \
|
|
|
|
zip=zap
|
2015-09-14 15:47:49 +00:00
|
|
|
Success! Data written to: cubbyhole/foo
|
|
|
|
```
|
|
|
|
|
|
|
|
This writes the key with the "zip" field set to "zap". We can test this by doing
|
|
|
|
a read:
|
|
|
|
|
|
|
|
```
|
|
|
|
$ vault read cubbyhole/foo
|
|
|
|
Key Value
|
|
|
|
zip zap
|
|
|
|
```
|
|
|
|
|
|
|
|
As expected, the value previously set is returned to us.
|
2015-09-21 15:25:22 +00:00
|
|
|
|
|
|
|
## API
|
|
|
|
|
|
|
|
#### GET
|
|
|
|
|
|
|
|
<dl class="api">
|
|
|
|
<dt>Description</dt>
|
|
|
|
<dd>
|
|
|
|
Retrieves the secret at the specified location.
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Method</dt>
|
|
|
|
<dd>GET</dd>
|
|
|
|
|
|
|
|
<dt>URL</dt>
|
|
|
|
<dd>`/cubbyhole/<path>`</dd>
|
|
|
|
|
|
|
|
<dt>Parameters</dt>
|
|
|
|
<dd>
|
|
|
|
None
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Returns</dt>
|
|
|
|
<dd>
|
|
|
|
|
2015-10-12 16:10:22 +00:00
|
|
|
```javascript
|
|
|
|
{
|
2015-09-21 15:25:22 +00:00
|
|
|
"auth": null,
|
|
|
|
"data": {
|
2015-10-12 16:10:22 +00:00
|
|
|
"foo": "bar"
|
2015-09-21 15:25:22 +00:00
|
|
|
},
|
|
|
|
"lease_duration": 0,
|
|
|
|
"lease_id": "",
|
|
|
|
"renewable": false
|
2015-10-12 16:10:22 +00:00
|
|
|
}
|
|
|
|
```
|
2015-09-21 15:25:22 +00:00
|
|
|
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
2016-01-14 19:18:27 +00:00
|
|
|
#### LIST
|
|
|
|
|
|
|
|
<dl class="api">
|
|
|
|
<dt>Description</dt>
|
|
|
|
<dd>
|
|
|
|
Returns a list of secret entries at the specified location. Folders are
|
2016-01-19 22:05:01 +00:00
|
|
|
suffixed with `/`. The input must be a folder; list on a file will not
|
2016-01-19 23:09:26 +00:00
|
|
|
return a value. Note that no policy-based filtering is performed on
|
|
|
|
returned keys; it is not recommended to put sensitive or secret values as
|
|
|
|
key names. The values themselves are not accessible via this command.
|
2016-01-14 19:18:27 +00:00
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Method</dt>
|
|
|
|
<dd>GET</dd>
|
|
|
|
|
|
|
|
<dt>URL</dt>
|
|
|
|
<dd>`/cubbyhole/<path>?list=true`</dd>
|
|
|
|
|
|
|
|
<dt>Parameters</dt>
|
|
|
|
<dd>
|
|
|
|
None
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Returns</dt>
|
|
|
|
<dd>
|
|
|
|
The example below shows output for a query path of `cubbyhole/` when there
|
|
|
|
are secrets at `cubbyhole/foo` and `cubbyhole/foo/bar`; note the difference
|
|
|
|
in the two entries.
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
{
|
|
|
|
"auth": null,
|
|
|
|
"data": {
|
2016-01-19 22:05:01 +00:00
|
|
|
"keys": ["foo", "foo/"]
|
2016-01-14 19:18:27 +00:00
|
|
|
},
|
|
|
|
"lease_duration": 2592000,
|
|
|
|
"lease_id": "",
|
|
|
|
"renewable": false
|
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
</dd>
|
|
|
|
</dl>
|
|
|
|
|
2015-09-21 15:25:22 +00:00
|
|
|
#### POST/PUT
|
|
|
|
|
|
|
|
<dl class="api">
|
|
|
|
<dt>Description</dt>
|
|
|
|
<dd>
|
|
|
|
Stores a secret at the specified location.
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Method</dt>
|
|
|
|
<dd>POST/PUT</dd>
|
|
|
|
|
|
|
|
<dt>URL</dt>
|
|
|
|
<dd>`/cubbyhole/<path>`</dd>
|
|
|
|
|
|
|
|
<dt>Parameters</dt>
|
|
|
|
<dd>
|
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<span class="param">(key)</span>
|
|
|
|
<span class="param-flags">optional</span>
|
|
|
|
A key, paired with an associated value, to be held at the
|
|
|
|
given location. Multiple key/value pairs can be specified,
|
|
|
|
and all will be returned on a read operation.
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Returns</dt>
|
|
|
|
<dd>
|
|
|
|
A `204` response code.
|
|
|
|
</dd>
|
|
|
|
</dl>
|
2016-01-26 07:47:33 +00:00
|
|
|
|
|
|
|
#### DELETE
|
|
|
|
|
|
|
|
<dl class="api">
|
|
|
|
<dt>Description</dt>
|
|
|
|
<dd>
|
|
|
|
Deletes the secret at the specified location.
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Method</dt>
|
|
|
|
<dd>DELETE</dd>
|
|
|
|
|
|
|
|
<dt>URL</dt>
|
|
|
|
<dd>`/cubbyhole/<path>`</dd>
|
|
|
|
|
|
|
|
<dt>Parameters</dt>
|
|
|
|
<dd>
|
|
|
|
None
|
|
|
|
</dd>
|
|
|
|
|
|
|
|
<dt>Returns</dt>
|
|
|
|
<dd>
|
|
|
|
A `204` response code.
|
|
|
|
</dd>
|
|
|
|
</dl>
|