puppet 6.4.2-universal-darwin → 6.4.3-universal-darwin

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puppet might be problematic. Click here for more details.

Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +17 -17
  3. data/ext/solaris/smf/puppet.xml +2 -0
  4. data/lib/hiera/scope.rb +7 -0
  5. data/lib/puppet.rb +1 -1
  6. data/lib/puppet/application/agent.rb +16 -5
  7. data/lib/puppet/application/device.rb +12 -3
  8. data/lib/puppet/application/ssl.rb +2 -0
  9. data/lib/puppet/configurer.rb +1 -1
  10. data/lib/puppet/network/http/factory.rb +5 -0
  11. data/lib/puppet/pops/types/types.rb +5 -3
  12. data/lib/puppet/provider.rb +1 -2
  13. data/lib/puppet/provider/package.rb +2 -0
  14. data/lib/puppet/provider/package/dpkg.rb +15 -2
  15. data/lib/puppet/provider/package/gem.rb +65 -29
  16. data/lib/puppet/provider/package/pip.rb +135 -111
  17. data/lib/puppet/provider/package/pip3.rb +1 -1
  18. data/lib/puppet/provider/package/puppet_gem.rb +1 -1
  19. data/lib/puppet/provider/package/rpm.rb +27 -16
  20. data/lib/puppet/provider/package/yum.rb +1 -1
  21. data/lib/puppet/provider/package_targetable.rb +68 -0
  22. data/lib/puppet/provider/service/upstart.rb +5 -3
  23. data/lib/puppet/provider/user/useradd.rb +16 -13
  24. data/lib/puppet/settings/server_list_setting.rb +9 -0
  25. data/lib/puppet/ssl/host.rb +1 -1
  26. data/lib/puppet/ssl/state_machine.rb +99 -28
  27. data/lib/puppet/type/package.rb +46 -9
  28. data/lib/puppet/util/pidlock.rb +3 -2
  29. data/lib/puppet/util/windows/process.rb +8 -8
  30. data/lib/puppet/util/windows/registry.rb +7 -1
  31. data/lib/puppet/util/windows/user.rb +14 -4
  32. data/lib/puppet/version.rb +1 -1
  33. data/locales/puppet.pot +115 -103
  34. data/man/man5/puppet.conf.5 +2 -2
  35. data/man/man8/puppet-agent.8 +1 -1
  36. data/man/man8/puppet-apply.8 +1 -1
  37. data/man/man8/puppet-catalog.8 +1 -1
  38. data/man/man8/puppet-config.8 +1 -1
  39. data/man/man8/puppet-describe.8 +1 -1
  40. data/man/man8/puppet-device.8 +1 -1
  41. data/man/man8/puppet-doc.8 +1 -1
  42. data/man/man8/puppet-epp.8 +1 -1
  43. data/man/man8/puppet-facts.8 +1 -1
  44. data/man/man8/puppet-filebucket.8 +1 -1
  45. data/man/man8/puppet-generate.8 +1 -1
  46. data/man/man8/puppet-help.8 +1 -1
  47. data/man/man8/puppet-key.8 +1 -1
  48. data/man/man8/puppet-lookup.8 +1 -1
  49. data/man/man8/puppet-man.8 +1 -1
  50. data/man/man8/puppet-module.8 +1 -1
  51. data/man/man8/puppet-node.8 +1 -1
  52. data/man/man8/puppet-parser.8 +1 -1
  53. data/man/man8/puppet-plugin.8 +1 -1
  54. data/man/man8/puppet-report.8 +1 -1
  55. data/man/man8/puppet-resource.8 +1 -1
  56. data/man/man8/puppet-script.8 +1 -1
  57. data/man/man8/puppet-ssl.8 +1 -1
  58. data/man/man8/puppet-status.8 +1 -1
  59. data/man/man8/puppet.8 +2 -2
  60. data/spec/integration/type/package_spec.rb +1 -1
  61. data/spec/integration/util/windows/registry_spec.rb +52 -0
  62. data/spec/integration/util/windows/user_spec.rb +19 -0
  63. data/spec/unit/application/agent_spec.rb +53 -32
  64. data/spec/unit/application/ssl_spec.rb +13 -0
  65. data/spec/unit/configurer_spec.rb +1 -1
  66. data/spec/unit/functions/new_spec.rb +15 -0
  67. data/spec/unit/hiera/scope_spec.rb +7 -0
  68. data/spec/unit/network/http/factory_spec.rb +6 -0
  69. data/spec/unit/provider/package/dpkg_spec.rb +18 -1
  70. data/spec/unit/provider/package/gem_spec.rb +101 -48
  71. data/spec/unit/provider/package/pip3_spec.rb +17 -0
  72. data/spec/unit/provider/package/pip_spec.rb +57 -67
  73. data/spec/unit/provider/package/puppet_gem_spec.rb +22 -6
  74. data/spec/unit/provider/package/rpm_spec.rb +116 -27
  75. data/spec/unit/provider/service/upstart_spec.rb +3 -22
  76. data/spec/unit/settings/server_list_setting_spec.rb +21 -0
  77. data/spec/unit/ssl/state_machine_spec.rb +206 -83
  78. data/spec/unit/util/pidlock_spec.rb +26 -0
  79. metadata +5 -2
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPETCONF" "5" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPETCONF" "5" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  \fBThis page is autogenerated; any changes will get overwritten\fR
6
6
  .
