chef-vault 3.3.0 → 4.1.11
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 +5 -5
- data/Gemfile +32 -6
- data/bin/chef-vault +5 -5
- data/chef-vault.gemspec +7 -26
- data/lib/chef/knife/mixin/helper.rb +29 -1
- data/lib/chef/knife/vault_admins.rb +5 -1
- data/lib/chef/knife/vault_base.rb +23 -13
- data/lib/chef/knife/vault_create.rb +26 -23
- data/lib/chef/knife/vault_delete.rb +4 -2
- data/lib/chef/knife/vault_download.rb +2 -2
- data/lib/chef/knife/vault_edit.rb +4 -4
- data/lib/chef/knife/vault_isvault.rb +4 -4
- data/lib/chef/knife/vault_itemtype.rb +4 -4
- data/lib/chef/knife/vault_list.rb +5 -5
- data/lib/chef/knife/vault_refresh.rb +7 -7
- data/lib/chef/knife/vault_remove.rb +19 -16
- data/lib/chef/knife/vault_rotate_all_keys.rb +5 -4
- data/lib/chef/knife/vault_rotate_keys.rb +3 -3
- data/lib/chef/knife/vault_show.rb +8 -10
- data/lib/chef/knife/vault_update.rb +38 -24
- data/lib/chef-vault/actor.rb +9 -7
- data/lib/chef-vault/chef_api.rb +4 -4
- data/lib/chef-vault/exceptions.rb +3 -0
- data/lib/chef-vault/item.rb +57 -21
- data/lib/chef-vault/item_keys.rb +35 -9
- data/lib/chef-vault/mixins.rb +2 -2
- data/lib/chef-vault/version.rb +1 -1
- data/lib/chef-vault.rb +8 -8
- metadata +8 -135
- data/.github/CODEOWNERS +0 -2
- data/.gitignore +0 -33
- data/.rspec +0 -2
- data/.rubocop.yml +0 -6
- data/.simplecov +0 -6
- data/.travis.yml +0 -19
- data/Changelog.md +0 -134
- data/DEMO.md +0 -60
- data/KNIFE_EXAMPLES.md +0 -256
- data/README.md +0 -333
- data/Rakefile +0 -50
- data/THEORY.md +0 -363
- data/UPGRADE.md +0 -55
- data/appveyor.yml +0 -32
- data/features/clean.feature +0 -23
- data/features/clean_on_refresh.feature +0 -27
- data/features/clean_unknown_clients.feature +0 -45
- data/features/detect_and_warn_v1_vault.feature +0 -14
- data/features/isvault.feature +0 -29
- data/features/itemtype.feature +0 -24
- data/features/step_definitions/chef-databag.rb +0 -9
- data/features/step_definitions/chef-repo.rb +0 -72
- data/features/step_definitions/chef-vault.rb +0 -151
- data/features/step_definitions/chef_databagitem.rb +0 -9
- data/features/support/env.rb +0 -14
- data/features/vault_create.feature +0 -63
- data/features/vault_list.feature +0 -31
- data/features/vault_show.feature +0 -45
- data/features/vault_show_vaultname.feature +0 -21
- data/features/vault_update.feature +0 -18
- data/features/verify_id_matches.feature +0 -10
- data/features/wrong_private_key.feature +0 -13
- data/hooks/pre-commit +0 -43
- data/spec/chef-vault/actor_spec.rb +0 -247
- data/spec/chef-vault/certificate_spec.rb +0 -37
- data/spec/chef-vault/chef_api_spec.rb +0 -39
- data/spec/chef-vault/item_keys_spec.rb +0 -263
- data/spec/chef-vault/item_spec.rb +0 -360
- data/spec/chef-vault/user_spec.rb +0 -36
- data/spec/chef-vault_spec.rb +0 -65
- data/spec/spec_helper.rb +0 -91
- data/tasks/github_changelog_generator.rb +0 -30
data/KNIFE_EXAMPLES.md
DELETED
@@ -1,256 +0,0 @@
|
|
1
|
-
# knife examples
|
2
|
-
|
3
|
-
## vault
|
4
|
-
|
5
|
-
knife vault SUBCOMMAND VAULT ITEM VALUES
|
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.
|
8
|
-
|
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
|
12
|
-
|
13
|
-
## vault commands
|
14
|
-
|
15
|
-
### create
|
16
|
-
Create a vault called passwords and put an item called root in it with the given values for username and password encrypted for clients role:webserver, client1 & client2 and admins admin1 & admin2
|
17
|
-
|
18
|
-
knife vault create passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver" -C "client1,client2" -A "admin1,admin2"
|
19
|
-
|
20
|
-
Create a vault called passwords and put an item called root in it with the given values for username and password encrypted for clients role:webserver and admins admin1 & admin2
|
21
|
-
|
22
|
-
knife vault create passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver" -A "admin1,admin2"
|
23
|
-
|
24
|
-
Create a vault called passwords and put an item called root in it with the given values for username and password encrypted for clients role:webserver, client1 & client2
|
25
|
-
|
26
|
-
knife vault create passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver" -C "client1,client2"
|
27
|
-
|
28
|
-
Create a vault called passwords and put an item called root in it with the given values for username and password encrypted for clients role:webserver
|
29
|
-
|
30
|
-
knife vault create passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver"
|
31
|
-
|
32
|
-
Create a vault called passwords and put an item called root in it with the given values for username and password encrypted for clients client1 & client2
|
33
|
-
|
34
|
-
knife vault create passwords root '{"username": "root", "password": "mypassword"}' -C "client1,client2"
|
35
|
-
|
36
|
-
Create a vault called passwords and put an item called root in it with the given values for username and password encrypted for admins admin1 & admin2
|
37
|
-
|
38
|
-
knife vault create passwords root '{"username": "root", "password": "mypassword"}' -A "admin1,admin2"
|
39
|
-
|
40
|
-
Create a vault called passwords and put an item called root in it encrypted for admins admin1 & admin2. *Leaving the data off the command-line will pop an editor to fill out the data*
|
41
|
-
|
42
|
-
knife vault create passwords root -A "admin1,admin2"
|
43
|
-
|
44
|
-
Note: A JSON file can be used in place of specifying the values on the command line, see global options below for details
|
45
|
-
|
46
|
-
### update
|
47
|
-
|
48
|
-
Update the values in username and password in the vault passwords and item root. Will overwrite existing values if values already exist!
|
49
|
-
|
50
|
-
knife vault update passwords root '{"username": "root", "password": "mypassword"}'
|
51
|
-
|
52
|
-
Update the values in username and password in the vault passwords and item root and add role:webserver, client1 & client2 to the encrypted clients and admin1 & admin2 to the encrypted admins. Will overwrite existing values if values already exist!
|
53
|
-
|
54
|
-
knife vault update passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver" -C "client1,client2" -A "admin1,admin2"
|
55
|
-
|
56
|
-
Update the values in username and password in the vault passwords and item root and add role:webserver to the encrypted clients and admin1 & admin2 to the encrypted admins. Will overwrite existing values if values already exist!
|
57
|
-
|
58
|
-
knife vault update passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver" -A "admin1,admin2"
|
59
|
-
|
60
|
-
Update the values in username and password in the vault passwords and item root and add role:webserver to the encrypted clients. Will overwrite existing values if values already exist!
|
61
|
-
|
62
|
-
knife vault update passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver"
|
63
|
-
|
64
|
-
Update the values in username and password in the vault passwords and item root and add client1 & client2 to the encrypted clients. Will overwrite existing values if values already exist!
|
65
|
-
|
66
|
-
knife vault update passwords root '{"username": "root", "password": "mypassword"}' -C "client1,client2"
|
67
|
-
|
68
|
-
Update the values in username and password in the vault passwords and item root and add admin1 & admin2 to the encrypted admins. Will overwrite existing values if values already exist!
|
69
|
-
|
70
|
-
knife vault update passwords root '{"username": "root", "password": "mypassword"}' -A "admin1,admin2"
|
71
|
-
|
72
|
-
Add role:webserver to encrypted clients for the vault passwords and item root.
|
73
|
-
|
74
|
-
knife vault update passwords root -S "role:webserver"
|
75
|
-
|
76
|
-
Add client1 & client2 to encrypted clients for the vault passwords and item root.
|
77
|
-
|
78
|
-
knife vault update passwords root -C "client1,client2"
|
79
|
-
|
80
|
-
Add admin1 & admin2 to encrypted admins for the vault passwords and item root.
|
81
|
-
|
82
|
-
knife vault update passwords root -A "admin1,admin2"
|
83
|
-
|
84
|
-
Add admin1 & admin2 to encrypted admins and role:webserver, client1 & client2 to encrypted clients for the vault passwords and item root.
|
85
|
-
|
86
|
-
knife vault update passwords root -S "role:webserver" -C "client1,client2" -A "admin1,admin2"
|
87
|
-
|
88
|
-
Add admin1 & admin2 to encrypted admins and role:webserver to encrypted clients for the vault passwords and item root.
|
89
|
-
|
90
|
-
knife vault update passwords root -S "role:webserver" -A "admin1,admin2"
|
91
|
-
|
92
|
-
Add admin1 & admin2 to encrypted admins and client1 & client2 to encrypted clients for the vault passwords and item root.
|
93
|
-
|
94
|
-
knife vault update passwords root -C "client1,client2" -A "admin1,admin2"
|
95
|
-
|
96
|
-
Note: A JSON file can be used in place of specifying the values on the command line, see global options below for details
|
97
|
-
|
98
|
-
### remove
|
99
|
-
|
100
|
-
Remove the values in username and password from the vault passwords and item root.
|
101
|
-
|
102
|
-
knife vault remove passwords root '{"username": "root", "password": "mypassword"}'
|
103
|
-
|
104
|
-
Remove the values in username and password from the vault passwords and item root and remove role:webserver, client1 & client2 from the encrypted clients and admin1 & admin2 from the encrypted admins.
|
105
|
-
|
106
|
-
knife vault remove passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver" -C "client1,client2" -A "admin1,admin2"
|
107
|
-
|
108
|
-
Remove the values in username and password from the vault passwords and item root and remove role:webserver from the encrypted clients and admin1 & admin2 from the encrypted admins.
|
109
|
-
|
110
|
-
knife vault remove passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver" -A "admin1,admin2"
|
111
|
-
|
112
|
-
Remove the values in username and password from the vault passwords and item root and remove client1 & client2 from the encrypted clients and admin1 & admin2 from the encrypted admins.
|
113
|
-
|
114
|
-
knife vault remove passwords root '{"username": "root", "password": "mypassword"}' -C "client1,client2" -A "admin1,admin2"
|
115
|
-
|
116
|
-
Remove the values in username and password from the vault passwords and item root and remove role:webserver from the encrypted clients.
|
117
|
-
|
118
|
-
knife vault remove passwords root '{"username": "root", "password": "mypassword"}' -S "role:webserver"
|
119
|
-
|
120
|
-
Remove the values in username and password from the vault passwords and item root and remove client1 & client2 from the encrypted clients.
|
121
|
-
|
122
|
-
knife vault remove passwords root '{"username": "root", "password": "mypassword"}' -C "client1,client2"
|
123
|
-
|
124
|
-
Remove the values in username and password from the vault passwords and item root and remove admin1 & admin2 from the encrypted admins.
|
125
|
-
|
126
|
-
knife vault remove passwords root '{"username": "root", "password": "mypassword"}' -A "admin1,admin2"
|
127
|
-
|
128
|
-
Remove admin1 & admin2 from encrypted admins and role:webserver, client1 & client2 from encrypted clients for the vault passwords and item root.
|
129
|
-
|
130
|
-
knife vault remove passwords root -S "role:webserver" -C "client1,client2" -A "admin1,admin2"
|
131
|
-
|
132
|
-
Remove admin1 & admin2 from encrypted admins and role:webserver from encrypted clients for the vault passwords and item root.
|
133
|
-
|
134
|
-
knife vault remove passwords root -S "role:webserver" -A "admin1,admin2"
|
135
|
-
|
136
|
-
Remove role:webserver from encrypted clients for the vault passwords and item root.
|
137
|
-
|
138
|
-
knife vault remove passwords root -S "role:webserver"
|
139
|
-
|
140
|
-
Remove client1 & client2 from encrypted clients for the vault passwords and item root.
|
141
|
-
|
142
|
-
knife vault remove passwords root -C "client1,client2"
|
143
|
-
|
144
|
-
Remove admin1 & admin2 from encrypted admins for the vault passwords and item root.
|
145
|
-
|
146
|
-
knife vault remove passwords root -A "admin1,admin2"
|
147
|
-
|
148
|
-
### delete
|
149
|
-
|
150
|
-
Delete the item root from the vault passwords
|
151
|
-
|
152
|
-
knife vault delete passwords root
|
153
|
-
|
154
|
-
### show
|
155
|
-
|
156
|
-
knife vault show VAULT [ITEM] [VALUES]
|
157
|
-
|
158
|
-
These are the commands that are used to decrypt a chef-vault encrypted item and show the requested values.
|
159
|
-
|
160
|
-
* vault - This is the name of the vault in which to store the encrypted item. This is analogous to a chef data bag name
|
161
|
-
* item - The name of the item going in to the vault. This is analogous to a chef data bag item id
|
162
|
-
* values - This is a comma list of values to decrypt from the vault item. This is analogous to a list of hash keys.
|
163
|
-
|
164
|
-
Show the items in a vault
|
165
|
-
|
166
|
-
knife vault show passwords
|
167
|
-
|
168
|
-
Show the entire root item in the passwords vault and print in JSON format.
|
169
|
-
|
170
|
-
knife vault show passwords root -Fjson
|
171
|
-
|
172
|
-
Show the entire root item in the passwords vault and print in JSON format, including the search query, clients, and admins.
|
173
|
-
|
174
|
-
knife vault show passwords root -Fjson -p all
|
175
|
-
|
176
|
-
Show the username and password for the item root in the vault passwords.
|
177
|
-
|
178
|
-
knife vault show passwords root "username, password"
|
179
|
-
|
180
|
-
Show the contents for the item user_pem in the vault certs.
|
181
|
-
|
182
|
-
knife vault show certs user_pem "contents"
|
183
|
-
|
184
|
-
### edit
|
185
|
-
|
186
|
-
knife vault edit VAULT ITEM
|
187
|
-
|
188
|
-
These are the commands that are used to edit a chef-vault encrypted item.
|
189
|
-
|
190
|
-
* Vault - This is the name of the vault in which to store the encrypted item. This is analogous to a chef data bag name
|
191
|
-
* Item - The name of the item going in to the vault. This is analogous to a chef data bag item id
|
192
|
-
|
193
|
-
Decrypt the entire root item in the passwords vault and open it in json format in your $EDITOR. Writing and exiting out the editor will save and encrypt the vault item.
|
194
|
-
|
195
|
-
knife vault edit passwords root
|
196
|
-
|
197
|
-
### download
|
198
|
-
|
199
|
-
Decrypt and download an encrypted file to the specified path.
|
200
|
-
|
201
|
-
knife vault download certs user_pem ~/downloaded_user_pem
|
202
|
-
|
203
|
-
### rotate keys
|
204
|
-
|
205
|
-
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.
|
206
|
-
|
207
|
-
knife vault rotate keys passwords root
|
208
|
-
|
209
|
-
To remove clients which have been deleted from Chef but not from the vault, add the --clean-unknown-clients switch:
|
210
|
-
|
211
|
-
knife vault rotate keys passwords root --clean-unknown-clients
|
212
|
-
|
213
|
-
### rotate all keys
|
214
|
-
|
215
|
-
Rotate the shared key for all vaults and items. The shared key is that which is used for the chef encrypted data bag item.
|
216
|
-
|
217
|
-
knife vault rotate all keys
|
218
|
-
|
219
|
-
To remove clients which have been deleted from Chef but not from the vault, add the --clean-unknown-clients switch:
|
220
|
-
|
221
|
-
knife vault rotate keys passwords root --clean-unknown-clients
|
222
|
-
|
223
|
-
### refresh
|
224
|
-
|
225
|
-
This command reads the search_query in the vault item, performs the search, and reapplies the results.
|
226
|
-
|
227
|
-
knife vault refresh VAULT ITEM
|
228
|
-
|
229
|
-
To remove clients which have been deleted from Chef but not from the vault, add the --clean-unknown-clients switch:
|
230
|
-
|
231
|
-
knife vault refresh passwords root --clean-unknown-clients
|
232
|
-
|
233
|
-
### isvault
|
234
|
-
|
235
|
-
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.
|
236
|
-
|
237
|
-
knife vault isvault VAULT ITEM
|
238
|
-
|
239
|
-
### itemtype
|
240
|
-
|
241
|
-
This command outputs the type of the data bag item: normal, encrypted or vault
|
242
|
-
|
243
|
-
knife vault itemtype VAULT ITEM
|
244
|
-
|
245
|
-
### global options
|
246
|
-
|
247
|
-
Short | Long | Description | Default | Valid Values | Sub-Commands
|
248
|
-
------|------|-------------|---------|--------------|-------------
|
249
|
-
-M MODE | --mode MODE | Chef mode to run in. Can be set in knife.rb | solo | solo, client | all
|
250
|
-
-S SEARCH | --search SEARCH | Chef Server SOLR Search Of Nodes | | | create, remove , update
|
251
|
-
-A ADMINS | --admins ADMINS | Chef clients or users to be vault admins, can be comma list | | | create, remove, update
|
252
|
-
-J FILE | --json FILE | JSON file to be used for values, will be merged with VALUES if VALUES is passed | | | create, update
|
253
|
-
| --file FILE | File that chef-vault should encrypt. It adds "file-content" & "file-name" keys to the vault item | | | create, update
|
254
|
-
-p DATA | --print DATA | Print extra vault data | | search, clients, admins, all | show
|
255
|
-
-F FORMAT | --format FORMAT | Format for decrypted output | summary | summary, json, yaml, pp | show
|
256
|
-
| --clean-unknown-clients | Remove unknown clients during key rotation | | | refresh, remove, rotate
|
data/README.md
DELETED
@@ -1,333 +0,0 @@
|
|
1
|
-
# Chef-Vault
|
2
|
-
|
3
|
-
[](http://badge.fury.io/rb/chef-vault)
|
4
|
-
|
5
|
-
[](https://travis-ci.org/chef/chef-vault)
|
6
|
-
|
7
|
-
[](http://inch-ci.org/github/chef/chef-vault)
|
8
|
-
|
9
|
-
[](https://codeclimate.com/github/chef/chef-vault)
|
10
|
-
|
11
|
-
[](https://gitter.im/Nordstrom/chef-vault)
|
12
|
-
|
13
|
-
## DESCRIPTION:
|
14
|
-
|
15
|
-
Gem that allows you to encrypt a Chef Data Bag Item using the public keys of
|
16
|
-
a list of chef nodes. This allows only those chef nodes to decrypt the
|
17
|
-
encrypted values.
|
18
|
-
|
19
|
-
For a more detailed explanation of how chef-vault works, please refer to this blog post [Chef Vault – what is it and what can it do for you?](https://www.chef.io/blog/2016/01/21/chef-vault-what-is-it-and-what-can-it-do-for-you/) by Nell Shamrell-Harrington.
|
20
|
-
|
21
|
-
## INSTALLATION:
|
22
|
-
|
23
|
-
Be sure you are running the latest version Chef. Versions earlier than
|
24
|
-
0.10.0 don't support plugins:
|
25
|
-
|
26
|
-
gem install chef
|
27
|
-
|
28
|
-
This plugin is distributed as a Ruby Gem. To install it, run:
|
29
|
-
|
30
|
-
gem install chef-vault
|
31
|
-
|
32
|
-
Depending on your system's configuration, you may need to run this command
|
33
|
-
with root privileges.
|
34
|
-
|
35
|
-
## DEVELOPMENT:
|
36
|
-
|
37
|
-
### Git Hooks
|
38
|
-
|
39
|
-
There is a git pre-commit hook to help you keep your chefstyle up to date.
|
40
|
-
If you wish to use it, simply:
|
41
|
-
|
42
|
-
```
|
43
|
-
mv hooks/pre-commit .git/hooks/
|
44
|
-
chmod +x .git/hooks/pre-commit
|
45
|
-
```
|
46
|
-
|
47
|
-
### Running Your Changes
|
48
|
-
|
49
|
-
To run your changes locally:
|
50
|
-
|
51
|
-
```
|
52
|
-
bundle install
|
53
|
-
bundle exec knife vault
|
54
|
-
```
|
55
|
-
|
56
|
-
### Testing
|
57
|
-
|
58
|
-
#### Rspec Tests
|
59
|
-
|
60
|
-
There are some unit tests that can be run with:
|
61
|
-
|
62
|
-
```
|
63
|
-
bundle exec rspec spec/
|
64
|
-
```
|
65
|
-
|
66
|
-
#### Cucumber Testing
|
67
|
-
|
68
|
-
There are cucumber tests. Run the whole suite with:
|
69
|
-
|
70
|
-
```
|
71
|
-
bundle exec rake features
|
72
|
-
```
|
73
|
-
|
74
|
-
If you get any failures, you can run the specific feature that failed with:
|
75
|
-
|
76
|
-
```
|
77
|
-
bundle exec cucumber features/<failed>.feature
|
78
|
-
```
|
79
|
-
|
80
|
-
If you want to test things out directly, after a failure you can go into the test
|
81
|
-
directory and try out the commands that failed:
|
82
|
-
|
83
|
-
```
|
84
|
-
cd tmp/aruba
|
85
|
-
bundle exec knife <your command that failed from test with -c knife.rb>
|
86
|
-
```
|
87
|
-
|
88
|
-
Optionally add `-VV` to the above to get a full stacktrace.
|
89
|
-
|
90
|
-
### Rubocop Errors
|
91
|
-
|
92
|
-
If you are seeing rubocop errors in travis for your pull request, run:
|
93
|
-
|
94
|
-
`bundle exec chefstyle -a`
|
95
|
-
|
96
|
-
This will fix up your rubocop errors automatically, and warn you about any it can't.
|
97
|
-
|
98
|
-
## KNIFE COMMANDS:
|
99
|
-
|
100
|
-
See KNIFE_EXAMPLES.md for examples of commands
|
101
|
-
|
102
|
-
### knife.rb
|
103
|
-
|
104
|
-
To set 'client' as the default mode, add the following line to the knife.rb file.
|
105
|
-
|
106
|
-
knife[:vault_mode] = 'client'
|
107
|
-
|
108
|
-
To set the default list of admins for creating and updating vaults, add the
|
109
|
-
following line to the knife.rb file.
|
110
|
-
|
111
|
-
knife[:vault_admins] = [ 'example-alice', 'example-bob', 'example-carol' ]
|
112
|
-
|
113
|
-
(These values can be overridden on the command line by using -A)
|
114
|
-
|
115
|
-
NOTE: chef-vault 1.0 knife commands are not supported! Please use chef-vault
|
116
|
-
2.0 commands.
|
117
|
-
|
118
|
-
### Vault
|
119
|
-
|
120
|
-
knife vault create VAULT ITEM VALUES
|
121
|
-
knife vault edit VAULT ITEM
|
122
|
-
knife vault refresh VAULT ITEM
|
123
|
-
knife vault update VAULT ITEM VALUES [--clean]
|
124
|
-
knife vault remove VAULT ITEM VALUES
|
125
|
-
knife vault delete VAULT ITEM
|
126
|
-
knife vault rotate keys VAULT ITEM
|
127
|
-
knife vault rotate all keys
|
128
|
-
knife vault show VAULT [ITEM] [VALUES]
|
129
|
-
knife vault download VAULT ITEM PATH
|
130
|
-
knife vault isvault VAULT ITEM
|
131
|
-
knife vault itemtype VAULT ITEM
|
132
|
-
|
133
|
-
#### Global Options
|
134
|
-
|
135
|
-
Short | Long | Description | Default | Valid Values | Sub-Commands
|
136
|
-
------|------|-------------|---------|--------------|-------------
|
137
|
-
-M MODE | --mode MODE | Chef mode to run in. Can be set in knife.rb | solo | solo, client | all
|
138
|
-
-S SEARCH | --search SEARCH | Chef Server SOLR Search Of Nodes | | | create, remove , update
|
139
|
-
-C CLIENTS | --clients CLIENTS | Chef clients to be added as clients, can be comma list | | | create, remove , update
|
140
|
-
-A ADMINS | --admins ADMINS | Chef clients or users to be vault admins, can be comma list | | | create, remove, update
|
141
|
-
-J FILE | --json FILE | JSON file to be used for values, will be merged with VALUES if VALUES is passed | | | create, update
|
142
|
-
| --file FILE | File that chef-vault should encrypt. It adds "file-content" & "file-name" keys to the vault item | | | create, update
|
143
|
-
-p DATA | --print DATA | Print extra vault data | | search, clients, admins, all | show
|
144
|
-
-F FORMAT | --format FORMAT | Format for decrypted output | summary | summary, json, yaml, pp | show
|
145
|
-
| --clean-unknown-clients | Remove unknown clients during key rotation | | | refresh, remove, rotate
|
146
|
-
| --clean | Clean clients list before performing search | | | refresh, update
|
147
|
-
|
148
|
-
## USAGE IN RECIPES
|
149
|
-
|
150
|
-
To use this gem in a recipe to decrypt data you must first install the gem
|
151
|
-
via a chef_gem resource. Once the gem is installed require the gem and then
|
152
|
-
you can create a new instance of ChefVault.
|
153
|
-
|
154
|
-
NOTE: chef-vault 1.0 style decryption is supported, however it has been
|
155
|
-
deprecated and chef-vault 2.0 decryption should be used instead
|
156
|
-
|
157
|
-
### Example Code
|
158
|
-
|
159
|
-
chef_gem 'chef-vault' do
|
160
|
-
compile_time true if respond_to?(:compile_time)
|
161
|
-
end
|
162
|
-
|
163
|
-
require 'chef-vault'
|
164
|
-
|
165
|
-
item = ChefVault::Item.load("passwords", "root")
|
166
|
-
item["password"]
|
167
|
-
|
168
|
-
Note that in this case, the gem needs to be installed at compile time
|
169
|
-
because the require statement is at the top-level of the recipe. If
|
170
|
-
you move the require of chef-vault and the call to `::load` to
|
171
|
-
library or provider code, you can install the gem in the converge phase
|
172
|
-
instead.
|
173
|
-
|
174
|
-
### Specifying an alternate node name or client key path
|
175
|
-
|
176
|
-
Normally, the value of `Chef::Config[:node_name]` is used to find the
|
177
|
-
per-node encrypted secret in the keys data bag item, and the value of
|
178
|
-
`Chef::Config[:client_key]` is used to locate the private key to decrypt
|
179
|
-
this secret.
|
180
|
-
|
181
|
-
These can be overridden by passing a hash with the keys `:node_name` or
|
182
|
-
`:client_key_path` to `ChefVault::Item.load`:
|
183
|
-
|
184
|
-
item = ChefVault::Item.load(
|
185
|
-
'passwords', 'root',
|
186
|
-
node_name: 'service_foo',
|
187
|
-
client_key_path: '/secure/place/service_foo.pem'
|
188
|
-
)
|
189
|
-
item['password']
|
190
|
-
|
191
|
-
The above example assumes that you have transferred
|
192
|
-
`/secure/place/service_foo.pem` to your system via a secure channel.
|
193
|
-
|
194
|
-
This usage allows you to decrypt a vault using a key shared among several
|
195
|
-
nodes, which can be helpful when working in cloud environments or other
|
196
|
-
configurations where nodes are created dynamically.
|
197
|
-
|
198
|
-
### chef_vault_item helper
|
199
|
-
|
200
|
-
The [chef-vault cookbook](https://supermarket.chef.io/cookbooks/chef-vault)
|
201
|
-
contains a recipe to install the chef-vault gem and a helper method
|
202
|
-
`chef_vault_helper` which makes it easier to test cookbooks that use
|
203
|
-
chef-vault using Test Kitchen.
|
204
|
-
|
205
|
-
## DETERMINING IF AN ITEM IS A VAULT
|
206
|
-
|
207
|
-
ChefVault provides a helper method to determine if a data bag item is a vault,
|
208
|
-
which can be helpful if you produce a recipe for community consumption and want
|
209
|
-
to support both normal data bags and vaults:
|
210
|
-
|
211
|
-
if ChefVault::Item.vault?('passwords', 'root')
|
212
|
-
item = ChefVault::Item.load('passwords', 'root')
|
213
|
-
else
|
214
|
-
item = Chef::DataBagItem.load('passwords', 'root')
|
215
|
-
end
|
216
|
-
|
217
|
-
This functionality is also available from the command line as `knife vault isvault VAULT ITEM`.
|
218
|
-
|
219
|
-
## DETERMINING THE TYPE OF A DATA BAG ITEM
|
220
|
-
|
221
|
-
ChefVault provides a helper method to determine the type of a data bag item.
|
222
|
-
It returns one of the symbols :normal, :encrypted or :vault
|
223
|
-
|
224
|
-
case ChefVault::Item.data_bag_item_type('passwords', 'root')
|
225
|
-
when :normal
|
226
|
-
...
|
227
|
-
when :encrypted
|
228
|
-
...
|
229
|
-
when :vault
|
230
|
-
...
|
231
|
-
end
|
232
|
-
|
233
|
-
This functionality is also available from the command line as `knife vault itemtype VAULT ITEM`.
|
234
|
-
|
235
|
-
## USAGE STAND ALONE
|
236
|
-
|
237
|
-
`chef-vault` can be used as a stand alone binary to decrypt values stored in
|
238
|
-
Chef. It requires that Chef is installed on the system and that you have a
|
239
|
-
valid knife.rb. This is useful if you want to mix `chef-vault` into non-Chef
|
240
|
-
recipe code, for example some other script where you want to protect a
|
241
|
-
password.
|
242
|
-
|
243
|
-
It does still require that the data bag has been encrypted for the user's or
|
244
|
-
client's pem and pushed to the Chef server. It mixes Chef into the gem and
|
245
|
-
uses it to go grab the data bag.
|
246
|
-
|
247
|
-
Use `chef-vault --help` to see all all available options
|
248
|
-
|
249
|
-
### Example usage (password)
|
250
|
-
|
251
|
-
chef-vault -v passwords -i root -a password -k /etc/chef/knife.rb
|
252
|
-
|
253
|
-
## TESTING
|
254
|
-
|
255
|
-
To stub vault items in ChefSpec, use the
|
256
|
-
[chef-vault-testfixtures](https://rubygems.org/gems/chef-vault-testfixtures)
|
257
|
-
gem.
|
258
|
-
|
259
|
-
To fall back to unencrypted JSON files in Test Kitchen, use the
|
260
|
-
`chef_vault_item` helper in the aforementioned chef-vault cookbook.
|
261
|
-
|
262
|
-
## THE FUTURE OF chef-vault
|
263
|
-
|
264
|
-
It has become clear that supporting alternate keying mechanisms like GPG and
|
265
|
-
Amazon KMS is something that chef-vault users want, but the implementation
|
266
|
-
of chef-vault v2 makes this difficult, as much of the code is tied to the
|
267
|
-
"side-along data bag item" implementation.
|
268
|
-
|
269
|
-
chef-vault v3.x.x will be a major rewrite. While the core vault item will
|
270
|
-
remain a Chef encrypted data bag item, the way in which you get the secret
|
271
|
-
to decrypt that data bag item will be delegated to plugins. At release,
|
272
|
-
there will be at least a plugin that emulates the 2.x.x implementation, and
|
273
|
-
hopefully one for KMS. Anyone who wants to support an alternate keying
|
274
|
-
implementation will be able to write one and distribute it as a gem for
|
275
|
-
others to use.
|
276
|
-
|
277
|
-
With that in mind, the 2.6.0 release is the last one that will receive new
|
278
|
-
features. If you refer to the
|
279
|
-
[milestones](https://github.com/Nordstrom/chef-vault/milestones) on Github,
|
280
|
-
the plan is for two releases prior to 3.x:
|
281
|
-
|
282
|
-
* v2.7.x will focus on reducing tech debt - getting the test coverage up to 100%
|
283
|
-
in both RSpec and Aruba, and getting the internal API docs completed.
|
284
|
-
* v2.99.x will be a transitional release. This release will add deprecation
|
285
|
-
warnings for any API or CLI option that will be changing in v3.x. Any user
|
286
|
-
who wants to stay with the 2.x series can use a '~> 2.x' constraint (where x
|
287
|
-
is any minor release of chef-vault) and be certain that they won't
|
288
|
-
accidentally get the new release.
|
289
|
-
|
290
|
-
If you are interested helping with the robustness fixes in v2.7.x, please
|
291
|
-
feel free to fork the repo and add more RSpec and Aruba tests. Frequent
|
292
|
-
small pull requests are preferred to large omnibus patches, as the
|
293
|
-
robustness pass is a multi-person effort and we don't want to create merge
|
294
|
-
conflicts unnecessarily.
|
295
|
-
|
296
|
-
## Contributing
|
297
|
-
|
298
|
-
For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
|
299
|
-
|
300
|
-
## Authors
|
301
|
-
|
302
|
-
Author:: Kevin Moser - @moserke<br>
|
303
|
-
Author:: Eli Klein - @eliklein<br>
|
304
|
-
Author:: Joey Geiger - @jgeiger<br>
|
305
|
-
Author:: Joshua Timberman - @jtimberman<br>
|
306
|
-
Author:: James FitzGibbon - @jf647<br>
|
307
|
-
Author:: Thom May - @thommay<br>
|
308
|
-
|
309
|
-
## Contributors
|
310
|
-
|
311
|
-
Contributor:: Matt Brimstone - @brimstone<br>
|
312
|
-
Contributor:: Thomas Gschwind - @thg65<br>
|
313
|
-
Contributor:: Reto Hermann<br>
|
314
|
-
|
315
|
-
## License
|
316
|
-
|
317
|
-
Copyright:: Copyright (c) 2013-15 Nordstrom, Inc.<br>
|
318
|
-
Copyright:: Copyright (c) 2016 Chef Software, Inc.<br>
|
319
|
-
License:: Apache License, Version 2.0
|
320
|
-
|
321
|
-
```text
|
322
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
323
|
-
you may not use this file except in compliance with the License.
|
324
|
-
You may obtain a copy of the License at
|
325
|
-
|
326
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
327
|
-
|
328
|
-
Unless required by applicable law or agreed to in writing, software
|
329
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
330
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
331
|
-
See the License for the specific language governing permissions and
|
332
|
-
limitations under the License.
|
333
|
-
```
|
data/Rakefile
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require_relative "tasks/github_changelog_generator"
|
3
|
-
|
4
|
-
# Style Tests
|
5
|
-
begin
|
6
|
-
require "chefstyle"
|
7
|
-
require "rubocop/rake_task"
|
8
|
-
RuboCop::RakeTask.new do |t|
|
9
|
-
t.formatters = ["progress"]
|
10
|
-
t.options = ["-D"]
|
11
|
-
end
|
12
|
-
|
13
|
-
# style is an alias for rubocop
|
14
|
-
task style: :rubocop
|
15
|
-
rescue LoadError
|
16
|
-
puts "ChefStyle not available; disabling style checking tasks"
|
17
|
-
end
|
18
|
-
|
19
|
-
# Unit Tests
|
20
|
-
begin
|
21
|
-
require "rspec/core/rake_task"
|
22
|
-
RSpec::Core::RakeTask.new
|
23
|
-
|
24
|
-
# Coverage
|
25
|
-
desc "Generate unit test coverage report"
|
26
|
-
task :coverage do
|
27
|
-
ENV["COVERAGE"] = "true"
|
28
|
-
Rake::Task[:spec].invoke
|
29
|
-
end
|
30
|
-
rescue LoadError
|
31
|
-
puts "RSpec not available; disabling rspec tasks"
|
32
|
-
# create a no-op spec task for :default
|
33
|
-
task :spec
|
34
|
-
end
|
35
|
-
|
36
|
-
# Feature Tests
|
37
|
-
begin
|
38
|
-
require "cucumber"
|
39
|
-
require "cucumber/rake/task"
|
40
|
-
Cucumber::Rake::Task.new(:features)
|
41
|
-
rescue LoadError
|
42
|
-
puts "Cucumber/Aruba not available; disabling feature tasks"
|
43
|
-
# create a no-op spec task for :default
|
44
|
-
task :features
|
45
|
-
end
|
46
|
-
|
47
|
-
# test or the default task runs spec, features, style
|
48
|
-
desc "run all tests"
|
49
|
-
task default: [:coverage, :features, :style]
|
50
|
-
task test: :default
|