puppet 6.21.1-universal-darwin → 6.22.1-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 (77) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +24 -18
  4. data/ext/project_data.yaml +2 -2
  5. data/lib/puppet/application/ssl.rb +11 -0
  6. data/lib/puppet/defaults.rb +22 -2
  7. data/lib/puppet/environments.rb +16 -1
  8. data/lib/puppet/face/facts.rb +128 -30
  9. data/lib/puppet/file_system/memory_file.rb +8 -1
  10. data/lib/puppet/file_system/windows.rb +2 -0
  11. data/lib/puppet/functions/partition.rb +8 -0
  12. data/lib/puppet/indirector/facts/facter.rb +24 -3
  13. data/lib/puppet/network/formats.rb +67 -0
  14. data/lib/puppet/network/http/factory.rb +4 -0
  15. data/lib/puppet/provider/package/dnfmodule.rb +1 -1
  16. data/lib/puppet/provider/service/systemd.rb +1 -1
  17. data/lib/puppet/provider/user/useradd.rb +1 -1
  18. data/lib/puppet/settings/environment_conf.rb +1 -0
  19. data/lib/puppet/util/fact_dif.rb +36 -17
  20. data/lib/puppet/util/monkey_patches.rb +7 -0
  21. data/lib/puppet/util/windows/adsi.rb +46 -0
  22. data/lib/puppet/util/windows/api_types.rb +1 -1
  23. data/lib/puppet/util/windows/principal.rb +9 -2
  24. data/lib/puppet/util/windows/sid.rb +4 -2
  25. data/lib/puppet/version.rb +1 -1
  26. data/locales/puppet.pot +139 -87
  27. data/man/man5/puppet.conf.5 +11 -3
  28. data/man/man8/puppet-agent.8 +1 -1
  29. data/man/man8/puppet-apply.8 +1 -1
  30. data/man/man8/puppet-catalog.8 +1 -1
  31. data/man/man8/puppet-config.8 +1 -1
  32. data/man/man8/puppet-describe.8 +1 -1
  33. data/man/man8/puppet-device.8 +1 -1
  34. data/man/man8/puppet-doc.8 +1 -1
  35. data/man/man8/puppet-epp.8 +1 -1
  36. data/man/man8/puppet-facts.8 +60 -2
  37. data/man/man8/puppet-filebucket.8 +1 -1
  38. data/man/man8/puppet-generate.8 +1 -1
  39. data/man/man8/puppet-help.8 +1 -1
  40. data/man/man8/puppet-key.8 +1 -1
  41. data/man/man8/puppet-lookup.8 +1 -1
  42. data/man/man8/puppet-man.8 +1 -1
  43. data/man/man8/puppet-module.8 +1 -1
  44. data/man/man8/puppet-node.8 +1 -1
  45. data/man/man8/puppet-parser.8 +1 -1
  46. data/man/man8/puppet-plugin.8 +1 -1
  47. data/man/man8/puppet-report.8 +1 -1
  48. data/man/man8/puppet-resource.8 +1 -1
  49. data/man/man8/puppet-script.8 +1 -1
  50. data/man/man8/puppet-ssl.8 +5 -1
  51. data/man/man8/puppet-status.8 +1 -1
  52. data/man/man8/puppet.8 +2 -2
  53. data/spec/fixtures/unit/provider/service/systemd/list_unit_files_services_vendor_preset +9 -0
  54. data/spec/integration/application/plugin_spec.rb +1 -1
  55. data/spec/integration/http/client_spec.rb +12 -0
  56. data/spec/integration/indirector/direct_file_server_spec.rb +1 -3
  57. data/spec/integration/util/windows/adsi_spec.rb +18 -0
  58. data/spec/integration/util/windows/principal_spec.rb +21 -0
  59. data/spec/integration/util/windows/registry_spec.rb +6 -0
  60. data/spec/spec_helper.rb +11 -1
  61. data/spec/unit/application/facts_spec.rb +482 -3
  62. data/spec/unit/application/ssl_spec.rb +23 -0
  63. data/spec/unit/defaults_spec.rb +16 -0
  64. data/spec/unit/environments_spec.rb +164 -88
  65. data/spec/unit/face/facts_spec.rb +4 -0
  66. data/spec/unit/file_system_spec.rb +9 -0
  67. data/spec/unit/indirector/facts/facter_spec.rb +95 -0
  68. data/spec/unit/network/formats_spec.rb +41 -0
  69. data/spec/unit/network/http/factory_spec.rb +19 -0
  70. data/spec/unit/provider/package/dnfmodule_spec.rb +10 -1
  71. data/spec/unit/provider/service/systemd_spec.rb +11 -0
  72. data/spec/unit/provider/user/useradd_spec.rb +18 -3
  73. data/spec/unit/resource/catalog_spec.rb +1 -1
  74. data/spec/unit/util/windows/sid_spec.rb +6 -0
  75. metadata +4 -6
  76. data/spec/lib/matchers/include.rb +0 -27
  77. data/spec/lib/matchers/include_spec.rb +0 -32