7
7
  .SH "Configuration settings"
@@ -876,7 +876,7 @@ The time to wait for data to be read from an HTTP connection\. If nothing is rea
876
876
  The HTTP User\-Agent string to send when making network requests\.
877
877
  .
878
878
  .IP "\(bu" 4
879
- \fIDefault\fR: Puppet/6\.4\.2 Ruby/2\.4\.1\-p111 (x86_64\-linux)
879
+ \fIDefault\fR: Puppet/6\.4\.3 Ruby/2\.4\.1\-p111 (x86_64\-linux)
880
880
  .
881
881
  .IP "" 0
882
882
  .
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-AGENT" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-AGENT" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-agent\fR \- The puppet agent daemon
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-APPLY" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-APPLY" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-apply\fR \- Apply Puppet manifests locally
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-CATALOG" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CATALOG" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-catalog\fR \- Compile, save, view, and convert catalogs\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-CONFIG" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-CONFIG" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-config\fR \- Interact with Puppet\'s settings\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DESCRIBE" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DESCRIBE" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-describe\fR \- Display help about resource types
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DEVICE" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DEVICE" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-device\fR \- Manage remote network devices
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-DOC" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-DOC" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-doc\fR \- Generate Puppet references
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-EPP" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-epp\fR \- Interact directly with the EPP template parser/renderer\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FACTS" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-facts\fR \- Retrieve and store facts\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-FILEBUCKET" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-filebucket\fR \- Store and retrieve files in a filebucket
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-GENERATE" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-generate\fR \- Generates Puppet code from Ruby definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-HELP" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-help\fR \- Display Puppet help\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-KEY" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-KEY" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-key\fR \- Create, save, and remove certificate keys\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "LOOKUP" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "LOOKUP" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBlookup\fR \- Interactive Hiera lookup
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-MAN" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MAN" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-man\fR \- Display Puppet manual pages\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-MODULE" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-module\fR \- Creates, installs and searches for modules on the Puppet Forge\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-NODE" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-node\fR \- View and manage node definitions\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PARSER" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-parser\fR \- Interact directly with the parser\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-PLUGIN" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-plugin\fR \- Interact with the Puppet plugin system\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-REPORT" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-report\fR \- Create, display, and submit reports\.
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-RESOURCE" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-resource\fR \- The resource abstraction layer shell
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SCRIPT" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-script\fR \- Run a puppet manifests as a script without compiling a catalog
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-SSL" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET\-STATUS" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-STATUS" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-status\fR \- View puppet server status\.
data/man/man8/puppet.8 CHANGED
@@ -1,7 +1,7 @@
1
1
  .\" generated with Ronn/v0.7.3
