chef-vault 2.5.0 → 2.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop_todo.yml +5 -1
- data/.travis.yml +5 -1
- data/Changelog.md +36 -3
- data/KNIFE_EXAMPLES.md +49 -74
- data/README.md +166 -104
- data/THEORY.md +4 -2
- data/bin/chef-vault +2 -2
- data/chef-vault.gemspec +2 -2
- data/features/clean_on_refresh.feature +28 -0
- data/features/isvault.feature +24 -0
- data/features/itemtype.feature +25 -0
- data/features/step_definitions/chef-databag.rb +4 -0
- data/features/step_definitions/chef-vault.rb +21 -0
- data/features/step_definitions/chef_databagitem.rb +9 -0
- data/features/vault_show_vaultname.feature +22 -0
- data/features/vault_update.feature +1 -1
- data/features/verify_id_matches.feature +11 -0
- data/lib/chef-vault/certificate.rb +1 -1
- data/lib/chef-vault/exceptions.rb +3 -0
- data/lib/chef-vault/item.rb +161 -18
- data/lib/chef-vault/user.rb +1 -1
- data/lib/chef-vault/version.rb +1 -1
- data/lib/chef/knife/decrypt.rb +1 -1
- data/lib/chef/knife/encrypt_create.rb +1 -1
- data/lib/chef/knife/encrypt_delete.rb +1 -1
- data/lib/chef/knife/encrypt_remove.rb +1 -1
- data/lib/chef/knife/encrypt_rotate_keys.rb +1 -1
- data/lib/chef/knife/encrypt_update.rb +1 -1
- data/lib/chef/knife/vault_base.rb +22 -0
- data/lib/chef/knife/vault_create.rb +0 -1
- data/lib/chef/knife/vault_decrypt.rb +1 -1
- data/lib/chef/knife/vault_isvault.rb +43 -0
- data/lib/chef/knife/vault_itemtype.rb +43 -0
- data/lib/chef/knife/vault_list.rb +7 -18
- data/lib/chef/knife/vault_refresh.rb +6 -12
- data/lib/chef/knife/vault_rotate_all_keys.rb +1 -1
- data/lib/chef/knife/vault_show.rb +15 -1
- data/lib/chef/knife/vault_update.rb +1 -1
- data/spec/chef-vault/certificate_spec.rb +9 -2
- data/spec/chef-vault/item_spec.rb +164 -3
- data/spec/chef-vault/user_spec.rb +9 -2
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b27ba9a529d3f084f1e83119a6b6bf91819ba3a
|
4
|
+
data.tar.gz: eacae88edbe78fc8e0a27c7f6e5680b1e75e974d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d18b4a6f3cfedf225041ee9b6e8c05b2c476f9fa8f04903038cec23bf631ee9a135c6c7199c26ce49971ed415651b22ec552bacd2cc684aa4a749096db90c81
|
7
|
+
data.tar.gz: 0895619aff3da11cb0d024bb87d8cbe00ba1330b4aa80bd6537cf1d2600f6b814e63ea291338c69d08456633d572d0464ab6a0b278018a0d7f95a8d2cd74070f
|
data/.rubocop_todo.yml
CHANGED
@@ -5,6 +5,10 @@
|
|
5
5
|
# Note that changes in the inspected code, or installation of new
|
6
6
|
# versions of RuboCop, may require this file to be generated again.
|
7
7
|
|
8
|
+
AllCops:
|
9
|
+
Exclude:
|
10
|
+
- 'features/step_definitions/*.rb'
|
11
|
+
|
8
12
|
# Offense count: 12
|
9
13
|
Metrics/AbcSize:
|
10
14
|
Max: 43
|
@@ -16,7 +20,7 @@ Metrics/BlockNesting:
|
|
16
20
|
# Offense count: 1
|
17
21
|
# Configuration parameters: CountComments.
|
18
22
|
Metrics/ClassLength:
|
19
|
-
Max:
|
23
|
+
Max: 306
|
20
24
|
|
21
25
|
# Offense count: 5
|
22
26
|
Metrics/CyclomaticComplexity:
|
data/.travis.yml
CHANGED
data/Changelog.md
CHANGED
@@ -1,7 +1,4 @@
|
|
1
1
|
## Planned (Unreleased)
|
2
|
-
## v2.6.0
|
3
|
-
|
4
|
-
This release will focus on adding any new features covered by open issues
|
5
2
|
|
6
3
|
## v2.7.0
|
7
4
|
|
@@ -27,7 +24,24 @@ chef-vault issues on github for news).
|
|
27
24
|
This release will also remove the chef-vault 1.x commands (encrypt/decrypt)
|
28
25
|
|
29
26
|
## Released
|
27
|
+
|
28
|
+
## v2.6.0 / 2015-05-13
|
29
|
+
|
30
|
+
* ChefVault::Item#clients can now accept a Chef::ApiClient object instead of a search string. Requested by @lamont-granquist to make implementing chef-vault into `knife bootstrap` easier
|
31
|
+
* allow Ruby 1.9.3 failures to not cause the overall build to fail on Travis
|
32
|
+
* switch to latest 2.0.x, 2.1.x, and 2.2.x releases of Ruby
|
33
|
+
* add --clean-unknown-clients switch to `knife vault refresh`
|
34
|
+
* as a side effect, `ChefVault::Item` now has a `#refresh` method which can be used to programatically perform the same operation as `knife vault refresh`
|
35
|
+
* enhance 'knife vault show VAULTNAME' (without an item name) to list the names of the items in the vault for parity with 'knife data bag show'
|
36
|
+
* add #raw_keys to ChefVault::Item that calls #keys on the underlying data bag item. We can't make ChefVault::Item work like a true hash without breaking the public API, but this at least makes it easier to get a list of keys
|
37
|
+
* allow ChefVault::Item.new and ChefVault::Item.load to specify an alternate node name and client key path. See the README for the use case this serves.
|
38
|
+
* added ChefVault::Item.vault? predicate that returns true if the item is a vault and false otherwise
|
39
|
+
* added ChefVault::Item.data_bag_item_type method that returns one of :normal, :encrypted or :vault
|
40
|
+
* added 'knife vault isvault VAULT ITEM' subcommand that exits 0 if the item is a vault and 1 if it is not
|
41
|
+
* added 'knife vault itemtype VAULT ITEM' subcommand that outputs 'normal', 'encrypted' or 'vault'
|
42
|
+
|
30
43
|
## v2.5.0 / 2015-02-09
|
44
|
+
|
31
45
|
* when decrypting, if the vault is encrypted for the node but decryption fails, emit a more friendly error message than 'OpenSSL::PKey::RSAError: padding check failed'
|
32
46
|
* when attempting to add a client key to a vault item, warn and skip if the node doesn't have a public key (reported by Nik Ormseth)
|
33
47
|
* add a new 'knife vault list' command that lists the data bags that are vaults
|
@@ -36,23 +50,28 @@ This release will also remove the chef-vault 1.x commands (encrypt/decrypt)
|
|
36
50
|
* add rubocop tasks to Rakefile and take a first pass at the low-hanging fruit
|
37
51
|
|
38
52
|
## v2.4.0 / 2014-12-03
|
53
|
+
|
39
54
|
* add simplecov test coverage configuration (Doug Ireton)
|
40
55
|
* add --clean-unknown-clients switch to knife remove/rotate (Thomas Gschwind and Reto Hermann)
|
41
56
|
|
42
57
|
## v2.3.0 / 2014-10-22
|
58
|
+
|
43
59
|
* add --clean switch to knife update (thanks to Matt Brimstone)
|
44
60
|
* added aruba CLI testing framework (just for --clean option for now)
|
45
61
|
* add Ruby 2.0.x and 2.1.x to Travis platforms
|
46
62
|
|
47
63
|
## v2.2.2 / 2014-06-03
|
64
|
+
|
48
65
|
* Add knife vault refresh command
|
49
66
|
* Use node_name as a default admin
|
50
67
|
* Add DEMO for users
|
51
68
|
|
52
69
|
## v2.2.1 / 2014-02-26
|
70
|
+
|
53
71
|
* Add vault_admins to knife.rb for a default set of vault admins
|
54
72
|
|
55
73
|
## v2.2.0 / 2014-01-21
|
74
|
+
|
56
75
|
* Validate data bag ID before saving
|
57
76
|
* Add search_query to vault metadata
|
58
77
|
* Refactor knife commands to be knife vault verb
|
@@ -64,16 +83,19 @@ This release will also remove the chef-vault 1.x commands (encrypt/decrypt)
|
|
64
83
|
* Fix more README typos
|
65
84
|
|
66
85
|
## v2.1.0 / 2013-12-23
|
86
|
+
|
67
87
|
* Update README to correct typos
|
68
88
|
* Modify admin loading to fall back to clients endpoint if not found in users endpoint
|
69
89
|
* Add --file to "knife encrypt update" & "knife encrypt create" to do file encryption in chef-vault. It will create a key called "file-content" & "file-name"
|
70
90
|
* When VALUES is not supplied print the whole vault item
|
71
91
|
|
72
92
|
## v2.0.2 / 2013-09-10
|
93
|
+
|
73
94
|
* Modify written data bag json files in solo mode to be valid for the knife data bag from file command
|
74
95
|
* Modify knife encrypt remove to automatically rotate keys
|
75
96
|
|
76
97
|
## v2.0.1 / 2013-09-03
|
98
|
+
|
77
99
|
* Removal of knife encrypt certs
|
78
100
|
* Removal of knife encrypt passwords
|
79
101
|
* Add knife encrypt create
|
@@ -89,33 +111,44 @@ This release will also remove the chef-vault 1.x commands (encrypt/decrypt)
|
|
89
111
|
* Modify ChefVault::Certificate to use ChefVault::Item to maintain backwards compatability
|
90
112
|
|
91
113
|
## v1.2.5 / 2013-07-22
|
114
|
+
|
92
115
|
* Update compat to be class ChefVault not module ChefVault to remove knife errors
|
93
116
|
* Allow nodes/clients to be used as Admins
|
94
117
|
|
95
118
|
## v1.2.4 / 2013-07-01
|
119
|
+
|
96
120
|
* Move compat include into the lazy-load deps
|
97
121
|
* Modify open file commands in knife commands to avoid file locking on windows
|
98
122
|
|
99
123
|
## v1.2.3 / 2013-04-30
|
124
|
+
|
100
125
|
* Update to use attr_accessor in chef_vault
|
101
126
|
* Add rspec tests
|
102
127
|
|
103
128
|
## v1.2.2 / 2013-04-23
|
129
|
+
|
104
130
|
* Update to create data bag folder if it does not already exist
|
105
131
|
|
106
132
|
## v1.2.1 / 2013-04-23
|
133
|
+
|
107
134
|
* Clarify Readme
|
108
135
|
|
109
136
|
## v1.0.1 / 2013-04-12
|
137
|
+
|
110
138
|
* Compatibility with Chef 10/11 (Shef vs Chef-Shell)
|
111
139
|
|
112
140
|
## v1.0.0 / 2013-04-08
|
141
|
+
|
113
142
|
* Rename from Chef-Keepass to Chef-Vault
|
114
143
|
|
115
144
|
## v0.2.1 / 2013-04/05
|
145
|
+
|
116
146
|
* Add Certificate class
|
117
147
|
|
118
148
|
## v0.2.0 / 2013-04-05
|
149
|
+
|
119
150
|
* Add encrypt cert
|
120
151
|
|
121
152
|
## v0.1.1 / 2013-03-14
|
153
|
+
|
154
|
+
* initial release
|
data/KNIFE_EXAMPLES.md
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
# knife examples
|
2
2
|
|
3
3
|
## vault
|
4
|
-
|
4
|
+
|
5
|
+
knife vault SUBCOMMAND VAULT ITEM VALUES
|
5
6
|
|
6
7
|
These are the commands that are used to take data in JSON format and encrypt that data into chef-vault style encrypted data bags in chef.
|
7
8
|
|
8
|
-
*
|
9
|
-
*
|
10
|
-
*
|
9
|
+
* vault - This is the name of the vault in which to store the encrypted item. This is analogous to a chef data bag name
|
10
|
+
* item - The name of the item going in to the vault. This is analogous to a chef data bag item id
|
11
|
+
* values - This is the JSON clear text data to be stored in the vault encrypted. This is analogous to a chef data bag item data
|
11
12
|
|
12
13
|
## vault commands
|
13
14
|
|
@@ -31,6 +32,7 @@ Create a vault called passwords and put an item called root in it encrypted for
|
|
31
32
|
Note: A JSON file can be used in place of specifying the values on the command line, see global options below for details
|
32
33
|
|
33
34
|
### update
|
35
|
+
|
34
36
|
Update the values in username and password in the vault passwords and item root. Will overwrite existing values if values already exist!
|
35
37
|
|
36
38
|
knife vault update passwords root '{"username": "root", "password": "mypassword"}'
|
@@ -62,6 +64,7 @@ Add admin1 & admin2 to encrypted admins and role:webserver to encrypted clients
|
|
62
64
|
Note: A JSON file can be used in place of specifying the values on the command line, see global options below for details
|
63
65
|
|
64
66
|
### remove
|
67
|
+
|
65
68
|
Remove the values in username and password from the vault passwords and item root.
|
66
69
|
|
67
70
|
knife vault remove passwords root '{"username": "root", "password": "mypassword"}'
|
@@ -91,18 +94,24 @@ Remove admin1 & admin2 from encrypted admins and role:webserver from encrypted c
|
|
91
94
|
knife vault remove passwords root -S "role:webserver" -A "admin1,admin2"
|
92
95
|
|
93
96
|
### delete
|
97
|
+
|
94
98
|
Delete the item root from the vault passwords
|
95
99
|
|
96
100
|
knife vault delete passwords root
|
97
101
|
|
98
102
|
### show
|
99
|
-
|
103
|
+
|
104
|
+
knife vault show VAULT [ITEM] [VALUES]
|
100
105
|
|
101
106
|
These are the commands that are used to decrypt a chef-vault encrypted item and show the requested values.
|
102
107
|
|
103
|
-
*
|
104
|
-
*
|
105
|
-
*
|
108
|
+
* vault - This is the name of the vault in which to store the encrypted item. This is analogous to a chef data bag name
|
109
|
+
* item - The name of the item going in to the vault. This is analogous to a chef data bag item id
|
110
|
+
* values - This is a comma list of values to decrypt from the vault item. This is analogous to a list of hash keys.
|
111
|
+
|
112
|
+
Show the items in a vault
|
113
|
+
|
114
|
+
knife vault show passwords
|
106
115
|
|
107
116
|
Show the entire root item in the passwords vault and print in JSON format.
|
108
117
|
|
@@ -121,6 +130,7 @@ Show the contents for the item user_pem in the vault certs.
|
|
121
130
|
knife vault show certs user_pem "contents"
|
122
131
|
|
123
132
|
### edit
|
133
|
+
|
124
134
|
knife vault edit VAULT ITEM
|
125
135
|
|
126
136
|
These are the commands that are used to edit a chef-vault encrypted item.
|
@@ -133,11 +143,13 @@ Decrypt the entire root item in the passwords vault and open it in json format i
|
|
133
143
|
knife vault edit passwords root
|
134
144
|
|
135
145
|
### download
|
146
|
+
|
136
147
|
Decrypt and download an encrypted file to the specified path.
|
137
148
|
|
138
149
|
knife vault download certs user_pem ~/downloaded_user_pem
|
139
150
|
|
140
151
|
### rotate keys
|
152
|
+
|
141
153
|
Rotate the shared key for the vault passwords and item root. The shared key is that which is used for the chef encrypted data bag item.
|
142
154
|
|
143
155
|
knife vault rotate keys passwords root
|
@@ -147,6 +159,7 @@ To remove clients which have been deleted from Chef but not from the vault, add
|
|
147
159
|
knife vault rotate keys passwords root --clean-unknown-clients
|
148
160
|
|
149
161
|
### rotate all keys
|
162
|
+
|
150
163
|
Rotate the shared key for all vaults and items. The shared key is that which is used for the chef encrypted data bag item.
|
151
164
|
|
152
165
|
knife vault rotate all keys
|
@@ -156,74 +169,36 @@ To remove clients which have been deleted from Chef but not from the vault, add
|
|
156
169
|
knife vault rotate keys passwords root --clean-unknown-clients
|
157
170
|
|
158
171
|
### refresh
|
172
|
+
|
159
173
|
This command reads the search_query in the vault item, performs the search, and reapplies the results.
|
160
174
|
|
161
175
|
knife vault refresh VAULT ITEM
|
162
176
|
|
177
|
+
To remove clients which have been deleted from Chef but not from the vault, add the --clean-unknown-clients switch:
|
178
|
+
|
179
|
+
knife vault refresh passwords root --clean-unknown-clients
|
180
|
+
|
181
|
+
### isvault
|
182
|
+
|
183
|
+
This command checks if the given item is a vault or not, and exit with a status of 0 if it is and 1 if it is not.
|
184
|
+
|
185
|
+
knife vault isvault VAULT ITEM
|
186
|
+
|
187
|
+
### itemtype
|
188
|
+
|
189
|
+
This command outputs the type of the data bag item: normal, encrypted or vault
|
190
|
+
|
191
|
+
knife vault itemtype VAULT ITEM
|
192
|
+
|
163
193
|
### global options
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
<td>--mode MODE</td>
|
176
|
-
<td>Chef mode to run in</td>
|
177
|
-
<td>solo</td>
|
178
|
-
<td>"solo", "client"</td>
|
179
|
-
<td>all</td>
|
180
|
-
</tr>
|
181
|
-
<tr>
|
182
|
-
<td>-S SEARCH</td>
|
183
|
-
<td>--search SEARCH</td>
|
184
|
-
<td>Chef Server SOLR Search Of Nodes</td>
|
185
|
-
<td>nil</td>
|
186
|
-
<td></td>
|
187
|
-
<td>create, remove, update</td>
|
188
|
-
</tr>
|
189
|
-
<tr>
|
190
|
-
<td>-A ADMINS</td>
|
191
|
-
<td>--admins ADMINS</td>
|
192
|
-
<td>Chef clients or users to be vault admins, can be comma list</td>
|
193
|
-
<td>nil</td>
|
194
|
-
<td></td>
|
195
|
-
<td>create, remove, update</td>
|
196
|
-
</tr>
|
197
|
-
<tr>
|
198
|
-
<td>-J FILE</td>
|
199
|
-
<td>--json FILE</td>
|
200
|
-
<td>JSON file to be used for values, will be merged with VALUES if VALUES is passed</td>
|
201
|
-
<td>nil</td>
|
202
|
-
<td></td>
|
203
|
-
<td>create, update</td>
|
204
|
-
</tr>
|
205
|
-
<tr>
|
206
|
-
<td>nil</td>
|
207
|
-
<td>--file FILE</td>
|
208
|
-
<td>File that chef-vault should encrypt. It adds "file-content" & "file-name" keys to the vault item</td>
|
209
|
-
<td>nil</td>
|
210
|
-
<td></td>
|
211
|
-
<td>create, update</td>
|
212
|
-
</tr>
|
213
|
-
<tr>
|
214
|
-
<td>-p DATA</td>
|
215
|
-
<td>--print DATA</td>
|
216
|
-
<td>Print extra vault data</td>
|
217
|
-
<td>nil</td>
|
218
|
-
<td>"search", "clients", "admins", "all"</td>
|
219
|
-
<td>show</td>
|
220
|
-
</tr>
|
221
|
-
<tr>
|
222
|
-
<td>-F FORMAT</td>
|
223
|
-
<td>--format FORMAT</td>
|
224
|
-
<td>Format for decrypted output</td>
|
225
|
-
<td>summary</td>
|
226
|
-
<td>"summary", "json", "yaml", "pp"</td>
|
227
|
-
<td>show</td>
|
228
|
-
</tr>
|
229
|
-
</table>
|
194
|
+
|
195
|
+
Short | Long | Description | Default | Valid Values | Sub-Commands
|
196
|
+
------|------|-------------|---------|--------------|-------------
|
197
|
+
-M MODE | --mode MODE | Chef mode to run in. Can be set in knife.rb | solo | solo, client | all
|
198
|
+
-S SEARCH | --search SEARCH | Chef Server SOLR Search Of Nodes | | | create, remove , update
|
199
|
+
-A ADMINS | --admins ADMINS | Chef clients or users to be vault admins, can be comma list | | | create, remove, update
|
200
|
+
-J FILE | --json FILE | JSON file to be used for values, will be merged with VALUES if VALUES is passed | | | create, update
|
201
|
+
| --file FILE | File that chef-vault should encrypt. It adds "file-content" & "file-name" keys to the vault item | | | create, update
|
202
|
+
-p DATA | --print DATA | Print extra vault data | | search, clients, admins, all | show
|
203
|
+
-F FORMAT | --format FORMAT | Format for decrypted output | summary | summary, json, yaml, pp | show
|
204
|
+
| --clean-unknown-clients | Remove unknown clients during key rotation | | | refresh, remove, rotate
|
data/README.md
CHANGED
@@ -1,19 +1,26 @@
|
|
1
1
|
# Chef-Vault
|
2
|
+
|
2
3
|
[](http://badge.fury.io/rb/chef-vault)
|
3
4
|
|
4
5
|
[](https://travis-ci.org/Nordstrom/chef-vault)
|
5
6
|
|
7
|
+
[](http://inch-ci.org/github/nordstrom/chef-vault)
|
8
|
+
|
6
9
|
[](https://codeclimate.com/github/Nordstrom/chef-vault)
|
7
10
|
|
8
11
|
## DESCRIPTION:
|
9
12
|
|
10
|
-
Gem that allows you to encrypt a Chef Data Bag Item using the public keys of
|
13
|
+
Gem that allows you to encrypt a Chef Data Bag Item using the public keys of
|
14
|
+
a list of chef nodes. This allows only those chef nodes to decrypt the
|
15
|
+
encrypted values.
|
11
16
|
|
12
|
-
For a more detailed explanation of how chef-vault works, please refer to the
|
17
|
+
For a more detailed explanation of how chef-vault works, please refer to the
|
18
|
+
file THEORY.md.
|
13
19
|
|
14
20
|
## INSTALLATION:
|
15
21
|
|
16
|
-
Be sure you are running the latest version Chef. Versions earlier than
|
22
|
+
Be sure you are running the latest version Chef. Versions earlier than
|
23
|
+
0.10.0 don't support plugins:
|
17
24
|
|
18
25
|
gem install chef
|
19
26
|
|
@@ -21,23 +28,28 @@ This plugin is distributed as a Ruby Gem. To install it, run:
|
|
21
28
|
|
22
29
|
gem install chef-vault
|
23
30
|
|
24
|
-
Depending on your system's configuration, you may need to run this command
|
31
|
+
Depending on your system's configuration, you may need to run this command
|
32
|
+
with root privileges.
|
25
33
|
|
26
34
|
## KNIFE COMMANDS:
|
35
|
+
|
27
36
|
See KNIFE_EXAMPLES.md for examples of commands
|
28
37
|
|
29
38
|
### knife.rb
|
39
|
+
|
30
40
|
To set 'client' as the default mode, add the following line to the knife.rb file.
|
31
41
|
|
32
|
-
|
42
|
+
knife[:vault_mode] = 'client'
|
33
43
|
|
34
|
-
To set the default list of admins for creating and updating vaults, add the
|
44
|
+
To set the default list of admins for creating and updating vaults, add the
|
45
|
+
following line to the knife.rb file.
|
35
46
|
|
36
|
-
|
47
|
+
knife[:vault_admins] = [ 'example-alice', 'example-bob', 'example-carol' ]
|
37
48
|
|
38
49
|
(These values can be overridden on the command line by using -A)
|
39
50
|
|
40
|
-
NOTE: chef-vault 1.0 knife commands are not supported!
|
51
|
+
NOTE: chef-vault 1.0 knife commands are not supported! Please use chef-vault
|
52
|
+
2.0 commands.
|
41
53
|
|
42
54
|
### Vault
|
43
55
|
|
@@ -49,122 +61,172 @@ NOTE: chef-vault 1.0 knife commands are not supported! Please use chef-vault 2.
|
|
49
61
|
knife vault delete VAULT ITEM
|
50
62
|
knife vault rotate keys VAULT ITEM
|
51
63
|
knife vault rotate all keys
|
52
|
-
knife vault show VAULT ITEM [VALUES]
|
64
|
+
knife vault show VAULT [ITEM] [VALUES]
|
53
65
|
knife vault download VAULT ITEM PATH
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
<td>solo</td>
|
70
|
-
<td>"solo", "client"</td>
|
71
|
-
<td>all</td>
|
72
|
-
</tr>
|
73
|
-
<tr>
|
74
|
-
<td>-S SEARCH</td>
|
75
|
-
<td>--search SEARCH</td>
|
76
|
-
<td>Chef Server SOLR Search Of Nodes</td>
|
77
|
-
<td>nil</td>
|
78
|
-
<td></td>
|
79
|
-
<td>create, remove, update</td>
|
80
|
-
</tr>
|
81
|
-
<tr>
|
82
|
-
<td>-A ADMINS</td>
|
83
|
-
<td>--admins ADMINS</td>
|
84
|
-
<td>Chef clients or users to be vault admins, can be comma list</td>
|
85
|
-
<td>nil</td>
|
86
|
-
<td></td>
|
87
|
-
<td>create, remove, update</td>
|
88
|
-
</tr>
|
89
|
-
<tr>
|
90
|
-
<td>-J FILE</td>
|
91
|
-
<td>--json FILE</td>
|
92
|
-
<td>JSON file to be used for values, will be merged with VALUES if VALUES is passed</td>
|
93
|
-
<td>nil</td>
|
94
|
-
<td></td>
|
95
|
-
<td>create, update</td>
|
96
|
-
</tr>
|
97
|
-
<tr>
|
98
|
-
<td>nil</td>
|
99
|
-
<td>--file FILE</td>
|
100
|
-
<td>File that chef-vault should encrypt. It adds "file-content" & "file-name" keys to the vault item</td>
|
101
|
-
<td>nil</td>
|
102
|
-
<td></td>
|
103
|
-
<td>create, update</td>
|
104
|
-
</tr>
|
105
|
-
<tr>
|
106
|
-
<td>-p DATA</td>
|
107
|
-
<td>--print DATA</td>
|
108
|
-
<td>Print extra vault data</td>
|
109
|
-
<td>nil</td>
|
110
|
-
<td>"search", "clients", "admins", "all"</td>
|
111
|
-
<td>show</td>
|
112
|
-
</tr>
|
113
|
-
<tr>
|
114
|
-
<td>-F FORMAT</td>
|
115
|
-
<td>--format FORMAT</td>
|
116
|
-
<td>Format for decrypted output</td>
|
117
|
-
<td>summary</td>
|
118
|
-
<td>"summary", "json", "yaml", "pp"</td>
|
119
|
-
<td>show</td>
|
120
|
-
</tr>
|
121
|
-
<tr>
|
122
|
-
<td>nil</td>
|
123
|
-
<td>--clean</td>
|
124
|
-
<td>Remove all client keys before re-encrypting with saved or specified search</td>
|
125
|
-
<td>nil</td>
|
126
|
-
<td>nil</td>
|
127
|
-
<td>update</td>
|
128
|
-
</tr>
|
129
|
-
<tr>
|
130
|
-
<td>nil</td>
|
131
|
-
<td>--clean-unknown-clients</td>
|
132
|
-
<td>Remove unknown clients during key rotation</td>
|
133
|
-
<td>nil</td>
|
134
|
-
<td>nil</td>
|
135
|
-
<td>remove, rotate</td>
|
136
|
-
</tr>
|
137
|
-
</table>
|
66
|
+
knife vault isvault VAULT ITEM
|
67
|
+
knife vault itemtype VAULT ITEM
|
68
|
+
|
69
|
+
#### Global Options
|
70
|
+
|
71
|
+
Short | Long | Description | Default | Valid Values | Sub-Commands
|
72
|
+
------|------|-------------|---------|--------------|-------------
|
73
|
+
-M MODE | --mode MODE | Chef mode to run in. Can be set in knife.rb | solo | solo, client | all
|
74
|
+
-S SEARCH | --search SEARCH | Chef Server SOLR Search Of Nodes | | | create, remove , update
|
75
|
+
-A ADMINS | --admins ADMINS | Chef clients or users to be vault admins, can be comma list | | | create, remove, update
|
76
|
+
-J FILE | --json FILE | JSON file to be used for values, will be merged with VALUES if VALUES is passed | | | create, update
|
77
|
+
| --file FILE | File that chef-vault should encrypt. It adds "file-content" & "file-name" keys to the vault item | | | create, update
|
78
|
+
-p DATA | --print DATA | Print extra vault data | | search, clients, admins, all | show
|
79
|
+
-F FORMAT | --format FORMAT | Format for decrypted output | summary | summary, json, yaml, pp | show
|
80
|
+
| --clean-unknown-clients | Remove unknown clients during key rotation | | | refresh, remove, rotate
|
138
81
|
|
139
82
|
## USAGE IN RECIPES
|
140
83
|
|
141
|
-
To use this gem in a recipe to decrypt data you must first install the gem
|
84
|
+
To use this gem in a recipe to decrypt data you must first install the gem
|
85
|
+
via a chef_gem resource. Once the gem is installed require the gem and then
|
86
|
+
you can create a new instance of ChefVault.
|
142
87
|
|
143
|
-
NOTE: chef-vault 1.0 style decryption is supported, however it has been
|
88
|
+
NOTE: chef-vault 1.0 style decryption is supported, however it has been
|
89
|
+
deprecated and chef-vault 2.0 decryption should be used instead
|
144
90
|
|
145
91
|
### Example Code
|
146
92
|
|
147
|
-
|
148
|
-
|
93
|
+
chef_gem 'chef-vault' do
|
94
|
+
compile_time true if respond_to?(:compile_time)
|
95
|
+
end
|
96
|
+
|
97
|
+
require 'chef-vault'
|
98
|
+
|
99
|
+
item = ChefVault::Item.load("passwords", "root")
|
100
|
+
item["password"]
|
101
|
+
|
102
|
+
Note that in this case, the gem needs to be installed at compile time
|
103
|
+
because the require statement is at the top-level of the recipe. If
|
104
|
+
you move the require of chef-vault and the call to `::load` to
|
105
|
+
library or provider code, you can install the gem in the converge phase
|
106
|
+
instead.
|
107
|
+
|
108
|
+
### Specifying an alternate node name or client key path
|
109
|
+
|
110
|
+
Normally, the value of `Chef::Config[:node_name]` is used to find the
|
111
|
+
per-node encrypted secret in the keys data bag item, and the value of
|
112
|
+
`Chef::Config[:client_key]` is used to locate the private key to decrypt
|
113
|
+
this secret.
|
114
|
+
|
115
|
+
These can be overridden by passing a hash with the keys `:node_name` or
|
116
|
+
`:client_key_path` to `ChefVault::Item.load`:
|
117
|
+
|
118
|
+
item = ChefVault::Item.load(
|
119
|
+
'passwords', 'root',
|
120
|
+
node_name: 'service_foo',
|
121
|
+
client_key_path: '/secure/place/service_foo.pem'
|
122
|
+
)
|
123
|
+
item['password']
|
149
124
|
|
150
|
-
|
125
|
+
The above example assumes that you have transferred
|
126
|
+
`/secure/place/service_foo.pem` to your system via a secure channel.
|
151
127
|
|
152
|
-
|
153
|
-
|
154
|
-
|
128
|
+
This usage allows you to decrypt a vault using a key shared among several
|
129
|
+
nodes, which can be helpful when working in cloud environments or other
|
130
|
+
configurations where nodes are created dynamically.
|
131
|
+
|
132
|
+
### chef_vault_item helper
|
133
|
+
|
134
|
+
The [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)
|
135
|
+
contains a recipe to install the chef-vault gem and a helper method
|
136
|
+
`chef_vault_helper` which makes it easier to test cookbooks that use
|
137
|
+
chef-vault using Test Kitchen.
|
138
|
+
|
139
|
+
## DETERMINING IF AN ITEM IS A VAULT
|
140
|
+
|
141
|
+
ChefVault provides a helper method to determine if a data bag item is a vault,
|
142
|
+
which can be helpful if you produce a recipe for community consumption and want
|
143
|
+
to support both normal data bags and vaults:
|
144
|
+
|
145
|
+
if ChefVault::Item.vault?('passwords', 'root')
|
146
|
+
item = ChefVault::Item.load('passwords', 'root')
|
147
|
+
else
|
148
|
+
item = Chef::DataBagItem.load('passwords', 'root')
|
149
|
+
end
|
150
|
+
|
151
|
+
This functionality is also available from the command line as `knife vault isvault VAULT ITEM`.
|
152
|
+
|
153
|
+
## DETERMINING THE TYPE OF A DATA BAG ITEM
|
154
|
+
|
155
|
+
ChefVault provides a helper method to determine the type of a data bag item.
|
156
|
+
It returns one of the symbols :normal, :encrypted or :vault
|
157
|
+
|
158
|
+
case ChefVault::Item.data_bag_item_type('passwords', 'root')
|
159
|
+
when :normal
|
160
|
+
...
|
161
|
+
when :encrypted
|
162
|
+
...
|
163
|
+
when :vault
|
164
|
+
...
|
165
|
+
end
|
166
|
+
|
167
|
+
This functionality is also available from the command line as `knife vault itemtype VAULT ITEM`.
|
155
168
|
|
156
169
|
## USAGE STAND ALONE
|
157
170
|
|
158
|
-
`chef-vault` can be used as a stand alone binary to decrypt values stored in
|
171
|
+
`chef-vault` can be used as a stand alone binary to decrypt values stored in
|
172
|
+
Chef. It requires that Chef is installed on the system and that you have a
|
173
|
+
valid knife.rb. This is useful if you want to mix `chef-vault` into non-Chef
|
174
|
+
recipe code, for example some other script where you want to protect a
|
175
|
+
password.
|
159
176
|
|
160
|
-
It does still require that the data bag has been encrypted for the user's or
|
177
|
+
It does still require that the data bag has been encrypted for the user's or
|
178
|
+
client's pem and pushed to the Chef server. It mixes Chef into the gem and
|
179
|
+
uses it to go grab the data bag.
|
161
180
|
|
162
|
-
|
181
|
+
Use `chef-vault --help` to see all all available options
|
163
182
|
|
164
183
|
### Example usage (password)
|
165
184
|
|
166
185
|
chef-vault -v passwords -i root -a password -k /etc/chef/knife.rb
|
167
186
|
|
187
|
+
## TESTING
|
188
|
+
|
189
|
+
To stub vault items in ChefSpec, use the
|
190
|
+
[chef-vault-testfixtures](https://rubygems.org/gems/chef-vault-testfixtures)
|
191
|
+
gem.
|
192
|
+
|
193
|
+
To fall back to unencrypted JSON files in Test Kitchen, use the
|
194
|
+
`chef_vault_item` helper in the aforementioned chef-vault cookbook.
|
195
|
+
|
196
|
+
## THE FUTURE OF chef-vault
|
197
|
+
|
198
|
+
It has become clear that supporting alternate keying mechanisms like GPG and
|
199
|
+
Amazon KMS is something that chef-vault users want, but the implementation
|
200
|
+
of chef-vault v2 makes this difficult, as much of the code is tied to the
|
201
|
+
"side-along data bag item" implementation.
|
202
|
+
|
203
|
+
chef-vault v3.x.x will be a major rewrite. While the core vault item will
|
204
|
+
remain a Chef encrypted data bag item, the way in which you get the secret
|
205
|
+
to decrypt that data bag item will be delegated to plugins. At release,
|
206
|
+
there will be at least a plugin that emulates the 2.x.x implementation, and
|
207
|
+
hopefully one for KMS. Anyone who wants to support an alternate keying
|
208
|
+
implementation will be able to write one and distribute it as a gem for
|
209
|
+
others to use.
|
210
|
+
|
211
|
+
With that in mind, the 2.6.0 release is the last one that will receive new
|
212
|
+
features. If you refer to the
|
213
|
+
[milestones](https://github.com/Nordstrom/chef-vault/milestones) on Github,
|
214
|
+
the plan is for two releases prior to 3.x:
|
215
|
+
|
216
|
+
* v2.7.x will focus on reducing tech debt - getting the test coverage up to 100%
|
217
|
+
in both RSpec and Aruba, and getting the internal API docs completed.
|
218
|
+
* v2.99.x will be a transitional release. This release will add deprecation
|
219
|
+
warnings for any API or CLI option that will be changing in v3.x. Any user
|
220
|
+
who wants to stay with the 2.x series can use a '~> 2.x' constraint (where x
|
221
|
+
is any minor release of chef-vault) and be certain that they won't
|
222
|
+
accidentally get the new release.
|
223
|
+
|
224
|
+
If you are interested helping with the robustness fixes in v2.7.x, please
|
225
|
+
feel free to fork the repo and add more RSpec and Aruba tests. Frequent
|
226
|
+
small pull requests are preferred to large omnibus patches, as the
|
227
|
+
robustness pass is a multi-person effort and we don't want to create merge
|
228
|
+
conflicts unnecessarily.
|
229
|
+
|
168
230
|
## Authors
|
169
231
|
|
170
232
|
Author:: Kevin Moser - @moserke<br>
|