@@ -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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-EPP" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FACTS" "8" "April 2021" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-facts\fR \- Retrieve and store facts\.
@@ -51,7 +51,7 @@ The terminus for an action is often determined by context, but occasionally need
51
51
  \fBSYNOPSIS\fR
52
52
  .
53
53
  .IP
54
- puppet facts diff [\-\-terminus _TERMINUS] [\-\-extra HASH]
54
+ puppet facts diff [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-structured] [\-\-exclude \fIregex\fR]
55
55
  .
56
56
  .IP
57
57
  \fBDESCRIPTION\fR
@@ -60,6 +60,12 @@ puppet facts diff [\-\-terminus _TERMINUS] [\-\-extra HASH]
60
60
  Compares output from facter 3 with Facter 4 and prints the differences
61
61
  .
62
62
  .IP
63
+ \fBOPTIONS\fR \fI\-\-exclude <regex\fR> \- Regex used to exclude specific facts from diff\.
64
+ .
65
+ .IP
66
+ \fI\-\-structured\fR \- Render the different facts as structured\.
67
+ .
68
+ .IP
63
69
  \fBRETURNS\fR
64
70
  .
65
71
  .IP
@@ -123,6 +129,49 @@ puppet facts save [\-\-terminus _TERMINUS] [\-\-extra HASH] \fIkey\fR
123
129
  API only: create or overwrite an object\. As the Faces framework does not currently accept data from STDIN, save actions cannot currently be invoked from the command line\.
124
130
  .
125
131
  .TP
132
+ \fBshow\fR \- Retrieve current node\'s facts\.
133
+ \fBSYNOPSIS\fR
134
+ .
135
+ .IP
136
+ puppet facts show [\-\-terminus _TERMINUS] [\-\-extra HASH] [\-\-config\-file \fIpath\fR] [\-\-custom\-dir \fIpath\fR] [\-\-external\-dir \fIpath\fR] [\-\-no\-block] [\-\-no\-cache] [\-\-show\-legacy] [\-\-value\-only] [\fIfacts\fR]
137
+ .
138
+ .IP
139
+ \fBDESCRIPTION\fR
140
+ .
141
+ .IP
142
+ Reads facts from the local system using \fBfacter\fR terminus\. A query can be provided to retrieve just a specific fact or a set of facts\.
143
+ .
144
+ .IP
145
+ \fBOPTIONS\fR \fI\-\-config\-file <path\fR> \- The location of the config file for Facter\.
146
+ .
147
+ .IP
148
+ \fI\-\-custom\-dir <path\fR> \- The path to a directory that contains custom facts\.
149
+ .
150
+ .IP
151
+ \fI\-\-external\-dir <path\fR> \- The path to a directory that contains external facts\.
152
+ .
153
+ .IP
154
+ \fI\-\-no\-block\fR \- Disable fact blocking mechanism\.
155
+ .
156
+ .IP
157
+ \fI\-\-no\-cache\fR \- Disable fact caching mechanism\.
158
+ .
159
+ .IP
160
+ \fI\-\-show\-legacy\fR \- Show legacy facts when querying all facts\.
161
+ .
162
+ .IP
163
+ \fI\-\-value\-only\fR \- Show only the value when the action is called with a single query
164
+ .
165
+ .IP
166
+ \fBRETURNS\fR
167
+ .
168
+ .IP
169
+ The output of facter with added puppet specific facts\.
170
+ .
171
+ .IP
172
+ \fBNOTES\fR
173
+ .
174
+ .TP
126
175
  \fBupload\fR \- Upload local facts to the puppet master\.