2
2
  .\" http://github.com/rtomayko/ronn/tree/0.7.3
3
3
  .
4
- .TH "PUPPET" "8" "April 2019" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "July 2019" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\fR
@@ -25,4 +25,4 @@ Specialized:
25
25
  catalog Compile, save, view, and convert catalogs\. describe Display help about resource types device Manage remote network devices doc Generate Puppet references epp Interact directly with the EPP template parser/renderer\. facts Retrieve and store facts\. filebucket Store and retrieve files in a filebucket generate Generates Puppet code from Ruby definitions\. node View and manage node definitions\. parser Interact directly with the parser\. script Run a puppet manifests as a script without compiling a catalog ssl Manage SSL keys and certificates for puppet SSL clients
26
26
  .
27
27
  .P
28
- See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v6\.4\.2
28
+ See \'puppet help \fIsubcommand\fR \fIaction\fR\' for help on a specific subcommand action\. See \'puppet help \fIsubcommand\fR\' for help on a specific subcommand\. Puppet v6\.4\.3
@@ -100,7 +100,7 @@ describe Puppet::Type.type(:package), "when packages with the same name are sour
100
100
  provider_name = Puppet::Type.type(:package).defaultprovider.name
101
101
  expect {
102
102
  @catalog.add_resource(@alt_package)
103
- }.to raise_error ArgumentError, "Cannot alias Package[gem-yay] to [\"yay\", :#{provider_name}]; resource [\"Package\", \"yay\", :#{provider_name}] already declared"
103
+ }.to raise_error ArgumentError, "Cannot alias Package[gem-yay] to [nil, \"yay\", :#{provider_name}]; resource [\"Package\", nil, \"yay\", :#{provider_name}] already declared"
104
104
  end
105
105
  end
106
106
 
@@ -242,6 +242,58 @@ describe Puppet::Util::Windows::Registry do
242
242
  end
243
243
  end
244
244
  end
245
+
246
+ context 'whean reading null byte' do
247
+ let(:hklm) { Win32::Registry::HKEY_LOCAL_MACHINE }
248
+ let(:puppet_key) { 'SOFTWARE\\Puppet Labs' }
249
+ let(:subkey_name) { "PuppetRegistryTest#{SecureRandom.uuid}" }
250
+ let(:value_name) { SecureRandom.uuid }
251
+
252
+ after(:each) do
253
+ hklm.open(puppet_key, Win32::Registry::KEY_ALL_ACCESS) do |reg|
254
+ subject.delete_key(reg, subkey_name)
255
+ end
256
+ end
257
+
258
+ [
259
+ {
260
+ name: 'REG_SZ',
261
+ type: Win32::Registry::REG_SZ,
262
+ value: "reg sz\u0000 string",
263
+ expected_value: "reg sz string"
264
+ },
265
+ {
266
+ name: 'REG_SZ_2',
267
+ type: Win32::Registry::REG_SZ,
268
+ value: "reg sz\x00 string",
269
+ expected_value: "reg sz string"
270
+ },
271
+ {
272
+ name: 'REG_EXPAND_SZ',
273
+ type: Win32::Registry::REG_EXPAND_SZ,
274
+ value: "\0reg expand string",
275
+ expected_value: " reg expand string"
276
+ }
277
+ ].each do |pair|
278
+ it 'replaces null bytes with spaces' do
279
+ hklm.create("#{puppet_key}\\#{subkey_name}", Win32::Registry::KEY_ALL_ACCESS) do |reg|
280
+ reg.write(value_name, pair[:type], pair[:value])
281
+ end
282
+
283
+ hklm.open("#{puppet_key}\\#{subkey_name}", Win32::Registry::KEY_READ) do |reg|
284
+ vals = subject.values(reg)
285
+
286
+ expect(vals).to have_key(value_name)
287
+ subject.each_value(reg) do |_subkey, type, _data|
288
+ expect(type).to eq(pair[:type])
289
+ end
290
+
291
+ written = vals[value_name]
292
+ expect(written).to eq(pair[:expected_value])
293
+ end
294
+ end
295
+ end
296
+ end
245
297
  end
