hiera-eyaml-gpg 0.7.rc1 → 0.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +489 -0
- data/.travis.yml +27 -0
- data/CHANGELOG.md +88 -0
- data/Gemfile +4 -3
- data/HISTORY.md +45 -0
- data/README.md +65 -11
- data/Rakefile +20 -1
- data/hiera-eyaml-gpg.gemspec +11 -11
- data/lib/hiera/backend/eyaml/encryptors/gpg.rb +104 -100
- data/lib/hiera/backend/eyaml/encryptors/gpg/eyaml_init.rb +1 -1
- data/lib/hiera/backend/eyaml/encryptors/gpg/puppet_gpg.rb +30 -0
- data/lib/hiera/backend/eyaml/encryptors/gpg/version.rb +2 -2
- metadata +24 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2af61d8a176da52612993cbf649a6eafda4e5d6f
|
4
|
+
data.tar.gz: 0a7db420491c2f13023eedea25c003376236ea11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a827e567460559cbf2d7a5de01322bcc799869c627c9b6307bbefe76ea071955e3bd519268f1b571000f79825f5f90658fa1c42e784a920ad3de6e0a624beea1
|
7
|
+
data.tar.gz: 8b2d4a1f4b87f9a92534200ce3169d5052b12f1a9b2178197768a65e0b39de56a41194ce027f6db34463fa81bb85eae9e0c0d04f1e702fc2a97af2628ad27d1b
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,489 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 1.9
|
3
|
+
Lint/ConditionPosition:
|
4
|
+
Enabled: True
|
5
|
+
|
6
|
+
Lint/ElseLayout:
|
7
|
+
Enabled: True
|
8
|
+
|
9
|
+
Lint/UnreachableCode:
|
10
|
+
Enabled: True
|
11
|
+
|
12
|
+
Lint/UselessComparison:
|
13
|
+
Enabled: True
|
14
|
+
|
15
|
+
Lint/EnsureReturn:
|
16
|
+
Enabled: True
|
17
|
+
|
18
|
+
Lint/HandleExceptions:
|
19
|
+
Enabled: True
|
20
|
+
|
21
|
+
Lint/LiteralInCondition:
|
22
|
+
Enabled: True
|
23
|
+
|
24
|
+
Lint/ShadowingOuterLocalVariable:
|
25
|
+
Enabled: True
|
26
|
+
|
27
|
+
Lint/LiteralInInterpolation:
|
28
|
+
Enabled: True
|
29
|
+
|
30
|
+
Style/HashSyntax:
|
31
|
+
Enabled: True
|
32
|
+
|
33
|
+
Style/RedundantReturn:
|
34
|
+
Enabled: True
|
35
|
+
|
36
|
+
Layout/EndOfLine:
|
37
|
+
Enabled: False
|
38
|
+
|
39
|
+
Lint/AmbiguousOperator:
|
40
|
+
Enabled: True
|
41
|
+
|
42
|
+
Lint/AssignmentInCondition:
|
43
|
+
Enabled: True
|
44
|
+
|
45
|
+
Layout/SpaceBeforeComment:
|
46
|
+
Enabled: True
|
47
|
+
|
48
|
+
Style/AndOr:
|
49
|
+
Enabled: True
|
50
|
+
|
51
|
+
Style/RedundantSelf:
|
52
|
+
Enabled: True
|
53
|
+
|
54
|
+
Metrics/BlockLength:
|
55
|
+
Enabled: False
|
56
|
+
|
57
|
+
# Method length is not necessarily an indicator of code quality
|
58
|
+
Metrics/MethodLength:
|
59
|
+
Enabled: False
|
60
|
+
|
61
|
+
Metrics/ModuleLength:
|
62
|
+
Enabled: True
|
63
|
+
|
64
|
+
Style/WhileUntilModifier:
|
65
|
+
Enabled: True
|
66
|
+
|
67
|
+
Lint/AmbiguousRegexpLiteral:
|
68
|
+
Enabled: True
|
69
|
+
|
70
|
+
Security/Eval:
|
71
|
+
Enabled: True
|
72
|
+
|
73
|
+
Lint/BlockAlignment:
|
74
|
+
Enabled: True
|
75
|
+
|
76
|
+
Lint/DefEndAlignment:
|
77
|
+
Enabled: True
|
78
|
+
|
79
|
+
Lint/EndAlignment:
|
80
|
+
Enabled: True
|
81
|
+
|
82
|
+
Lint/DeprecatedClassMethods:
|
83
|
+
Enabled: True
|
84
|
+
|
85
|
+
Lint/Loop:
|
86
|
+
Enabled: True
|
87
|
+
|
88
|
+
Lint/ParenthesesAsGroupedExpression:
|
89
|
+
Enabled: True
|
90
|
+
|
91
|
+
Lint/RescueException:
|
92
|
+
Enabled: True
|
93
|
+
|
94
|
+
Lint/StringConversionInInterpolation:
|
95
|
+
Enabled: True
|
96
|
+
|
97
|
+
Lint/UnusedBlockArgument:
|
98
|
+
Enabled: True
|
99
|
+
|
100
|
+
Lint/UnusedMethodArgument:
|
101
|
+
Enabled: True
|
102
|
+
|
103
|
+
Lint/UselessAccessModifier:
|
104
|
+
Enabled: True
|
105
|
+
|
106
|
+
Lint/UselessAssignment:
|
107
|
+
Enabled: True
|
108
|
+
|
109
|
+
Lint/Void:
|
110
|
+
Enabled: True
|
111
|
+
|
112
|
+
Layout/AccessModifierIndentation:
|
113
|
+
Enabled: True
|
114
|
+
|
115
|
+
Naming/AccessorMethodName:
|
116
|
+
Enabled: True
|
117
|
+
|
118
|
+
Style/Alias:
|
119
|
+
Enabled: True
|
120
|
+
|
121
|
+
Layout/AlignArray:
|
122
|
+
Enabled: True
|
123
|
+
|
124
|
+
Layout/AlignHash:
|
125
|
+
Enabled: True
|
126
|
+
|
127
|
+
Layout/AlignParameters:
|
128
|
+
Enabled: True
|
129
|
+
|
130
|
+
Metrics/BlockNesting:
|
131
|
+
Enabled: True
|
132
|
+
|
133
|
+
Style/AsciiComments:
|
134
|
+
Enabled: True
|
135
|
+
|
136
|
+
Style/Attr:
|
137
|
+
Enabled: True
|
138
|
+
|
139
|
+
Style/BracesAroundHashParameters:
|
140
|
+
Enabled: True
|
141
|
+
|
142
|
+
Style/CaseEquality:
|
143
|
+
Enabled: True
|
144
|
+
|
145
|
+
Layout/CaseIndentation:
|
146
|
+
Enabled: True
|
147
|
+
|
148
|
+
Style/CharacterLiteral:
|
149
|
+
Enabled: True
|
150
|
+
|
151
|
+
Naming/ClassAndModuleCamelCase:
|
152
|
+
Enabled: True
|
153
|
+
|
154
|
+
Style/ClassAndModuleChildren:
|
155
|
+
Enabled: False
|
156
|
+
|
157
|
+
Style/ClassCheck:
|
158
|
+
Enabled: True
|
159
|
+
|
160
|
+
# Class length is not necessarily an indicator of code quality
|
161
|
+
Metrics/ClassLength:
|
162
|
+
Enabled: False
|
163
|
+
|
164
|
+
Style/ClassMethods:
|
165
|
+
Enabled: True
|
166
|
+
|
167
|
+
Style/ClassVars:
|
168
|
+
Enabled: True
|
169
|
+
|
170
|
+
Style/WhenThen:
|
171
|
+
Enabled: True
|
172
|
+
|
173
|
+
Style/WordArray:
|
174
|
+
Enabled: True
|
175
|
+
|
176
|
+
Style/UnneededPercentQ:
|
177
|
+
Enabled: True
|
178
|
+
|
179
|
+
Layout/Tab:
|
180
|
+
Enabled: True
|
181
|
+
|
182
|
+
Layout/SpaceBeforeSemicolon:
|
183
|
+
Enabled: True
|
184
|
+
|
185
|
+
Layout/TrailingBlankLines:
|
186
|
+
Enabled: True
|
187
|
+
|
188
|
+
Layout/SpaceInsideBlockBraces:
|
189
|
+
Enabled: True
|
190
|
+
|
191
|
+
Layout/SpaceInsideBrackets:
|
192
|
+
Enabled: True
|
193
|
+
|
194
|
+
Layout/SpaceInsideHashLiteralBraces:
|
195
|
+
Enabled: True
|
196
|
+
|
197
|
+
Layout/SpaceInsideParens:
|
198
|
+
Enabled: True
|
199
|
+
|
200
|
+
Layout/LeadingCommentSpace:
|
201
|
+
Enabled: True
|
202
|
+
|
203
|
+
Layout/SpaceBeforeFirstArg:
|
204
|
+
Enabled: True
|
205
|
+
|
206
|
+
Layout/SpaceAfterColon:
|
207
|
+
Enabled: True
|
208
|
+
|
209
|
+
Layout/SpaceAfterComma:
|
210
|
+
Enabled: True
|
211
|
+
|
212
|
+
Layout/SpaceAfterMethodName:
|
213
|
+
Enabled: True
|
214
|
+
|
215
|
+
Layout/SpaceAfterNot:
|
216
|
+
Enabled: True
|
217
|
+
|
218
|
+
Layout/SpaceAfterSemicolon:
|
219
|
+
Enabled: True
|
220
|
+
|
221
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
222
|
+
Enabled: True
|
223
|
+
|
224
|
+
Layout/SpaceAroundOperators:
|
225
|
+
Enabled: True
|
226
|
+
|
227
|
+
Layout/SpaceBeforeBlockBraces:
|
228
|
+
Enabled: True
|
229
|
+
|
230
|
+
Layout/SpaceBeforeComma:
|
231
|
+
Enabled: True
|
232
|
+
|
233
|
+
Style/CollectionMethods:
|
234
|
+
Enabled: True
|
235
|
+
|
236
|
+
Layout/CommentIndentation:
|
237
|
+
Enabled: True
|
238
|
+
|
239
|
+
Style/ColonMethodCall:
|
240
|
+
Enabled: True
|
241
|
+
|
242
|
+
Style/CommentAnnotation:
|
243
|
+
Enabled: True
|
244
|
+
|
245
|
+
# 'Complexity' is very relative
|
246
|
+
Metrics/CyclomaticComplexity:
|
247
|
+
Enabled: False
|
248
|
+
|
249
|
+
Naming/ConstantName:
|
250
|
+
Enabled: True
|
251
|
+
|
252
|
+
Style/Documentation:
|
253
|
+
Enabled: False
|
254
|
+
|
255
|
+
Style/DefWithParentheses:
|
256
|
+
Enabled: True
|
257
|
+
|
258
|
+
Style/PreferredHashMethods:
|
259
|
+
Enabled: True
|
260
|
+
|
261
|
+
Layout/DotPosition:
|
262
|
+
EnforcedStyle: trailing
|
263
|
+
|
264
|
+
Style/DoubleNegation:
|
265
|
+
Enabled: True
|
266
|
+
|
267
|
+
Style/EachWithObject:
|
268
|
+
Enabled: True
|
269
|
+
|
270
|
+
Layout/EmptyLineBetweenDefs:
|
271
|
+
Enabled: True
|
272
|
+
|
273
|
+
Layout/IndentArray:
|
274
|
+
Enabled: True
|
275
|
+
|
276
|
+
Layout/IndentHash:
|
277
|
+
Enabled: True
|
278
|
+
|
279
|
+
Layout/IndentationConsistency:
|
280
|
+
Enabled: True
|
281
|
+
|
282
|
+
Layout/IndentationWidth:
|
283
|
+
Enabled: True
|
284
|
+
|
285
|
+
Layout/EmptyLines:
|
286
|
+
Enabled: True
|
287
|
+
|
288
|
+
Layout/EmptyLinesAroundAccessModifier:
|
289
|
+
Enabled: True
|
290
|
+
|
291
|
+
Style/EmptyLiteral:
|
292
|
+
Enabled: True
|
293
|
+
|
294
|
+
# Configuration parameters: AllowURI, URISchemes.
|
295
|
+
Metrics/LineLength:
|
296
|
+
Enabled: False
|
297
|
+
|
298
|
+
Style/MethodCallWithoutArgsParentheses:
|
299
|
+
Enabled: True
|
300
|
+
|
301
|
+
Style/MethodDefParentheses:
|
302
|
+
Enabled: True
|
303
|
+
|
304
|
+
Style/LineEndConcatenation:
|
305
|
+
Enabled: True
|
306
|
+
|
307
|
+
Layout/TrailingWhitespace:
|
308
|
+
Enabled: True
|
309
|
+
|
310
|
+
Style/StringLiterals:
|
311
|
+
Enabled: True
|
312
|
+
|
313
|
+
Style/TrailingCommaInArguments:
|
314
|
+
Enabled: True
|
315
|
+
|
316
|
+
Style/TrailingCommaInLiteral:
|
317
|
+
Enabled: True
|
318
|
+
|
319
|
+
Style/GlobalVars:
|
320
|
+
Enabled: True
|
321
|
+
|
322
|
+
Style/GuardClause:
|
323
|
+
Enabled: True
|
324
|
+
|
325
|
+
Style/IfUnlessModifier:
|
326
|
+
Enabled: True
|
327
|
+
|
328
|
+
Style/MultilineIfThen:
|
329
|
+
Enabled: True
|
330
|
+
|
331
|
+
Style/NegatedIf:
|
332
|
+
Enabled: True
|
333
|
+
|
334
|
+
Style/NegatedWhile:
|
335
|
+
Enabled: True
|
336
|
+
|
337
|
+
Style/Next:
|
338
|
+
Enabled: True
|
339
|
+
|
340
|
+
Style/SingleLineBlockParams:
|
341
|
+
Enabled: True
|
342
|
+
|
343
|
+
Style/SingleLineMethods:
|
344
|
+
Enabled: True
|
345
|
+
|
346
|
+
Style/SpecialGlobalVars:
|
347
|
+
Enabled: True
|
348
|
+
|
349
|
+
Style/TrivialAccessors:
|
350
|
+
Enabled: True
|
351
|
+
|
352
|
+
Style/UnlessElse:
|
353
|
+
Enabled: True
|
354
|
+
|
355
|
+
Style/VariableInterpolation:
|
356
|
+
Enabled: True
|
357
|
+
|
358
|
+
Naming/VariableName:
|
359
|
+
Enabled: True
|
360
|
+
|
361
|
+
Style/WhileUntilDo:
|
362
|
+
Enabled: True
|
363
|
+
|
364
|
+
Style/EvenOdd:
|
365
|
+
Enabled: True
|
366
|
+
|
367
|
+
Naming/FileName:
|
368
|
+
Enabled: True
|
369
|
+
|
370
|
+
Style/For:
|
371
|
+
Enabled: True
|
372
|
+
|
373
|
+
Style/Lambda:
|
374
|
+
Enabled: True
|
375
|
+
|
376
|
+
Naming/MethodName:
|
377
|
+
Enabled: True
|
378
|
+
|
379
|
+
Style/MultilineTernaryOperator:
|
380
|
+
Enabled: True
|
381
|
+
|
382
|
+
Style/NestedTernaryOperator:
|
383
|
+
Enabled: True
|
384
|
+
|
385
|
+
Style/NilComparison:
|
386
|
+
Enabled: True
|
387
|
+
|
388
|
+
Style/FormatString:
|
389
|
+
Enabled: True
|
390
|
+
|
391
|
+
Style/MultilineBlockChain:
|
392
|
+
Enabled: True
|
393
|
+
|
394
|
+
Style/Semicolon:
|
395
|
+
Enabled: True
|
396
|
+
|
397
|
+
Style/SignalException:
|
398
|
+
Enabled: True
|
399
|
+
|
400
|
+
Style/NonNilCheck:
|
401
|
+
Enabled: True
|
402
|
+
|
403
|
+
Style/Not:
|
404
|
+
Enabled: True
|
405
|
+
|
406
|
+
Style/NumericLiterals:
|
407
|
+
Enabled: True
|
408
|
+
|
409
|
+
Style/OneLineConditional:
|
410
|
+
Enabled: True
|
411
|
+
|
412
|
+
Naming/BinaryOperatorParameterName:
|
413
|
+
Enabled: True
|
414
|
+
|
415
|
+
Style/ParenthesesAroundCondition:
|
416
|
+
Enabled: True
|
417
|
+
|
418
|
+
Style/PercentLiteralDelimiters:
|
419
|
+
Enabled: True
|
420
|
+
|
421
|
+
Style/PerlBackrefs:
|
422
|
+
Enabled: True
|
423
|
+
|
424
|
+
Naming/PredicateName:
|
425
|
+
Enabled: True
|
426
|
+
|
427
|
+
Style/RedundantException:
|
428
|
+
Enabled: True
|
429
|
+
|
430
|
+
Style/SelfAssignment:
|
431
|
+
Enabled: True
|
432
|
+
|
433
|
+
Style/Proc:
|
434
|
+
Enabled: True
|
435
|
+
|
436
|
+
Style/RaiseArgs:
|
437
|
+
Enabled: True
|
438
|
+
|
439
|
+
Style/RedundantBegin:
|
440
|
+
Enabled: True
|
441
|
+
|
442
|
+
Style/RescueModifier:
|
443
|
+
Enabled: True
|
444
|
+
|
445
|
+
# based on https://github.com/voxpupuli/modulesync_config/issues/168
|
446
|
+
Style/RegexpLiteral:
|
447
|
+
EnforcedStyle: percent_r
|
448
|
+
Enabled: True
|
449
|
+
|
450
|
+
Lint/UnderscorePrefixedVariableName:
|
451
|
+
Enabled: True
|
452
|
+
|
453
|
+
Metrics/ParameterLists:
|
454
|
+
Enabled: False
|
455
|
+
|
456
|
+
Lint/RequireParentheses:
|
457
|
+
Enabled: True
|
458
|
+
|
459
|
+
Style/ModuleFunction:
|
460
|
+
Enabled: True
|
461
|
+
|
462
|
+
Lint/Debugger:
|
463
|
+
Enabled: True
|
464
|
+
|
465
|
+
Style/IfWithSemicolon:
|
466
|
+
Enabled: True
|
467
|
+
|
468
|
+
Style/Encoding:
|
469
|
+
Enabled: True
|
470
|
+
|
471
|
+
Style/BlockDelimiters:
|
472
|
+
Enabled: True
|
473
|
+
|
474
|
+
Layout/MultilineBlockLayout:
|
475
|
+
Enabled: True
|
476
|
+
|
477
|
+
# 'Complexity' is very relative
|
478
|
+
Metrics/AbcSize:
|
479
|
+
Enabled: False
|
480
|
+
|
481
|
+
# 'Complexity' is very relative
|
482
|
+
Metrics/PerceivedComplexity:
|
483
|
+
Enabled: False
|
484
|
+
|
485
|
+
Lint/UselessAssignment:
|
486
|
+
Enabled: True
|
487
|
+
|
488
|
+
Layout/ClosingParenthesisIndentation:
|
489
|
+
Enabled: True
|
data/.travis.yml
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
---
|
2
|
+
sudo: false
|
3
|
+
language: ruby
|
4
|
+
cache: bundler
|
5
|
+
dist: trusty
|
6
|
+
script: 'bundle exec rake test'
|
7
|
+
rvm:
|
8
|
+
- 2.4.6
|
9
|
+
notifications:
|
10
|
+
email: false
|
11
|
+
irc:
|
12
|
+
on_success: always
|
13
|
+
on_failure: always
|
14
|
+
channels:
|
15
|
+
- "chat.freenode.org#voxpupuli-notifications"
|
16
|
+
branches:
|
17
|
+
only:
|
18
|
+
- master
|
19
|
+
- /^v\d/
|
20
|
+
deploy:
|
21
|
+
provider: rubygems
|
22
|
+
api_key:
|
23
|
+
secure: 'kGpuGiJSgWXwKoLXXCy7JPBEbDhumaLxQiAn7H74tAN5qYZHE9kVP1aIOet1z5utLLKSu+97ZxH0s/ZL9DoSk/S2ENapIsnsZBPu+nnaN9xW/zWsF/h1xVxbaPhE5QJOqNH8fbIq4HwNoEAgzf/uPK29e75qgChNZyDaaQRTLF1ZFdyLvryEAq9ezEV0GVvIYG4pLxykimKIaR6DOv/4YhtpoFOPADlEIv38r4gqfnPEZm7gXq3yoSLGxDmKzs0NvzAlL2OKwurVArAt042G/y5ZtSe1hP+oJGKFZ/fcL4rcMcU3YTl9sgb12R9q2iCC1MPftZLv4qIC8NrcDUkQ/IxEFMzaJs6KQNIHiFYClS1HL9zYlRH/Aek6wq+N2J2e7SCRvf9TAQb1BmV6vNsDcnAfVaUw6On6E0BIM8boUow1e4sTYSX2bdqO2tWq6PN/eWAXsTfCGNNyec9zPEXDOeiWnQ/x21AcPV7X0ESNhjNQQmmsq/owuBrlrpei9r6moY3IoMCt3JRdzyaMfFia6KuZqvQamd29rK0tqxY/PiCy+QtkxAnH7yAgDCykCGagUn7NrJdmTdc4MXvfJIi3EF2laiQebOn9V85WKIWmjwZkjgBnGWGFHEf9Df8WHyAElp9cghmXZSI/ZeaM6lhn/AnSrdOfyTuSaUQwkCSRAG8='
|
24
|
+
gem: hiera-eyaml-gpg
|
25
|
+
on:
|
26
|
+
tags: true
|
27
|
+
repo: voxpupuli/hiera-eyaml-gpg
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
## [v0.7.1](https://github.com/voxpupuli/hiera-eyaml-gpg/tree/v0.7.1) (2019-04-24)
|
6
|
+
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/hiera-eyaml-gpg/compare/v0.7.0...v0.7.1)
|
8
|
+
|
9
|
+
**Merged pull requests:**
|
10
|
+
|
11
|
+
- Use correct travis-ci.com secret [\#61](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/61) ([alexjfisher](https://github.com/alexjfisher))
|
12
|
+
|
13
|
+
## [v0.7.0](https://github.com/voxpupuli/hiera-eyaml-gpg/tree/v0.7.0) (2019-04-24)
|
14
|
+
|
15
|
+
[Full Changelog](https://github.com/voxpupuli/hiera-eyaml-gpg/compare/vp_migration...v0.7.0)
|
16
|
+
|
17
|
+
This is the first release of `hiera-eyaml-gpg` since the project was migrated to [Vox Pupuli](https://voxpupuli.org/). We're pleased to announce that this project should now work with Puppet 6 (jruby 9k puppetserver). Special thanks to [seanmil](https://github.com/seanmil) for his work on this.
|
18
|
+
|
19
|
+
From this point onwards, all releases made to rubygems will have corresponding tags in the github project and a changelog will be maintained with [GitHub Changelog Generator](https://github.com/github-changelog-generator/github-changelog-generator). The project will use [semantic versioning](https://semver.org/).
|
20
|
+
|
21
|
+
**Implemented enhancements:**
|
22
|
+
|
23
|
+
- Expose plugin version [\#58](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/58) ([alexjfisher](https://github.com/alexjfisher))
|
24
|
+
- Use Puppet::Util::Execution for RubyGpg [\#48](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/48) ([seanmil](https://github.com/seanmil))
|
25
|
+
- Allow gnupghome to be set from an environment variable [\#46](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/46) ([seanmil](https://github.com/seanmil))
|
26
|
+
|
27
|
+
**Fixed bugs:**
|
28
|
+
|
29
|
+
- blank lines in a recipients file results in the first key in the being used to encrypt the secrets [\#37](https://github.com/voxpupuli/hiera-eyaml-gpg/issues/37)
|
30
|
+
- Fix `uninitialized constant Puppet \(NameError\)` [\#55](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/55) ([alexjfisher](https://github.com/alexjfisher))
|
31
|
+
- Make the list of keys to encrypt with accurate [\#38](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/38) ([grahamhar](https://github.com/grahamhar))
|
32
|
+
|
33
|
+
**Merged pull requests:**
|
34
|
+
|
35
|
+
- Refactoring and fixing of remaining rubocop violations [\#57](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/57) ([alexjfisher](https://github.com/alexjfisher))
|
36
|
+
- Fix `\<module:Encryptors\>: Gpg is not a class \(TypeError\)` [\#56](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/56) ([alexjfisher](https://github.com/alexjfisher))
|
37
|
+
- Document installation of gems on puppetserver [\#53](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/53) ([ghoneycutt](https://github.com/ghoneycutt))
|
38
|
+
- Document usage with Hiera 5 [\#51](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/51) ([ghoneycutt](https://github.com/ghoneycutt))
|
39
|
+
- Document which versions of Puppet this should work with [\#50](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/50) ([ghoneycutt](https://github.com/ghoneycutt))
|
40
|
+
|
41
|
+
## v0.6 (2015-09-10)
|
42
|
+
|
43
|
+
**Implemented enhancements:**
|
44
|
+
|
45
|
+
- Improve GPG home handling [\#30](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/30) ([sihil](https://github.com/sihil))
|
46
|
+
- Add support for comments in hiera-eyaml-gpg.recipients file [\#29](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/29) ([tampakrap](https://github.com/tampakrap))
|
47
|
+
|
48
|
+
**Fixed bugs:**
|
49
|
+
|
50
|
+
- Add missing curly brace. [\#31](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/31) ([danny-cheung](https://github.com/danny-cheung))
|
51
|
+
|
52
|
+
## v0.5 (2015-03-21)
|
53
|
+
|
54
|
+
**Implemented enhancements:**
|
55
|
+
|
56
|
+
- Adapt code for Puppetserver [\#24](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/24) ([raphink](https://github.com/raphink))
|
57
|
+
- Set GPG home directory without an environment variable [\#19](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/19) ([mattbostock](https://github.com/mattbostock))
|
58
|
+
|
59
|
+
**Closed issues:**
|
60
|
+
|
61
|
+
- Support for puppetserver \(jruby\) [\#23](https://github.com/voxpupuli/hiera-eyaml-gpg/issues/23)
|
62
|
+
|
63
|
+
## [v0.4](https://github.com/voxpupuli/hiera-eyaml-gpg/tree/v0.4) (2013-11-26)
|
64
|
+
|
65
|
+
[Full Changelog](https://github.com/voxpupuli/hiera-eyaml-gpg/compare/v0.3...v0.4)
|
66
|
+
|
67
|
+
**Closed issues:**
|
68
|
+
|
69
|
+
- Encryption should fail if don't have hiera-gpg key on my keyring [\#7](https://github.com/voxpupuli/hiera-eyaml-gpg/issues/7)
|
70
|
+
|
71
|
+
**Merged pull requests:**
|
72
|
+
|
73
|
+
- \[FIX\] keys map not being set correctly [\#9](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/9) ([rooprob](https://github.com/rooprob))
|
74
|
+
|
75
|
+
## [v0.3](https://github.com/voxpupuli/hiera-eyaml-gpg/tree/v0.3) (2013-11-22)
|
76
|
+
|
77
|
+
[Full Changelog](https://github.com/voxpupuli/hiera-eyaml-gpg/compare/709b12bcd637a18672847946c410701d32096e0c...v0.3)
|
78
|
+
|
79
|
+
**Implemented enhancements:**
|
80
|
+
|
81
|
+
- Use gpg-agent when using the edit option [\#2](https://github.com/voxpupuli/hiera-eyaml-gpg/issues/2)
|
82
|
+
|
83
|
+
**Merged pull requests:**
|
84
|
+
|
85
|
+
- Fix typo. [\#5](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/5) ([javins](https://github.com/javins))
|
86
|
+
|
87
|
+
|
88
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile
CHANGED
@@ -1,7 +1,8 @@
|
|
1
|
-
source 'https://rubygems.org
|
1
|
+
source ENV['GEM_SOURCE'] || 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
3
|
+
gemspec
|
4
4
|
|
5
5
|
group :development do
|
6
|
-
gem
|
6
|
+
gem 'github_changelog_generator', require: false, git: 'https://github.com/github-changelog-generator/github-changelog-generator'
|
7
|
+
gem 'rubocop', '~> 0.50.0'
|
7
8
|
end
|
data/HISTORY.md
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
## v0.6 (2015-09-10)
|
2
|
+
|
3
|
+
**Implemented enhancements:**
|
4
|
+
|
5
|
+
- Improve GPG home handling [\#30](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/30) ([sihil](https://github.com/sihil))
|
6
|
+
- Add support for comments in hiera-eyaml-gpg.recipients file [\#29](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/29) ([tampakrap](https://github.com/tampakrap))
|
7
|
+
|
8
|
+
**Fixed bugs:**
|
9
|
+
|
10
|
+
- Add missing curly brace. [\#31](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/31) ([danny-cheung](https://github.com/danny-cheung))
|
11
|
+
|
12
|
+
## v0.5 (2015-03-21)
|
13
|
+
|
14
|
+
**Implemented enhancements:**
|
15
|
+
|
16
|
+
- Adapt code for Puppetserver [\#24](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/24) ([raphink](https://github.com/raphink))
|
17
|
+
- Set GPG home directory without an environment variable [\#19](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/19) ([mattbostock](https://github.com/mattbostock))
|
18
|
+
|
19
|
+
**Closed issues:**
|
20
|
+
|
21
|
+
- Support for puppetserver \(jruby\) [\#23](https://github.com/voxpupuli/hiera-eyaml-gpg/issues/23)
|
22
|
+
|
23
|
+
## [v0.4](https://github.com/voxpupuli/hiera-eyaml-gpg/tree/v0.4) (2013-11-26)
|
24
|
+
|
25
|
+
[Full Changelog](https://github.com/voxpupuli/hiera-eyaml-gpg/compare/v0.3...v0.4)
|
26
|
+
|
27
|
+
**Closed issues:**
|
28
|
+
|
29
|
+
- Encryption should fail if don't have hiera-gpg key on my keyring [\#7](https://github.com/voxpupuli/hiera-eyaml-gpg/issues/7)
|
30
|
+
|
31
|
+
**Merged pull requests:**
|
32
|
+
|
33
|
+
- \[FIX\] keys map not being set correctly [\#9](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/9) ([rooprob](https://github.com/rooprob))
|
34
|
+
|
35
|
+
## [v0.3](https://github.com/voxpupuli/hiera-eyaml-gpg/tree/v0.3) (2013-11-22)
|
36
|
+
|
37
|
+
[Full Changelog](https://github.com/voxpupuli/hiera-eyaml-gpg/compare/709b12bcd637a18672847946c410701d32096e0c...v0.3)
|
38
|
+
|
39
|
+
**Implemented enhancements:**
|
40
|
+
|
41
|
+
- Use gpg-agent when using the edit option [\#2](https://github.com/voxpupuli/hiera-eyaml-gpg/issues/2)
|
42
|
+
|
43
|
+
**Merged pull requests:**
|
44
|
+
|
45
|
+
- Fix typo. [\#5](https://github.com/voxpupuli/hiera-eyaml-gpg/pull/5) ([javins](https://github.com/javins))
|
data/README.md
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
hiera-eyaml-gpg
|
2
2
|
===============
|
3
3
|
|
4
|
-
|
4
|
+
[![Gem Version](https://img.shields.io/gem/v/hiera-eyaml-gpg.svg)](https://rubygems.org/gems/hiera-eyaml-gpg)
|
5
|
+
[![Gem Downloads](https://img.shields.io/gem/dt/hiera-eyaml-gpg.svg)](https://rubygems.org/gems/hiera-eyaml-gpg)
|
6
|
+
|
7
|
+
GPG encryption backend for the [hiera-eyaml](https://github.com/voxpupuli/hiera-eyaml) module.
|
5
8
|
|
6
9
|
Motivation
|
7
10
|
----------
|
@@ -37,11 +40,26 @@ Note: you will need to use `ruby_gpg` with the Puppet server as it uses JRuby wh
|
|
37
40
|
make use of native extensions such as `gpgme`.
|
38
41
|
|
39
42
|
If you haven't already installed it, this requires and will install the hiera-eyaml gem, which you
|
40
|
-
should probably
|
43
|
+
should probably acquaint yourself with at https://github.com/TomPoulton/hiera-eyaml.
|
41
44
|
|
42
45
|
Note that in order to install the gpgme gem you'll need to have the ruby development package installed
|
43
46
|
for your distribution.
|
44
47
|
|
48
|
+
For use on puppetserver
|
49
|
+
---
|
50
|
+
|
51
|
+
As root
|
52
|
+
|
53
|
+
```sh
|
54
|
+
/opt/puppetlabs/puppet/bin/gem install hiera-eyaml-gpg ruby_gpg
|
55
|
+
/opt/puppetlabs/server/bin/puppetserver gem install hiera-eyaml-gpg ruby_gpg
|
56
|
+
```
|
57
|
+
|
58
|
+
Puppet versions
|
59
|
+
---------------
|
60
|
+
|
61
|
+
This project supports Puppet 5.5.8 and later.
|
62
|
+
|
45
63
|
How to use
|
46
64
|
----------
|
47
65
|
|
@@ -68,16 +86,52 @@ Use `eyaml --help` for more details or look at the hiera-eyaml docs.
|
|
68
86
|
|
69
87
|
### Configuring hiera
|
70
88
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
89
|
+
This assumes you have a working `hiera` and `hiera-eyaml`. Please note that the private GPG key must not
|
90
|
+
have a passphrase.
|
91
|
+
|
92
|
+
Each level of the hierarchy must specify the `gpg_gnupghome` option with the path to the keyring as well
|
93
|
+
as specifying `lookup_key` with the value `eyaml_lookup_key`. The following example shows a simple hierarchy.
|
94
|
+
|
95
|
+
```yaml
|
96
|
+
---
|
97
|
+
version: 5
|
98
|
+
defaults:
|
99
|
+
hierarchy:
|
100
|
+
- name: "Per-node data (yaml version)"
|
101
|
+
lookup_key: eyaml_lookup_key
|
102
|
+
options:
|
103
|
+
gpg_gnupghome: /opt/puppetlabs/server/data/puppetserver/.gnupg
|
104
|
+
path: "nodes/%{::trusted.certname}.yaml"
|
105
|
+
- name: "Role data"
|
106
|
+
lookup_key: eyaml_lookup_key
|
107
|
+
options:
|
108
|
+
gpg_gnupghome: /opt/puppetlabs/server/data/puppetserver/.gnupg
|
109
|
+
paths:
|
110
|
+
- "role/%{facts.role}.yaml"
|
111
|
+
- name: "Per platform data"
|
112
|
+
lookup_key: eyaml_lookup_key
|
113
|
+
options:
|
114
|
+
gpg_gnupghome: /opt/puppetlabs/server/data/puppetserver/.gnupg
|
115
|
+
paths:
|
116
|
+
- "kernel/%{::kernel}.yaml"
|
117
|
+
- "osfamily/%{::osfamily}.yaml"
|
118
|
+
- "osfamily/%{::osfamily}-%{::operatingsystemmajrelease}.yaml"
|
119
|
+
- name: "Default"
|
120
|
+
lookup_key: eyaml_lookup_key
|
121
|
+
options:
|
122
|
+
gpg_gnupghome: /opt/puppetlabs/server/data/puppetserver/.gnupg
|
123
|
+
paths:
|
124
|
+
- "common.yaml"
|
125
|
+
```
|
126
|
+
|
127
|
+
For command line uses such as `puppet lookup` where the `gpg_gnupghome` setting in the `hiera.yaml`
|
128
|
+
configuration does not match a directory the user has access to, you can override the `gpg_gnupghome`
|
129
|
+
setting by setting the path in the environment variable `HIERA_EYAML_GPG_GNUPGHOME` and, if set, that
|
130
|
+
will be used instead of `gpg_gnupghome`.
|
131
|
+
|
132
|
+
$ HIERA_EYAML_GPG_GNUPGHOME=~/.gnupg puppet lookup my_key
|
75
133
|
|
76
134
|
Authors
|
77
135
|
-------
|
78
136
|
|
79
|
-
|
80
|
-
- Geoff Meakins - Created hiera-eyaml plugin framework that made this possible
|
81
|
-
|
82
|
-
### Contributors
|
83
|
-
- Walt Javins - Bug fixes
|
137
|
+
Thanks to Simon Hildrew for the inital code. Other contributors can be seen at [https://github.com/voxpupuli/hiera-eyaml-gpg/graphs/contributors](https://github.com/voxpupuli/hiera-eyaml-gpg/graphs/contributors)
|
data/Rakefile
CHANGED
@@ -1 +1,20 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rubocop/rake_task'
|
3
|
+
require 'github_changelog_generator/task'
|
4
|
+
|
5
|
+
desc 'Run RuboCop on the lib directory'
|
6
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
7
|
+
task.patterns = ['lib/**/*.rb']
|
8
|
+
end
|
9
|
+
|
10
|
+
task test: %w[clean rubocop]
|
11
|
+
|
12
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
13
|
+
version = Hiera::Backend::Eyaml::Encryptors::GpgVersion::VERSION
|
14
|
+
config.future_release = "v#{version}" if version =~ %r{^\d+\.\d+.\d+$}
|
15
|
+
config.header = "# Changelog\n\nAll notable changes to this project will be documented in this file."
|
16
|
+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog]
|
17
|
+
config.user = 'voxpupuli'
|
18
|
+
config.project = 'hiera-eyaml-gpg'
|
19
|
+
config.since_tag = 'vp_migration'
|
20
|
+
end
|
data/hiera-eyaml-gpg.gemspec
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'hiera/backend/eyaml/encryptors/gpg/version'
|
5
4
|
|
6
5
|
Gem::Specification.new do |gem|
|
7
|
-
gem.name =
|
8
|
-
gem.version = Hiera::Backend::Eyaml::Encryptors::
|
9
|
-
gem.description =
|
10
|
-
gem.summary =
|
11
|
-
gem.author =
|
12
|
-
gem.license =
|
6
|
+
gem.name = 'hiera-eyaml-gpg'
|
7
|
+
gem.version = Hiera::Backend::Eyaml::Encryptors::GpgVersion::VERSION
|
8
|
+
gem.description = 'GPG encryptor for use with hiera-eyaml'
|
9
|
+
gem.summary = 'Encryption plugin for hiera-eyaml backend for Hiera'
|
10
|
+
gem.author = 'Simon Hildrew'
|
11
|
+
gem.license = 'MIT'
|
13
12
|
|
14
|
-
gem.homepage =
|
15
|
-
gem.files = `git ls-files`.split(
|
16
|
-
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
13
|
+
gem.homepage = 'http://github.com/sihil/hiera-eyaml-gpg'
|
14
|
+
gem.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
15
|
+
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
17
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
-
gem.require_paths = [
|
17
|
+
gem.require_paths = ['lib']
|
19
18
|
|
20
19
|
gem.add_dependency('hiera-eyaml', '>=1.3.8')
|
20
|
+
gem.add_dependency('puppet', '>=5.5.8')
|
21
21
|
end
|
@@ -4,8 +4,9 @@ rescue LoadError
|
|
4
4
|
begin
|
5
5
|
require 'ruby_gpg'
|
6
6
|
rescue LoadError
|
7
|
-
|
7
|
+
raise "hiera-eyaml-gpg requires either the 'gpgme' or 'ruby_gpg' gem"
|
8
8
|
end
|
9
|
+
require 'hiera/backend/eyaml/encryptors/gpg/puppet_gpg'
|
9
10
|
end
|
10
11
|
|
11
12
|
require 'base64'
|
@@ -18,51 +19,52 @@ class Hiera
|
|
18
19
|
module Backend
|
19
20
|
module Eyaml
|
20
21
|
module Encryptors
|
21
|
-
|
22
22
|
class Gpg < Encryptor
|
23
|
-
|
24
|
-
self.tag =
|
23
|
+
VERSION = Hiera::Backend::Eyaml::Encryptors::GpgVersion::VERSION
|
24
|
+
self.tag = 'GPG'
|
25
25
|
|
26
26
|
self.options = {
|
27
|
-
:
|
28
|
-
|
29
|
-
|
30
|
-
:
|
31
|
-
|
32
|
-
|
33
|
-
:
|
34
|
-
|
35
|
-
:
|
36
|
-
|
27
|
+
gnupghome: { desc: 'Location of your GNUPGHOME directory',
|
28
|
+
type: :string,
|
29
|
+
default: (%w[HOME HOMEPATH].reject { |h| ENV[h].nil? }.map { |h| ENV[h] + '/.gnupg' }.first || '').to_s },
|
30
|
+
always_trust: { desc: 'Assume that used keys are fully trusted',
|
31
|
+
type: :boolean,
|
32
|
+
default: false },
|
33
|
+
recipients: { desc: 'List of recipients (comma separated)',
|
34
|
+
type: :string },
|
35
|
+
recipients_file: { desc: 'File containing a list of recipients (one on each line)',
|
36
|
+
type: :string }
|
37
37
|
}
|
38
38
|
|
39
|
-
|
39
|
+
@passphrase_cache = {}
|
40
40
|
|
41
|
-
def self.passfunc(
|
42
|
-
|
43
|
-
system('stty -echo')
|
41
|
+
def self.passfunc(_hook, uid_hint, _passphrase_info, _prev_was_bad, fd)
|
42
|
+
system('stty -echo')
|
44
43
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
end
|
44
|
+
unless @passphrase_cache.key?(uid_hint)
|
45
|
+
@passphrase_cache[uid_hint] = ask("Enter passphrase for #{uid_hint}: ") { |q| q.echo = '' }
|
46
|
+
$stderr.puts
|
47
|
+
end
|
48
|
+
passphrase = @passphrase_cache[uid_hint]
|
49
|
+
|
50
|
+
io = IO.for_fd(fd, 'w')
|
51
|
+
io.puts(passphrase)
|
52
|
+
io.flush
|
53
|
+
ensure
|
54
|
+
(0...$LAST_READ_LINE.length).each { |i| $LAST_READ_LINE[i] = '0' } if $LAST_READ_LINE
|
55
|
+
system('stty echo')
|
58
56
|
end
|
59
57
|
|
60
58
|
def self.gnupghome
|
61
|
-
gnupghome =
|
59
|
+
gnupghome = if ENV['HIERA_EYAML_GPG_GNUPGHOME'].nil?
|
60
|
+
option :gnupghome
|
61
|
+
else
|
62
|
+
ENV['HIERA_EYAML_GPG_GNUPGHOME']
|
63
|
+
end
|
62
64
|
debug("GNUPGHOME is #{gnupghome}")
|
63
65
|
if gnupghome.nil? || gnupghome.empty?
|
64
|
-
warn(
|
65
|
-
raise ArgumentError,
|
66
|
+
warn('No GPG home directory configured, check gpg_gnupghome configuration value is correct')
|
67
|
+
raise ArgumentError, 'No GPG home directory configured, check gpg_gnupghome configuration value is correct'
|
66
68
|
elsif !File.directory?(gnupghome)
|
67
69
|
warn("Configured GPG home directory #{gnupghome} doesn't exist, check gpg_gnupghome configuration value is correct")
|
68
70
|
raise ArgumentError, "Configured GPG home directory #{gnupghome} doesn't exist, check gpg_gnupghome configuration value is correct"
|
@@ -71,76 +73,30 @@ class Hiera
|
|
71
73
|
end
|
72
74
|
end
|
73
75
|
|
74
|
-
def self.
|
75
|
-
recipient_option = self.option :recipients
|
76
|
-
recipients = if !recipient_option.nil?
|
77
|
-
debug("Using --recipients option")
|
78
|
-
recipient_option.split(",")
|
79
|
-
else
|
80
|
-
recipient_file_option = self.option :recipients_file
|
81
|
-
recipient_file = if !recipient_file_option.nil?
|
82
|
-
debug("Using --recipients-file option")
|
83
|
-
Pathname.new(recipient_file_option)
|
84
|
-
else
|
85
|
-
debug("Searching for any hiera-eyaml-gpg.recipients files in path")
|
86
|
-
# if we are editing a file, look for a hiera-eyaml-gpg.recipients file
|
87
|
-
filename = case Eyaml::Options[:source]
|
88
|
-
when :file
|
89
|
-
Eyaml::Options[:file]
|
90
|
-
when :eyaml
|
91
|
-
Eyaml::Options[:eyaml]
|
92
|
-
else
|
93
|
-
nil
|
94
|
-
end
|
95
|
-
|
96
|
-
if filename.nil?
|
97
|
-
nil
|
98
|
-
else
|
99
|
-
path = Pathname.new(filename).realpath.dirname
|
100
|
-
selected_file = nil
|
101
|
-
path.descend{|path| path
|
102
|
-
potential_file = path.join('hiera-eyaml-gpg.recipients')
|
103
|
-
selected_file = potential_file if potential_file.exist?
|
104
|
-
}
|
105
|
-
debug("Using file at #{selected_file}")
|
106
|
-
selected_file
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
unless recipient_file.nil?
|
111
|
-
recipient_file.readlines.map{ |line|
|
112
|
-
line.strip unless line.start_with? '#' or line.strip.empty?
|
113
|
-
}.compact
|
114
|
-
else
|
115
|
-
[]
|
116
|
-
end
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def self.encrypt plaintext
|
76
|
+
def self.encrypt(plaintext)
|
121
77
|
unless defined?(GPGME)
|
122
78
|
raise RecoverableError, "Encryption is only supported when using the 'gpgme' gem"
|
123
79
|
end
|
124
80
|
|
125
|
-
GPGME::Engine.home_dir =
|
81
|
+
GPGME::Engine.home_dir = gnupghome
|
126
82
|
|
127
83
|
ctx = GPGME::Ctx.new
|
128
84
|
|
129
|
-
recipients =
|
85
|
+
recipients = find_recipients
|
130
86
|
debug("Recipents are #{recipients}")
|
131
87
|
|
132
88
|
raise RecoverableError, 'No recipients provided, don\'t know who to encrypt to' if recipients.empty?
|
133
89
|
|
134
|
-
keys = recipients.map
|
90
|
+
keys = recipients.map do |r|
|
135
91
|
key_to_use = ctx.keys(r).first
|
136
92
|
if key_to_use.nil?
|
137
93
|
raise RecoverableError, "No key found on keyring for #{r}"
|
138
94
|
end
|
139
95
|
key_to_use
|
140
|
-
|
96
|
+
end
|
141
97
|
debug("Keys: #{keys}")
|
142
98
|
|
143
|
-
always_trust =
|
99
|
+
always_trust = option(:always_trust)
|
144
100
|
unless always_trust
|
145
101
|
# check validity of recipients (this is possibly naive, but better than the unhelpful
|
146
102
|
# error that it would spit out otherwise)
|
@@ -152,28 +108,29 @@ class Hiera
|
|
152
108
|
end
|
153
109
|
|
154
110
|
data = GPGME::Data.from_str(plaintext)
|
155
|
-
crypto = GPGME::Crypto.new(:
|
111
|
+
crypto = GPGME::Crypto.new(always_trust: always_trust)
|
156
112
|
|
157
|
-
ciphertext = crypto.encrypt(data, :
|
113
|
+
ciphertext = crypto.encrypt(data, recipients: keys)
|
158
114
|
ciphertext.seek 0
|
159
115
|
ciphertext.read
|
160
116
|
end
|
161
117
|
|
162
|
-
def self.decrypt
|
118
|
+
def self.decrypt(ciphertext)
|
163
119
|
gnupghome = self.gnupghome
|
164
120
|
|
165
121
|
unless defined?(GPGME)
|
166
|
-
|
167
|
-
|
122
|
+
gpg = Hiera::Backend::Eyaml::GpgPuppetserver
|
123
|
+
gpg.config.homedir = gnupghome if gnupghome
|
124
|
+
return gpg.decrypt_string(ciphertext)
|
168
125
|
end
|
169
126
|
|
170
127
|
GPGME::Engine.home_dir = gnupghome
|
171
128
|
|
172
129
|
ctx = if hiera?
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
130
|
+
GPGME::Ctx.new
|
131
|
+
else
|
132
|
+
GPGME::Ctx.new(passphrase_callback: method(:passfunc))
|
133
|
+
end
|
177
134
|
|
178
135
|
if !ctx.keys.empty?
|
179
136
|
raw = GPGME::Data.new(ciphertext)
|
@@ -182,10 +139,10 @@ class Hiera
|
|
182
139
|
begin
|
183
140
|
txt = ctx.decrypt(raw)
|
184
141
|
rescue GPGME::Error::DecryptFailed => e
|
185
|
-
warn(
|
142
|
+
warn('Fatal: Failed to decrypt ciphertext (check settings and that you are a recipient)')
|
186
143
|
raise e
|
187
|
-
rescue
|
188
|
-
warn(
|
144
|
+
rescue StandardError => e
|
145
|
+
warn('Warning: General exception decrypting GPG file')
|
189
146
|
raise e
|
190
147
|
end
|
191
148
|
|
@@ -198,11 +155,58 @@ class Hiera
|
|
198
155
|
end
|
199
156
|
|
200
157
|
def self.create_keys
|
201
|
-
STDERR.puts
|
158
|
+
STDERR.puts 'The GPG encryptor does not support creation of keys, use the GPG command lines tools instead'
|
202
159
|
end
|
203
160
|
|
204
|
-
|
161
|
+
class << self
|
162
|
+
private
|
163
|
+
|
164
|
+
def find_recipients
|
165
|
+
recipient_option = option :recipients
|
166
|
+
|
167
|
+
unless recipient_option.nil?
|
168
|
+
debug('Using --recipients option')
|
169
|
+
return recipient_option.split(',')
|
170
|
+
end
|
171
|
+
|
172
|
+
recipient_file_option = option :recipients_file
|
173
|
+
recipient_file = if recipient_file_option.nil?
|
174
|
+
debug('Searching for any hiera-eyaml-gpg.recipients files in path')
|
175
|
+
find_recipient_file
|
176
|
+
else
|
177
|
+
debug('Using --recipients-file option')
|
178
|
+
Pathname.new(recipient_file_option)
|
179
|
+
end
|
205
180
|
|
181
|
+
return [] if recipient_file.nil?
|
182
|
+
|
183
|
+
recipient_file.readlines.map do |line|
|
184
|
+
line.strip unless line.start_with?('#') || line.strip.empty?
|
185
|
+
end.compact
|
186
|
+
end
|
187
|
+
|
188
|
+
def find_recipient_file
|
189
|
+
# if we are editing a file, look for a hiera-eyaml-gpg.recipients file
|
190
|
+
filename = case Eyaml::Options[:source]
|
191
|
+
when :file
|
192
|
+
Eyaml::Options[:file]
|
193
|
+
when :eyaml
|
194
|
+
Eyaml::Options[:eyaml]
|
195
|
+
end
|
196
|
+
|
197
|
+
return if filename.nil?
|
198
|
+
|
199
|
+
root = Pathname.new(filename).realpath.dirname
|
200
|
+
selected_file = nil
|
201
|
+
root.descend do |path|
|
202
|
+
potential_file = path.join('hiera-eyaml-gpg.recipients')
|
203
|
+
selected_file = potential_file if potential_file.exist?
|
204
|
+
end
|
205
|
+
debug("Using file at #{selected_file}")
|
206
|
+
selected_file
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
206
210
|
end
|
207
211
|
end
|
208
212
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'puppet'
|
2
|
+
require 'puppet/util/execution'
|
3
|
+
require 'puppet/file_system/uniquefile'
|
4
|
+
|
5
|
+
class Hiera
|
6
|
+
module Backend
|
7
|
+
module Eyaml
|
8
|
+
module GpgPuppetserver
|
9
|
+
extend RubyGpg
|
10
|
+
|
11
|
+
def self.run_command(command, input = nil)
|
12
|
+
tmpfile = Puppet::FileSystem::Uniquefile.new('puppet-eyaml-hiera-gpg-input', modes: File::WRONLY | File::BINARY)
|
13
|
+
tmpfile.write(input)
|
14
|
+
tmpfile.close
|
15
|
+
|
16
|
+
real_command = "#{command} #{tmpfile.path}"
|
17
|
+
|
18
|
+
output = Puppet::Util::Execution.execute(real_command)
|
19
|
+
tmpfile.unlink
|
20
|
+
|
21
|
+
if output.exitstatus != 0
|
22
|
+
raise "GPG command (#{real_command}) failed with status #{output.exitstatus}: '#{output}'"
|
23
|
+
end
|
24
|
+
|
25
|
+
output
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hiera-eyaml-gpg
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Hildrew
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hiera-eyaml
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 1.3.8
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: puppet
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 5.5.8
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 5.5.8
|
27
41
|
description: GPG encryptor for use with hiera-eyaml
|
28
42
|
email:
|
29
43
|
executables: []
|
@@ -31,13 +45,18 @@ extensions: []
|
|
31
45
|
extra_rdoc_files: []
|
32
46
|
files:
|
33
47
|
- ".gitignore"
|
48
|
+
- ".rubocop.yml"
|
49
|
+
- ".travis.yml"
|
50
|
+
- CHANGELOG.md
|
34
51
|
- Gemfile
|
52
|
+
- HISTORY.md
|
35
53
|
- LICENSE
|
36
54
|
- README.md
|
37
55
|
- Rakefile
|
38
56
|
- hiera-eyaml-gpg.gemspec
|
39
57
|
- lib/hiera/backend/eyaml/encryptors/gpg.rb
|
40
58
|
- lib/hiera/backend/eyaml/encryptors/gpg/eyaml_init.rb
|
59
|
+
- lib/hiera/backend/eyaml/encryptors/gpg/puppet_gpg.rb
|
41
60
|
- lib/hiera/backend/eyaml/encryptors/gpg/version.rb
|
42
61
|
- tools/regem.sh
|
43
62
|
homepage: http://github.com/sihil/hiera-eyaml-gpg
|
@@ -55,12 +74,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
55
74
|
version: '0'
|
56
75
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
76
|
requirements:
|
58
|
-
- - "
|
77
|
+
- - ">="
|
59
78
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
79
|
+
version: '0'
|
61
80
|
requirements: []
|
62
81
|
rubyforge_project:
|
63
|
-
rubygems_version: 2.
|
82
|
+
rubygems_version: 2.6.14.4
|
64
83
|
signing_key:
|
65
84
|
specification_version: 4
|
66
85
|
summary: Encryption plugin for hiera-eyaml backend for Hiera
|