127
176
  \fBSYNOPSIS\fR
128
177
  .
@@ -175,6 +224,15 @@ Get facts from the local system:
175
224
  $ puppet facts find
176
225
  .
177
226
  .P
227
+ \fBshow\fR
228
+ .
229
+ .P
230
+ retrieve facts:
231
+ .
232
+ .P
233
+ $ puppet facts show os
234
+ .
235
+ .P
178
236
  \fBupload\fR
179
237
  .
180
238
  .P
@@ -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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-FILEBUCKET" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-GENERATE" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-HELP" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-KEY" "8" "April 2021" "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 "PUPPET\-LOOKUP" "8" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-LOOKUP" "8" "April 2021" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-lookup\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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MAN" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-MODULE" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-NODE" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PARSER" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-PLUGIN" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-REPORT" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-RESOURCE" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SCRIPT" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-SSL" "8" "April 2021" "Puppet, Inc." "Puppet manual"
5
5
  .
6
6
  .SH "NAME"
7
7
  \fBpuppet\-ssl\fR \- Manage SSL keys and certificates for puppet SSL clients
@@ -52,4 +52,8 @@ Verify the private key and certificate are present and match, verify the certifi
52
52
  .TP
53
53
  clean
54
54
  Remove the private key and certificate related files for this host\. If \fB\-\-localca\fR is specified, then also remove this host\'s local copy of the CA certificate(s) and CRL bundle\. if \fB\-\-target CERTNAME\fR is specified, then remove the files for the specified device on this host instead of this host\.
55
+ .
56
+ .TP
57
+ show
58
+ Print the full\-text version of this host\'s certificate\.
55
59
 
@@ -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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET\-STATUS" "8" "April 2021" "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" "February 2021" "Puppet, Inc." "Puppet manual"
4
+ .TH "PUPPET" "8" "April 2021" "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\. plugin Interact with the Puppet plugin system\. 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\.21\.0
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\.22\.0
@@ -0,0 +1,9 @@
1
+ UNIT FILE STATE VENDOR PRESET
2
+ arp-ethers.service disabled disabled
3
+ auditd.service enabled enabled
4
+ dbus.service enabled disabled
5
+ udev.service enabled-runtime disabled
6
+ umountfs.service linked-runtime disabled
7
+ umountnfs.service masked disabled
8
+ umountroot.service masked-runtime disabled
9
+ urandom.service indirect enabled
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'puppet/face'
3
3
  require 'puppet_spec/puppetserver'
4
4
 
5
- describe "puppet plugin" do
5
+ describe "puppet plugin", unless: Puppet::Util::Platform.jruby? do
6
6
  include_context "https client"
7
7
 
8
8
  let(:server) { PuppetSpec::Puppetserver.new }
@@ -151,4 +151,16 @@ describe Puppet::HTTP::Client, unless: Puppet::Util::Platform.jruby? do
151
151
  end
152
152
  end
153
153
  end
154
+
155
+ context 'ciphersuites' do
156
+ it "does not connect when using an SSLv3 ciphersuite", :if => Puppet::Util::Package.versioncmp(OpenSSL::OPENSSL_LIBRARY_VERSION.split[1], '1.1.1e') > 0 do
157
+ Puppet[:ciphers] = "DES-CBC3-SHA"
158
+
159
+ https_server.start_server do |port|
160
+ expect {
161
+ client.get(URI("https://127.0.0.1:#{port}"), options: {ssl_context: root_context})
162
+ }.to raise_error(Puppet::HTTP::ConnectionError, /no cipher match|sslv3 alert handshake failure/)
163
+ end
164
+ end
165
+ end
154
166
  end