246
298
 
247
299
  context "#values_by_name" do
@@ -106,6 +106,12 @@ describe "Puppet::Util::Windows::User", :if => Puppet::Util::Platform.windows? d
106
106
  end
107
107
 
108
108
  describe "logon_user" do
109
+ let(:fLOGON32_PROVIDER_DEFAULT) {0}
110
+ let(:fLOGON32_LOGON_INTERACTIVE) {2}
111
+ let(:fLOGON32_LOGON_NETWORK) {3}
112
+ let(:token) {'test'}
113
+ let(:user) {'test'}
114
+ let(:passwd) {'test'}
109
115
  it "should raise an error when provided with an incorrect username and password" do
110
116
  expect_logon_failure_error {
111
117
  Puppet::Util::Windows::User.logon_user(username, bad_password)
@@ -117,8 +123,21 @@ describe "Puppet::Util::Windows::User", :if => Puppet::Util::Platform.windows? d
117
123
  Puppet::Util::Windows::User.logon_user(username, nil)
118
124
  }
119
125
  end
126
+
127
+ it 'should raise error given that logon returns false' do
128
+
129
+ allow(Puppet::Util::Windows::User).to receive(:logon_user_by_logon_type).with(
130
+ user, passwd, fLOGON32_LOGON_NETWORK, fLOGON32_PROVIDER_DEFAULT, anything).and_return (0)
131
+ allow(Puppet::Util::Windows::User).to receive(:logon_user_by_logon_type).with(
132
+ user, passwd, fLOGON32_LOGON_INTERACTIVE, fLOGON32_PROVIDER_DEFAULT, anything).and_return(0)
133
+
134
+ expect {Puppet::Util::Windows::User.logon_user(user, passwd) {}}
135
+ .to raise_error(Puppet::Util::Windows::Error, /Failed to logon user/)
136
+
137
+ end
120
138
  end
121
139
 
140
+
122
141
  describe "password_is?" do
123
142
  it "should return false given an incorrect username and password" do
124
143
  expect(Puppet::Util::Windows::User.password_is?(username, bad_password)).to be_falsey
@@ -7,6 +7,8 @@ require 'puppet/daemon'
7
7
  describe Puppet::Application::Agent do
8
8
  include PuppetSpec::Files
9
9
 
10
+ let(:machine) { double(ensure_client_certificate: nil) }
11
+
10
12
  before :each do
11
13
  @puppetd = Puppet::Application[:agent]
12
14
 
@@ -27,8 +29,6 @@ describe Puppet::Application::Agent do
27
29
  allow(Puppet::Node.indirection).to receive(:cache_class=)
28
30
  allow(Puppet::Node::Facts.indirection).to receive(:terminus_class=)
29
31
 
30
- expect($stderr).not_to receive(:puts)
31
-
32
32
  allow(Puppet.settings).to receive(:use)
33
33
  end
34
34
 
@@ -125,7 +125,7 @@ describe Puppet::Application::Agent do
125
125
  allow(@agent).to receive(:run).and_return(2)
126
126
  Puppet[:onetime] = true
127
127
 
128
- expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 0).and_return(double(ensure_client_certificate: nil))
128
+ expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 0).and_return(machine)
129
129
 
130
130
  expect { execute_agent }.to exit_with 0
131
131
  end
@@ -135,13 +135,20 @@ describe Puppet::Application::Agent do
135
135
  Puppet[:onetime] = true
136
136
  @puppetd.handle_waitforcert(60)
137
137
 
138
- expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 60).and_return(double(ensure_client_certificate: nil))
138
+ expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 60).and_return(machine)
139
139
 
140
140
  expect { execute_agent }.to exit_with 0
141
141
  end
142
142
 
143
143
  it "should use a default value for waitforcert when --onetime and --waitforcert are not specified" do