@@ -1,5 +1,4 @@
1
1
  require 'spec_helper'
2
- require 'matchers/include'
3
2
 
4
3
  require 'puppet/indirector/file_content/file'
5
4
  require 'puppet/indirector/file_metadata/file'
@@ -30,7 +29,6 @@ end
30
29
 
31
30
  describe Puppet::Indirector::DirectFileServer, " when interacting with FileServing::Fileset and the model" do
32
31
  include PuppetSpec::Files
33
- include Matchers::Include
34
32
 
35
33
  matcher :file_with_content do |name, content|
36
34
  match do |actual|
@@ -52,7 +50,7 @@ describe Puppet::Indirector::DirectFileServer, " when interacting with FileServi
52
50
  terminus = Puppet::Indirector::FileContent::File.new
53
51
  request = terminus.indirection.request(:search, Puppet::Util.path_to_uri(path).to_s, nil, :recurse => true)
54
52
 
55
- expect(terminus.search(request)).to include_in_any_order(
53
+ expect(terminus.search(request)).to contain_exactly(
56
54
  file_with_content(File.join(path, "one"), "one content"),
57
55
  file_with_content(File.join(path, "two"), "two content"),
58
56
  directory_named(path))
@@ -55,6 +55,24 @@ describe Puppet::Util::Windows::ADSI::User,
55
55
  end
56
56
  end
57
57
  end
58
+
59
+ describe '.current_user_name_with_format' do
60
+ context 'when desired format is NameSamCompatible' do
61
+ it 'should get the same user name as the current_user_name method but fully qualified' do
62
+ user_name = Puppet::Util::Windows::ADSI::User.current_user_name
63
+ fully_qualified_user_name = Puppet::Util::Windows::ADSI::User.current_sam_compatible_user_name
64
+
65
+ expect(fully_qualified_user_name).to match(/^.+\\#{user_name}$/)
66
+ end
67
+
68
+ it 'should have the same SID as with the current_user_name method' do
69
+ user_name = Puppet::Util::Windows::ADSI::User.current_user_name
70
+ fully_qualified_user_name = Puppet::Util::Windows::ADSI::User.current_sam_compatible_user_name
71
+
72
+ expect(Puppet::Util::Windows::SID.name_to_sid(user_name)).to eq(Puppet::Util::Windows::SID.name_to_sid(fully_qualified_user_name))
73
+ end
74
+ end
75
+ end
58
76
  end
59
77
 
60
78
  describe Puppet::Util::Windows::ADSI::Group,
@@ -7,6 +7,7 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet::Util::Platform.wi
7
7
  let (:system_bytes) { [1, 1, 0, 0, 0, 0, 0, 5, 18, 0, 0, 0] }
8
8
  let (:null_sid_bytes) { [1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] }
9
9
  let (:administrator_bytes) { [1, 2, 0, 0, 0, 0, 0, 5, 32, 0, 0, 0, 32, 2, 0, 0] }
10
+ let (:all_application_packages_bytes) { [1, 2, 0, 0, 0, 0, 0, 15, 2, 0, 0, 0, 1, 0, 0, 0] }
10
11
  let (:computer_sid) { Puppet::Util::Windows::SID.name_to_principal(Puppet::Util::Windows::ADSI.computer_name) }
11
12
  # BUILTIN is localized on German Windows, but not French
12
13
  # looking this up like this dilutes the values of the tests as we're comparing two mechanisms
@@ -121,6 +122,26 @@ describe Puppet::Util::Windows::SID::Principal, :if => Puppet::Util::Platform.wi
121
122
  expect(principal.to_s).to eq(builtin_localized)
122
123
  end
123
124
 
125
+ it "should always sanitize the account name first" do
126
+ expect(Puppet::Util::Windows::SID::Principal).to receive(:sanitize_account_name).with('NT AUTHORITY\\SYSTEM').and_call_original
127
+ Puppet::Util::Windows::SID::Principal.lookup_account_name('NT AUTHORITY\\SYSTEM')
128
+ end
129
+
130
+ it "should be able to create an instance from an account name prefixed by APPLICATION PACKAGE AUTHORITY" do
131
+ principal = Puppet::Util::Windows::SID::Principal.lookup_account_name('APPLICATION PACKAGE AUTHORITY\\ALL APPLICATION PACKAGES')
132
+ expect(principal.account).to eq('ALL APPLICATION PACKAGES')
133
+ expect(principal.sid_bytes).to eq(all_application_packages_bytes)
134
+ expect(principal.sid).to eq('S-1-15-2-1')
135
+ expect(principal.domain).to eq('APPLICATION PACKAGE AUTHORITY')
136
+ expect(principal.domain_account).to eq('APPLICATION PACKAGE AUTHORITY\\ALL APPLICATION PACKAGES')
137
+ expect(principal.account_type).to eq(:SidTypeWellKnownGroup)
138
+ expect(principal.to_s).to eq('APPLICATION PACKAGE AUTHORITY\\ALL APPLICATION PACKAGES')
139
+ end
140
+
141
+ it "should fail without proper account name sanitization when it is prefixed by APPLICATION PACKAGE AUTHORITY" do
142
+ given_account_name = 'APPLICATION PACKAGE AUTHORITY\\ALL APPLICATION PACKAGES'
143
+ expect { Puppet::Util::Windows::SID::Principal.lookup_account_name(nil, false, given_account_name) }.to raise_error(Puppet::Util::Windows::Error, /No mapping between account names and security IDs was done./)
144
+ end
124
145
  end
125
146
 
126
147
  describe ".lookup_account_sid" do
@@ -263,6 +263,12 @@ describe Puppet::Util::Windows::Registry do
263
263
  type: Win32::Registry::REG_EXPAND_SZ,
264
264
  value: "\0\0\0reg expand string",
265
265
  expected_value: ""
266
+ },
267
+ {
268
+ name: 'REG_EXPAND_SZ_2',
269
+ type: Win32::Registry::REG_EXPAND_SZ,
270
+ value: "1\x002\x003\x004\x00\x00\x00\x90\xD8UoY".force_encoding("UTF-16LE"),
271
+ expected_value: "1234"
266
272
  }
267
273
  ].each do |pair|