144
+ expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 120).and_return(machine)
145
+
146
+ execute_agent
147
+ end
148
+
149
+ it "should register ssl OIDs" do
144
150
  expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 120).and_return(double(ensure_client_certificate: nil))
151
+ expect(Puppet::SSL::Oids).to receive(:register_puppet_oids)
145
152
 
146
153
  execute_agent
147
154
  end
@@ -149,7 +156,7 @@ describe Puppet::Application::Agent do
149
156
  it "should use the waitforcert setting when checking for a signed certificate" do
150
157
  Puppet[:waitforcert] = 10
151
158
 
152
- expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 10).and_return(double(ensure_client_certificate: nil))
159
+ expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 10).and_return(machine)
153
160
 
154
161
  execute_agent
155
162
  end
@@ -386,7 +393,7 @@ describe Puppet::Application::Agent do
386
393
  it "should inform the daemon about our agent if :client is set to 'true'" do
387
394
  @puppetd.options[:client] = true
388
395
 
389
- allow(Puppet::SSL::StateMachine).to receive(:new).and_return(double(ensure_client_certificate: nil))
396
+ allow(Puppet::SSL::StateMachine).to receive(:new).and_return(machine)
390
397
 
391
398
  execute_agent
392
399
 
@@ -398,7 +405,7 @@ describe Puppet::Application::Agent do
398
405
  Puppet[:daemonize] = true
399
406
  allow(Signal).to receive(:trap)
400
407
 
401
- allow(Puppet::SSL::StateMachine).to receive(:new).and_return(double(ensure_client_certificate: nil))
408
+ allow(Puppet::SSL::StateMachine).to receive(:new).and_return(machine)
402
409
 
403
410
  expect(@daemon).to receive(:daemonize)
404
411
 
@@ -408,22 +415,7 @@ describe Puppet::Application::Agent do
408
415
  it "should wait for a certificate" do
409
416
  @puppetd.options[:waitforcert] = 123
410
417
 
411
- expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 123).and_return(double(ensure_client_certificate: nil))
412
-
413
- execute_agent
414
- end
415
-
416
- it "should not wait for a certificate in fingerprint mode" do
417
- @puppetd.options[:fingerprint] = true
418
- @puppetd.options[:waitforcert] = 123
419
- @puppetd.options[:digest] = 'MD5'
420
-
421
- certificate = double('certificate')
422
- allow(certificate).to receive(:to_der).and_return('ABCDE')
423
- ssl_context = double('ssl_context', client_cert: certificate)
424
- allow(Puppet::SSL::StateMachine).to receive(:new).with(onetime: true).and_return(double(ensure_client_certificate: ssl_context))
425
-
426
- expect(@puppetd).to receive(:puts).with('(MD5) 2E:CD:DE:39:59:05:1D:91:3F:61:B1:45:79:EA:13:6D')
418
+ expect(Puppet::SSL::StateMachine).to receive(:new).with(waitforcert: 123).and_return(machine)
427
419
 
428
420
  execute_agent
429
421
  end
@@ -478,7 +470,7 @@ describe Puppet::Application::Agent do
478
470
 
479
471
  it "should dispatch to onetime if --onetime is used" do
480
472
  Puppet[:onetime] = true
481
- allow(Puppet::SSL::StateMachine).to receive(:new).and_return(double(ensure_client_certificate: nil))
473
+ allow(Puppet::SSL::StateMachine).to receive(:new).and_return(machine)
482
474
 
483
475
  expect(@puppetd).to receive(:onetime)
484
476
 
@@ -487,7 +479,7 @@ describe Puppet::Application::Agent do
487
479
 
488
480
  it "should dispatch to main if --onetime and --fingerprint are not used" do
489
481
  Puppet[:onetime] = false
490
- allow(Puppet::SSL::StateMachine).to receive(:new).and_return(double(ensure_client_certificate: nil))
482
+ allow(Puppet::SSL::StateMachine).to receive(:new).and_return(machine)
491
483
 
492
484
  expect(@puppetd).to receive(:main)
493
485
 
@@ -501,7 +493,7 @@ describe Puppet::Application::Agent do
501
493
  @puppetd.options[:client] = :client
502
494
  @puppetd.options[:detailed_exitcodes] = false
503
495
 
504
- allow(Puppet::SSL::StateMachine).to receive(:new).and_return(double(ensure_client_certificate: nil))
496
+ allow(Puppet::SSL::StateMachine).to receive(:new).and_return(machine)
505
497
  end
506
498
 
507
499
  it "should setup traps" do
@@ -552,26 +544,55 @@ describe Puppet::Application::Agent do
552
544
 
553
545
  describe "with --fingerprint" do
554
546
  before :each do
555
- @cert = double('cert')
556
547
  @puppetd.options[:fingerprint] = true
557
548
  @puppetd.options[:digest] = :MD5
558
549
  end
559
550
 
560
551
  it "should fingerprint the certificate if it exists" do
561
- allow(@cert).to receive(:to_der).and_return('ABCDE')
562
- ssl_context = double('ssl_context', client_cert: @cert)
563
- allow(Puppet::SSL::StateMachine).to receive(:new).with(onetime: true).and_return(double(ensure_client_certificate: ssl_context))
552
+ cert = cert_fixture('signed.pem')
553
+ allow_any_instance_of(Puppet::X509::CertProvider).to receive(:load_client_cert).and_return(cert)
564
554
 
565
- expect(@puppetd).to receive(:puts).with('(MD5) 2E:CD:DE:39:59:05:1D:91:3F:61:B1:45:79:EA:13:6D')
555
+ expect(@puppetd).to receive(:puts).with('(MD5) A6:00:3E:C1:DF:CF:E8:44:A6:4F:8D:92:E8:B2:D9:47')
566
556
 
567
557
  @puppetd.fingerprint
568
558
  end
559
+
560
+ it "should fingerprint the request if it exists" do
561
+ request = request_fixture('request.pem')
562
+ allow_any_instance_of(Puppet::X509::CertProvider).to receive(:load_client_cert).and_return(nil)
563
+ allow_any_instance_of(Puppet::X509::CertProvider).to receive(:load_request).and_return(request)
564
+
565
+ expect(@puppetd).to receive(:puts).with('(MD5) 04:D0:69:23:32:2F:48:77:FE:2F:F2:0C:4E:90:BE:AC')
566
+
567
+ @puppetd.fingerprint
568
+ end
569
+
570
+ it "should print an error to stderr if neither exist" do
571
+ allow_any_instance_of(Puppet::X509::CertProvider).to receive(:load_client_cert).and_return(nil)
572
+ allow_any_instance_of(Puppet::X509::CertProvider).to receive(:load_request).and_return(nil)
573
+
574
+ expect {
575
+ expect {
576
+ @puppetd.fingerprint
577
+ }.to exit_with(1)
578
+ }.to output(/Fingerprint asked but neither the certificate, nor the certificate request have been issued/).to_stderr
579
+ end
580
+
581
+ it "should log an error if an exception occurs" do
582
+ allow_any_instance_of(Puppet::X509::CertProvider).to receive(:load_client_cert).and_raise(Puppet::Error, "Invalid PEM")
583
+
584
+ expect {
585
+ @puppetd.fingerprint
586
+ }.to exit_with(1)
587
+
588
+ expect(@logs).to include(an_object_having_attributes(message: /Failed to generate fingerprint: Invalid PEM/))
589
+ end
569
590
  end
570
591
 
571
592
  describe "without --onetime and --fingerprint" do
572
593
  before :each do
573
594
  allow(Puppet).to receive(:notice)
574
- allow(Puppet::SSL::StateMachine).to receive(:new).and_return(double(ensure_client_certificate: nil))
595
+ allow(Puppet::SSL::StateMachine).to receive(:new).and_return(machine)
575
596
  end
576
597
 
577
598
  it "should start our daemon" do