268
274
  it 'reads up to the first wide null' do
data/spec/spec_helper.rb CHANGED
@@ -160,10 +160,20 @@ RSpec.configure do |config|
160
160
  PUPPET_FACTER_2_GCE_URL = %r{^http://metadata/computeMetadata/v1(beta1)?}.freeze
161
161
  PUPPET_FACTER_3_GCE_URL = "http://metadata.google.internal/computeMetadata/v1/?recursive=true&alt=json".freeze
162
162
 
163
+ # Facter azure metadata endpoint
164
+ PUPPET_FACTER_AZ_URL = "http://169.254.169.254/metadata/instance?api-version=2020-09-01"
165
+
166
+ # Facter EC2 endpoint
167
+ PUPPET_FACTER_EC2_METADATA_URL = 'http://169.254.169.254/latest/meta-data/'
168
+ PUPPET_FACTER_EC2_USERDATA_URL = 'http://169.254.169.254/latest/user-data/'
169
+
163
170
  config.around :each do |example|
164
- # Ignore requests from Facter GCE fact in Travis
171
+ # Ignore requests from Facter to external services
165
172
  stub_request(:get, PUPPET_FACTER_2_GCE_URL)
166
173
  stub_request(:get, PUPPET_FACTER_3_GCE_URL)
174
+ stub_request(:get, PUPPET_FACTER_AZ_URL)
175
+ stub_request(:get, PUPPET_FACTER_EC2_METADATA_URL)
176
+ stub_request(:get, PUPPET_FACTER_EC2_USERDATA_URL)
167
177
 
168
178
  # Enable VCR if the example is tagged with `:vcr` metadata.
169
179
  if example.metadata[:vcr]