bolt 0.23.0 → 0.24.0

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

Potentially problematic release.


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

Files changed (192) hide show
  1. checksums.yaml +4 -4
  2. data/bolt-modules/boltlib/lib/puppet/functions/apply_prep.rb +5 -2
  3. data/bolt-modules/boltlib/lib/puppet/functions/puppetdb_query.rb +5 -1
  4. data/bolt-modules/boltlib/lib/puppet/functions/run_task.rb +5 -8
  5. data/lib/bolt/applicator.rb +11 -8
  6. data/lib/bolt/boltdir.rb +13 -5
  7. data/lib/bolt/catalog.rb +22 -47
  8. data/lib/bolt/config.rb +1 -26
  9. data/lib/bolt/executor.rb +1 -1
  10. data/lib/bolt/outputter.rb +0 -9
  11. data/lib/bolt/outputter/human.rb +29 -14
  12. data/lib/bolt/outputter/json.rb +12 -1
  13. data/lib/bolt/pal.rb +12 -10
  14. data/lib/bolt/target.rb +0 -6
  15. data/lib/bolt/task.rb +53 -10
  16. data/lib/bolt/transport/base.rb +1 -6
  17. data/lib/bolt/transport/local.rb +11 -13
  18. data/lib/bolt/transport/local/shell.rb +2 -2
  19. data/lib/bolt/transport/ssh.rb +16 -11
  20. data/lib/bolt/transport/winrm.rb +8 -11
  21. data/lib/bolt/version.rb +1 -1
  22. data/lib/bolt_ext/schemas/task.json +12 -5
  23. data/libexec/apply_catalog.rb +3 -1
  24. data/libexec/bolt_catalog +4 -0
  25. data/vendored/puppet/lib/puppet.rb +2 -1
  26. data/vendored/puppet/lib/puppet/application/agent.rb +2 -6
  27. data/vendored/puppet/lib/puppet/application/apply.rb +100 -60
  28. data/vendored/puppet/lib/puppet/application/cert.rb +26 -291
  29. data/vendored/puppet/lib/puppet/application/device.rb +0 -5
  30. data/vendored/puppet/lib/puppet/application/lookup.rb +1 -1
  31. data/vendored/puppet/lib/puppet/application/ssl.rb +133 -0
  32. data/vendored/puppet/lib/puppet/application_support.rb +1 -2
  33. data/vendored/puppet/lib/puppet/configurer.rb +34 -50
  34. data/vendored/puppet/lib/puppet/configurer/downloader.rb +1 -1
  35. data/vendored/puppet/lib/puppet/configurer/plugin_handler.rb +1 -1
  36. data/vendored/puppet/lib/puppet/daemon.rb +1 -1
  37. data/vendored/puppet/lib/puppet/defaults.rb +40 -117
  38. data/vendored/puppet/lib/puppet/face/epp.rb +2 -2
  39. data/vendored/puppet/lib/puppet/face/help.rb +21 -7
  40. data/vendored/puppet/lib/puppet/face/node/clean.rb +14 -10
  41. data/vendored/puppet/lib/puppet/feature/base.rb +7 -23
  42. data/vendored/puppet/lib/puppet/feature/eventlog.rb +1 -1
  43. data/vendored/puppet/lib/puppet/file_serving/base.rb +2 -2
  44. data/vendored/puppet/lib/puppet/file_serving/fileset.rb +1 -1
  45. data/vendored/puppet/lib/puppet/file_serving/metadata.rb +2 -2
  46. data/vendored/puppet/lib/puppet/functions.rb +133 -0
  47. data/vendored/puppet/lib/puppet/functions/eyaml_lookup_key.rb +4 -5
  48. data/vendored/puppet/lib/puppet/functions/filter.rb +7 -6
  49. data/vendored/puppet/lib/puppet/functions/new.rb +37 -53
  50. data/vendored/puppet/lib/puppet/functions/warning.rb +1 -1
  51. data/vendored/puppet/lib/puppet/functions/yaml_data.rb +4 -5
  52. data/vendored/puppet/lib/puppet/gettext/config.rb +1 -1
  53. data/vendored/puppet/lib/puppet/graph.rb +0 -2
  54. data/vendored/puppet/lib/puppet/indirector/catalog/json.rb +14 -3
  55. data/vendored/puppet/lib/puppet/indirector/catalog/yaml.rb +0 -16
  56. data/vendored/puppet/lib/puppet/indirector/certificate/file.rb +0 -1
  57. data/vendored/puppet/lib/puppet/indirector/facts/yaml.rb +4 -2
  58. data/vendored/puppet/lib/puppet/indirector/key/file.rb +1 -6
  59. data/vendored/puppet/lib/puppet/indirector/node/exec.rb +1 -3
  60. data/vendored/puppet/lib/puppet/indirector/node/yaml.rb +0 -6
  61. data/vendored/puppet/lib/puppet/indirector/request.rb +1 -1
  62. data/vendored/puppet/lib/puppet/indirector/ssl_file.rb +3 -44
  63. data/vendored/puppet/lib/puppet/indirector/yaml.rb +4 -4
  64. data/vendored/puppet/lib/puppet/info_service/task_information_service.rb +7 -3
  65. data/vendored/puppet/lib/puppet/loaders.rb +1 -0
  66. data/vendored/puppet/lib/puppet/module/task.rb +198 -29
  67. data/vendored/puppet/lib/puppet/module_tool/applications/unpacker.rb +1 -1
  68. data/vendored/puppet/lib/puppet/network/format_support.rb +13 -8
  69. data/vendored/puppet/lib/puppet/network/formats.rb +93 -2
  70. data/vendored/puppet/lib/puppet/network/http/api/indirected_routes.rb +10 -3
  71. data/vendored/puppet/lib/puppet/node/facts.rb +11 -1
  72. data/vendored/puppet/lib/puppet/parser/catalog_compiler.rb +56 -0
  73. data/vendored/puppet/lib/puppet/parser/compiler.rb +3 -1
  74. data/vendored/puppet/lib/puppet/parser/functions.rb +3 -1
  75. data/vendored/puppet/lib/puppet/parser/functions/filter.rb +1 -1
  76. data/vendored/puppet/lib/puppet/parser/functions/generate.rb +1 -1
  77. data/vendored/puppet/lib/puppet/parser/functions/sprintf.rb +12 -1
  78. data/vendored/puppet/lib/puppet/parser/functions/tagged.rb +1 -4
  79. data/vendored/puppet/lib/puppet/parser/scope.rb +1 -1
  80. data/vendored/puppet/lib/puppet/parser/script_compiler.rb +7 -2
  81. data/vendored/puppet/lib/puppet/pops/evaluator/deferred_resolver.rb +5 -3
  82. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_converter.rb +23 -4
  83. data/vendored/puppet/lib/puppet/pops/evaluator/runtime3_support.rb +3 -4
  84. data/vendored/puppet/lib/puppet/pops/functions/dispatch.rb +4 -0
  85. data/vendored/puppet/lib/puppet/pops/issues.rb +8 -0
  86. data/vendored/puppet/lib/puppet/pops/loader/loader.rb +2 -2
  87. data/vendored/puppet/lib/puppet/pops/loader/loader_paths.rb +3 -1
  88. data/vendored/puppet/lib/puppet/pops/loader/module_loaders.rb +30 -9
  89. data/vendored/puppet/lib/puppet/pops/loader/ruby_legacy_function_instantiator.rb +62 -0
  90. data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -1
  91. data/vendored/puppet/lib/puppet/pops/loader/task_instantiator.rb +13 -70
  92. data/vendored/puppet/lib/puppet/pops/loaders.rb +19 -29
  93. data/vendored/puppet/lib/puppet/pops/lookup/hiera_config.rb +1 -1
  94. data/vendored/puppet/lib/puppet/pops/model/model_label_provider.rb +4 -1
  95. data/vendored/puppet/lib/puppet/pops/pcore.rb +10 -33
  96. data/vendored/puppet/lib/puppet/pops/serialization.rb +2 -0
  97. data/vendored/puppet/lib/puppet/pops/serialization/from_data_converter.rb +2 -1
  98. data/vendored/puppet/lib/puppet/pops/serialization/to_data_converter.rb +11 -3
  99. data/vendored/puppet/lib/puppet/pops/serialization/to_stringified_converter.rb +226 -0
  100. data/vendored/puppet/lib/puppet/pops/types/p_object_type.rb +3 -0
  101. data/vendored/puppet/lib/puppet/pops/validation/checker4_0.rb +97 -47
  102. data/vendored/puppet/lib/puppet/pops/validation/validator_factory_4_0.rb +7 -8
  103. data/vendored/puppet/lib/puppet/property/keyvalue.rb +70 -8
  104. data/vendored/puppet/lib/puppet/provider/aix_object.rb +483 -0
  105. data/vendored/puppet/lib/puppet/provider/file/windows.rb +1 -1
  106. data/vendored/puppet/lib/puppet/provider/group/aix.rb +51 -112
  107. data/vendored/puppet/lib/puppet/provider/package/gem.rb +1 -1
  108. data/vendored/puppet/lib/puppet/provider/package/pip.rb +1 -1
  109. data/vendored/puppet/lib/puppet/provider/package/puppet_gem.rb +1 -1
  110. data/vendored/puppet/lib/puppet/provider/package/rpm.rb +1 -1
  111. data/vendored/puppet/lib/puppet/provider/package/windows/package.rb +1 -1
  112. data/vendored/puppet/lib/puppet/provider/package/zypper.rb +1 -1
  113. data/vendored/puppet/lib/puppet/provider/service/systemd.rb +1 -1
  114. data/vendored/puppet/lib/puppet/provider/service/windows.rb +37 -40
  115. data/vendored/puppet/lib/puppet/provider/user/aix.rb +142 -254
  116. data/vendored/puppet/lib/puppet/resource.rb +20 -3
  117. data/vendored/puppet/lib/puppet/resource/catalog.rb +2 -12
  118. data/vendored/puppet/lib/puppet/rest/routes.rb +97 -34
  119. data/vendored/puppet/lib/puppet/settings.rb +1 -1
  120. data/vendored/puppet/lib/puppet/settings/file_setting.rb +1 -1
  121. data/vendored/puppet/lib/puppet/ssl/base.rb +1 -9
  122. data/vendored/puppet/lib/puppet/ssl/certificate_request.rb +1 -13
  123. data/vendored/puppet/lib/puppet/ssl/certificate_request_attributes.rb +1 -1
  124. data/vendored/puppet/lib/puppet/ssl/host.rb +114 -232
  125. data/vendored/puppet/lib/puppet/ssl/key.rb +1 -5
  126. data/vendored/puppet/lib/puppet/ssl/oids.rb +1 -1
  127. data/vendored/puppet/lib/puppet/test/test_helper.rb +0 -4
  128. data/vendored/puppet/lib/puppet/transaction/event.rb +3 -7
  129. data/vendored/puppet/lib/puppet/transaction/persistence.rb +1 -1
  130. data/vendored/puppet/lib/puppet/type/exec.rb +18 -16
  131. data/vendored/puppet/lib/puppet/type/file.rb +3 -3
  132. data/vendored/puppet/lib/puppet/type/file/source.rb +20 -7
  133. data/vendored/puppet/lib/puppet/type/group.rb +3 -5
  134. data/vendored/puppet/lib/puppet/type/notify.rb +1 -1
  135. data/vendored/puppet/lib/puppet/type/package.rb +2 -5
  136. data/vendored/puppet/lib/puppet/type/schedule.rb +1 -1
  137. data/vendored/puppet/lib/puppet/type/service.rb +3 -6
  138. data/vendored/puppet/lib/puppet/type/tidy.rb +1 -1
  139. data/vendored/puppet/lib/puppet/type/user.rb +13 -20
  140. data/vendored/puppet/lib/puppet/util.rb +8 -9
  141. data/vendored/puppet/lib/puppet/util/execution.rb +3 -3
  142. data/vendored/puppet/lib/puppet/util/feature.rb +61 -39
  143. data/vendored/puppet/lib/puppet/util/log/destinations.rb +1 -1
  144. data/vendored/puppet/lib/puppet/util/rdoc.rb +1 -1
  145. data/vendored/puppet/lib/puppet/util/run_mode.rb +1 -1
  146. data/vendored/puppet/lib/puppet/util/storage.rb +1 -1
  147. data/vendored/puppet/lib/puppet/util/suidmanager.rb +7 -5
  148. data/vendored/puppet/lib/puppet/util/tag_set.rb +1 -1
  149. data/vendored/puppet/lib/puppet/util/tagging.rb +1 -1
  150. data/vendored/puppet/lib/puppet/util/windows.rb +18 -2
  151. data/vendored/puppet/lib/puppet/util/windows/adsi.rb +154 -205
  152. data/vendored/puppet/lib/puppet/util/windows/service.rb +770 -0
  153. data/vendored/puppet/lib/puppet/util/yaml.rb +41 -5
  154. data/vendored/puppet/lib/puppet/version.rb +1 -1
  155. data/vendored/puppet/lib/puppet_pal.rb +280 -24
  156. metadata +8 -38
  157. data/lib/bolt/catalog/compiler.rb +0 -48
  158. data/lib/bolt/catalog/loaders.rb +0 -19
  159. data/vendored/puppet/lib/puppet/application/ca.rb +0 -11
  160. data/vendored/puppet/lib/puppet/application/certificate.rb +0 -17
  161. data/vendored/puppet/lib/puppet/application/certificate_request.rb +0 -7
  162. data/vendored/puppet/lib/puppet/application/certificate_revocation_list.rb +0 -7
  163. data/vendored/puppet/lib/puppet/face/ca.rb +0 -266
  164. data/vendored/puppet/lib/puppet/face/certificate.rb +0 -167
  165. data/vendored/puppet/lib/puppet/face/certificate_request.rb +0 -56
  166. data/vendored/puppet/lib/puppet/face/certificate_revocation_list.rb +0 -56
  167. data/vendored/puppet/lib/puppet/graph/random_prioritizer.rb +0 -16
  168. data/vendored/puppet/lib/puppet/graph/title_hash_prioritizer.rb +0 -16
  169. data/vendored/puppet/lib/puppet/indirector/certificate/ca.rb +0 -9
  170. data/vendored/puppet/lib/puppet/indirector/certificate/disabled_ca.rb +0 -22
  171. data/vendored/puppet/lib/puppet/indirector/certificate_request/ca.rb +0 -22
  172. data/vendored/puppet/lib/puppet/indirector/certificate_request/disabled_ca.rb +0 -22
  173. data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/ca.rb +0 -8
  174. data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/disabled_ca.rb +0 -22
  175. data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/file.rb +0 -8
  176. data/vendored/puppet/lib/puppet/indirector/certificate_revocation_list/rest.rb +0 -11
  177. data/vendored/puppet/lib/puppet/indirector/certificate_status.rb +0 -4
  178. data/vendored/puppet/lib/puppet/indirector/certificate_status/file.rb +0 -91
  179. data/vendored/puppet/lib/puppet/indirector/certificate_status/rest.rb +0 -11
  180. data/vendored/puppet/lib/puppet/indirector/key/ca.rb +0 -16
  181. data/vendored/puppet/lib/puppet/indirector/key/disabled_ca.rb +0 -22
  182. data/vendored/puppet/lib/puppet/indirector/ldap.rb +0 -86
  183. data/vendored/puppet/lib/puppet/indirector/node/ldap.rb +0 -275
  184. data/vendored/puppet/lib/puppet/provider/aixobject.rb +0 -392
  185. data/vendored/puppet/lib/puppet/provider/cron/crontab.rb +0 -297
  186. data/vendored/puppet/lib/puppet/ssl/certificate_authority.rb +0 -475
  187. data/vendored/puppet/lib/puppet/ssl/certificate_authority/autosign_command.rb +0 -45
  188. data/vendored/puppet/lib/puppet/ssl/certificate_authority/interface.rb +0 -324
  189. data/vendored/puppet/lib/puppet/ssl/certificate_factory.rb +0 -219
  190. data/vendored/puppet/lib/puppet/ssl/certificate_revocation_list.rb +0 -111
  191. data/vendored/puppet/lib/puppet/ssl/inventory.rb +0 -55
  192. data/vendored/puppet/lib/puppet/type/cron.rb +0 -480
@@ -1,56 +0,0 @@
1
- require 'puppet/indirector/face'
2
-
3
- Puppet::Indirector::Face.define(:certificate_request, '0.0.1') do
4
- copyright "Puppet Inc.", 2011
5
- license "Apache 2 license; see COPYING"
6
-
7
- summary _("Manage certificate requests.")
8
- description <<-EOT
9
- This subcommand retrieves and submits certificate signing requests (CSRs).
10
- EOT
11
-
12
- deactivate_action(:destroy)
13
-
14
- find = get_action(:find)
15
- find.summary "Retrieve a single CSR."
16
- find.arguments "[<host>]"
17
- find.render_as = :s
18
- find.returns <<-EOT
19
- A single certificate request. When used from the Ruby API, returns a
20
- Puppet::SSL::CertificateRequest object.
21
-
22
- Defaults to the current nodes certname.
23
- EOT
24
- find.examples <<-EOT
25
- Retrieve a single CSR from the puppet master's CA:
26
-
27
- $ puppet certificate_request find somenode.puppetlabs.lan --terminus rest
28
- EOT
29
-
30
- search = get_action(:search)
31
- search.summary "Retrieve all outstanding CSRs."
32
- search.arguments "<dummy_text>"
33
- search.render_as = :s
34
- search.returns <<-EOT
35
- A list of certificate requests. When used from the Ruby API, returns an
36
- array of Puppet::SSL::CertificateRequest objects.
37
- EOT
38
- search.short_description <<-EOT
39
- Retrieves all outstanding certificate signing requests. Due to a known bug,
40
- this action requires a dummy search key, the content of which is irrelevant.
41
- EOT
42
- search.notes <<-EOT
43
- Although this action always returns all CSRs, it requires a dummy search
44
- key; this is a known bug.
45
- EOT
46
- search.examples <<-EOT
47
- Retrieve all CSRs from the local CA (similar to 'puppet cert list'):
48
-
49
- $ puppet certificate_request search x --terminus ca
50
- EOT
51
-
52
- get_action(:save).summary "API only: submit a certificate signing request."
53
- get_action(:save).arguments "<x509_CSR>"
54
-
55
- deprecate
56
- end
@@ -1,56 +0,0 @@
1
- require 'puppet/indirector/face'
2
-
3
- Puppet::Indirector::Face.define(:certificate_revocation_list, '0.0.1') do
4
- copyright "Puppet Inc.", 2011
5
- license "Apache 2 license; see COPYING"
6
-
7
- summary _("Manage the list of revoked certificates.")
8
- description <<-EOT
9
- This subcommand is primarily for retrieving the certificate revocation
10
- list from the CA.
11
- EOT
12
-
13
- find = get_action(:find)
14
- find.summary "Retrieve the certificate revocation list."
15
- find.render_as = :s
16
- find.returns <<-EOT
17
- The certificate revocation list. When used from the Ruby API: returns an
18
- OpenSSL::X509::CRL object.
19
- EOT
20
- find.short_description <<-EOT
21
- Retrieves the certificate revocation list.
22
- EOT
23
- find.notes <<-EOT
24
- Although this action always returns the CRL from the specified terminus.
25
- EOT
26
- find.examples <<-EXAMPLES
27
- Retrieve a copy of the puppet master's CRL:
28
-
29
- $ puppet certificate_revocation_list find --terminus rest
30
- EXAMPLES
31
-
32
- destroy = get_action(:destroy)
33
- destroy.summary "Delete the certificate revocation list."
34
- destroy.arguments "<dummy_text>"
35
- destroy.returns "Nothing."
36
- destroy.description <<-EOT
37
- Deletes the certificate revocation list. This cannot be done over REST, but
38
- it is possible to delete the locally cached copy or the local CA's copy of
39
- the CRL.
40
- EOT
41
- destroy.short_description <<-EOT
42
- Deletes the certificate revocation list. This cannot be done over REST, but
43
- it is possible to delete the locally cached copy or the local CA's copy of
44
- the CRL. Due to a known bug, this action requires a dummy argument, the
45
- content of which is irrelevant.
46
- EOT
47
- destroy.notes <<-EOT
48
- Although this action always deletes the CRL from the specified terminus, it
49
- requires a dummy argument; this is a known bug.
50
- EOT
51
-
52
- deactivate_action(:search)
53
- deactivate_action(:save)
54
-
55
- deprecate
56
- end
@@ -1,16 +0,0 @@
1
- # Assign a random priority to items.
2
- #
3
- # @api private
4
- class Puppet::Graph::RandomPrioritizer < Puppet::Graph::Prioritizer
5
- def generate_priority_for(key)
6
- if priority_of(key).nil?
7
- record_priority_for(key, SecureRandom.uuid)
8
- else
9
- priority_of(key)
10
- end
11
- end
12
-
13
- def generate_priority_contained_in(container, key)
14
- generate_priority_for(key)
15
- end
16
- end
@@ -1,16 +0,0 @@
1
- # Prioritize keys, which must be Puppet::Resources, based on a static hash of
2
- # the key's ref. This prioritizer does not take containment into account.
3
- #
4
- # @api private
5
- require 'digest/sha1'
6
-
7
- class Puppet::Graph::TitleHashPrioritizer < Puppet::Graph::Prioritizer
8
- def generate_priority_for(resource)
9
- record_priority_for(resource,
10
- Digest::SHA1.hexdigest("NaCl, MgSO4 (salts) and then #{resource.ref}"))
11
- end
12
-
13
- def generate_priority_contained_in(container, resource)
14
- generate_priority_for(resource)
15
- end
16
- end
@@ -1,9 +0,0 @@
1
- require 'puppet/indirector/ssl_file'
2
- require 'puppet/ssl/certificate'
3
-
4
- class Puppet::SSL::Certificate::Ca < Puppet::Indirector::SslFile
5
- desc "Manage the CA collection of signed SSL certificates on disk."
6
-
7
- store_in :signeddir
8
- store_ca_at :cacert
9
- end
@@ -1,22 +0,0 @@
1
- require 'puppet/indirector/code'
2
- require 'puppet/ssl/certificate'
3
-
4
- class Puppet::SSL::Certificate::DisabledCa < Puppet::Indirector::Code
5
- desc "Manage SSL certificates on disk, but reject any remote access
6
- to the SSL data store. Used when a master has an explicitly disabled
7
- CA to prevent clients getting confusing 'success' behaviour."
8
-
9
- def initialize
10
- @file = Puppet::SSL::Certificate.indirection.terminus(:file)
11
- end
12
-
13
- [:find, :head, :search, :save, :destroy].each do |name|
14
- define_method(name) do |request|
15
- if request.remote?
16
- raise Puppet::Error, _("this master is not a CA")
17
- else
18
- @file.send(name, request)
19
- end
20
- end
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- require 'puppet/indirector/ssl_file'
2
- require 'puppet/ssl/certificate_request'
3
-
4
- class Puppet::SSL::CertificateRequest::Ca < Puppet::Indirector::SslFile
5
- desc "Manage the CA collection of certificate requests on disk."
6
-
7
- store_in :csrdir
8
-
9
- def save(request)
10
- if host = Puppet::SSL::Host.indirection.find(request.key)
11
- if Puppet[:allow_duplicate_certs]
12
- Puppet.notice _("%{request} already has a %{host} certificate; new certificate will overwrite it") % { request: request.key, host: host.state }
13
- else
14
- raise _("%{request} already has a %{host} certificate; ignoring certificate request") % { request: request.key, host: host.state }
15
- end
16
- end
17
-
18
- result = super
19
- Puppet.notice _("%{request} has a waiting certificate request") % { request: request.key }
20
- result
21
- end
22
- end
@@ -1,22 +0,0 @@
1
- require 'puppet/indirector/code'
2
- require 'puppet/ssl/certificate_request'
3
-
4
- class Puppet::SSL::CertificateRequest::DisabledCa < Puppet::Indirector::Code
5
- desc "Manage SSL certificate requests on disk, but reject any remote access
6
- to the SSL data store. Used when a master has an explicitly disabled CA to
7
- prevent clients getting confusing 'success' behaviour."
8
-
9
- def initialize
10
- @file = Puppet::SSL::CertificateRequest.indirection.terminus(:file)
11
- end
12
-
13
- [:find, :head, :search, :save, :destroy].each do |name|
14
- define_method(name) do |request|
15
- if request.remote?
16
- raise Puppet::Error, _("this master is not a CA")
17
- else
18
- @file.send(name, request)
19
- end
20
- end
21
- end
22
- end
@@ -1,8 +0,0 @@
1
- require 'puppet/indirector/ssl_file'
2
- require 'puppet/ssl/certificate_revocation_list'
3
-
4
- class Puppet::SSL::CertificateRevocationList::Ca < Puppet::Indirector::SslFile
5
- desc "Manage the CA collection of certificate requests on disk."
6
-
7
- store_at :cacrl
8
- end
@@ -1,22 +0,0 @@
1
- require 'puppet/indirector/code'
2
- require 'puppet/ssl/certificate_revocation_list'
3
-
4
- class Puppet::SSL::CertificateRevocationList::DisabledCa < Puppet::Indirector::Code
5
- desc "Manage SSL certificate revocation lists, but reject any remote access
6
- to the SSL data store. Used when a master has an explicitly disabled CA to
7
- prevent clients getting confusing 'success' behaviour."
8
-
9
- def initialize
10
- @file = Puppet::SSL::CertificateRevocationList.indirection.terminus(:file)
11
- end
12
-
13
- [:find, :head, :search, :save, :destroy].each do |name|
14
- define_method(name) do |request|
15
- if request.remote?
16
- raise Puppet::Error, _("this master is not a CA")
17
- else
18
- @file.send(name, request)
19
- end
20
- end
21
- end
22
- end
@@ -1,8 +0,0 @@
1
- require 'puppet/indirector/ssl_file'
2
- require 'puppet/ssl/certificate_revocation_list'
3
-
4
- class Puppet::SSL::CertificateRevocationList::File < Puppet::Indirector::SslFile
5
- desc "Manage the global certificate revocation list."
6
-
7
- store_at :hostcrl
8
- end
@@ -1,11 +0,0 @@
1
- require 'puppet/ssl/certificate_revocation_list'
2
- require 'puppet/indirector/rest'
3
-
4
- class Puppet::SSL::CertificateRevocationList::Rest < Puppet::Indirector::REST
5
- desc "Find and save certificate revocation lists over HTTP via REST."
6
-
7
- use_server_setting(:ca_server)
8
- use_port_setting(:ca_port)
9
- use_srv_service(:ca)
10
-
11
- end
@@ -1,4 +0,0 @@
1
- require 'puppet/indirector'
2
-
3
- class Puppet::Indirector::CertificateStatus
4
- end
@@ -1,91 +0,0 @@
1
- require 'puppet'
2
- require 'puppet/indirector/certificate_status'
3
- require 'puppet/ssl/certificate'
4
- require 'puppet/ssl/certificate_authority'
5
- require 'puppet/ssl/certificate_request'
6
- require 'puppet/ssl/host'
7
- require 'puppet/ssl/key'
8
-
9
- class Puppet::Indirector::CertificateStatus::File < Puppet::Indirector::Code
10
-
11
- desc "Manipulate certificate status on the local filesystem. Only functional
12
- on the CA."
13
-
14
- def ca
15
- raise ArgumentError, _("This process is not configured as a certificate authority") unless Puppet::SSL::CertificateAuthority.ca?
16
- Puppet::SSL::CertificateAuthority.new
17
- end
18
-
19
- def destroy(request)
20
- deleted = []
21
- [
22
- Puppet::SSL::Certificate,
23
- Puppet::SSL::CertificateRequest,
24
- Puppet::SSL::Key,
25
- ].collect do |part|
26
- if part.indirection.destroy(request.key)
27
- deleted << "#{part}"
28
- end
29
- end
30
-
31
- return _("Nothing was deleted") if deleted.empty?
32
- _("Deleted for %{request}: %{deleted}") % { request: request.key, deleted: deleted.join(", ") }
33
- end
34
-
35
- def save(request)
36
- if request.instance.desired_state == "signed"
37
- certificate_request = Puppet::SSL::CertificateRequest.indirection.find(request.key)
38
- raise Puppet::Error, _("Cannot sign for host %{request} without a certificate request") % { request: request.key } unless certificate_request
39
- ca.sign(request.key)
40
- elsif request.instance.desired_state == "revoked"
41
- certificate = Puppet::SSL::Certificate.indirection.find(request.key)
42
- raise Puppet::Error, _("Cannot revoke host %{request} because has it doesn't have a signed certificate") % { request: request.key } unless certificate
43
- ca.revoke(request.key)
44
- else
45
- raise Puppet::Error, _("State %{state} invalid; Must specify desired state of 'signed' or 'revoked' for host %{request}") % { state: request.instance.desired_state, request: request.key }
46
- end
47
-
48
- end
49
-
50
- def search(request)
51
- # Support historic interface wherein users provide classes to filter
52
- # the search. When used via the REST API, the arguments must be
53
- # a Symbol or an Array containing Symbol objects.
54
- klasses = case request.options[:for]
55
- when Class
56
- [request.options[:for]]
57
- when nil
58
- [
59
- Puppet::SSL::Certificate,
60
- Puppet::SSL::CertificateRequest,
61
- Puppet::SSL::Key,
62
- ]
63
- else
64
- [request.options[:for]].flatten.map do |klassname|
65
- indirection.class.model(klassname.to_sym)
66
- end
67
- end
68
-
69
- klasses.collect do |klass|
70
- klass.indirection.search(request.key, request.options)
71
- end.flatten.collect do |result|
72
- result.name
73
- end.uniq.collect(&Puppet::SSL::Host.method(:new))
74
- end
75
-
76
- def find(request)
77
- ssl_host = Puppet::SSL::Host.new(request.key)
78
- public_key = Puppet::SSL::Certificate.indirection.find(request.key)
79
-
80
- if ssl_host.certificate_request || public_key
81
- ssl_host
82
- else
83
- nil
84
- end
85
- end
86
-
87
- def validate_key(request)
88
- # We only use desired_state from the instance and use request.key
89
- # otherwise, so the name does not need to match
90
- end
91
- end
@@ -1,11 +0,0 @@
1
- require 'puppet/ssl/host'
2
- require 'puppet/indirector/rest'
3
- require 'puppet/indirector/certificate_status'
4
-
5
- class Puppet::Indirector::CertificateStatus::Rest < Puppet::Indirector::REST
6
- desc "Sign, revoke, search for, or clean certificates & certificate requests over HTTP."
7
-
8
- use_server_setting(:ca_server)
9
- use_port_setting(:ca_port)
10
- use_srv_service(:ca)
11
- end
@@ -1,16 +0,0 @@
1
- require 'puppet/indirector/ssl_file'
2
- require 'puppet/ssl/key'
3
-
4
- class Puppet::SSL::Key::Ca < Puppet::Indirector::SslFile
5
- desc "Manage the CA's private key on disk. This terminus works with the
6
- CA key *only*, because that's the only key that the CA ever interacts
7
- with."
8
-
9
- store_in :privatekeydir
10
-
11
- store_ca_at :cakey
12
-
13
- def allow_remote_requests?
14
- false
15
- end
16
- end
@@ -1,22 +0,0 @@
1
- require 'puppet/indirector/code'
2
- require 'puppet/ssl/key'
3
-
4
- class Puppet::SSL::Key::DisabledCa < Puppet::Indirector::Code
5
- desc "Manage the CA private key, but reject any remote access
6
- to the SSL data store. Used when a master has an explicitly disabled CA to
7
- prevent clients getting confusing 'success' behaviour."
8
-
9
- def initialize
10
- @file = Puppet::SSL::Key.indirection.terminus(:file)
11
- end
12
-
13
- [:find, :head, :search, :save, :destroy].each do |name|
14
- define_method(name) do |request|
15
- if request.remote?
16
- raise Puppet::Error, _("this master is not a CA")
17
- else
18
- @file.send(name, request)
19
- end
20
- end
21
- end
22
- end
@@ -1,86 +0,0 @@
1
- require 'puppet/indirector/terminus'
2
- require 'puppet/util/ldap/connection'
3
-
4
- class Puppet::Indirector::Ldap < Puppet::Indirector::Terminus
5
- def initialize
6
- #TRANSLATORS 'Puppet::Indirector::Ldap' is a class and should not be translated
7
- Puppet.deprecation_warning(_("Puppet::Indirector::Ldap is deprecated and will be removed in a future release of Puppet."));
8
- super
9
- end
10
-
11
- # Perform our ldap search and process the result.
12
- def find(request)
13
- ldapsearch(search_filter(request.key)) { |entry| return process(entry) } || nil
14
- end
15
-
16
- # Process the found entry. We assume that we don't just want the
17
- # ldap object.
18
- def process(entry)
19
- raise Puppet::DevError, _("The 'process' method has not been overridden for the LDAP terminus for %{name}") % { name: self.name }
20
- end
21
-
22
- # Default to all attributes.
23
- def search_attributes
24
- nil
25
- end
26
-
27
- def search_base
28
- Puppet[:ldapbase]
29
- end
30
-
31
- # The ldap search filter to use.
32
- def search_filter(name)
33
- raise Puppet::DevError, _("No search string set for LDAP terminus for %{name}") % { name: self.name }
34
- end
35
-
36
- # Find the ldap node, return the class list and parent node specially,
37
- # and everything else in a parameter hash.
38
- def ldapsearch(filter)
39
- raise ArgumentError.new(_("You must pass a block to ldapsearch")) unless block_given?
40
-
41
- found = false
42
- count = 0
43
-
44
- begin
45
- connection.search(search_base, 2, filter, search_attributes) do |entry|
46
- found = true
47
- yield entry
48
- end
49
- rescue SystemExit,NoMemoryError
50
- raise
51
- rescue Exception => detail
52
- if count == 0
53
- # Try reconnecting to ldap if we get an exception and we haven't yet retried.
54
- count += 1
55
- @connection = nil
56
- Puppet.warning _("Retrying LDAP connection")
57
- retry
58
- else
59
- error = Puppet::Error.new(_("LDAP Search failed"))
60
- error.set_backtrace(detail.backtrace)
61
- raise error
62
- end
63
- end
64
-
65
- found
66
- end
67
-
68
- # Create an ldap connection.
69
- def connection
70
- unless @connection
71
- #TRANSLATORS "ruby/ldap libraries" are code dependencies
72
- raise Puppet::Error, _("Could not set up LDAP Connection: Missing ruby/ldap libraries") unless Puppet.features.ldap?
73
- begin
74
- conn = Puppet::Util::Ldap::Connection.instance
75
- conn.start
76
- @connection = conn.connection
77
- rescue => detail
78
- message = _("Could not connect to LDAP: %{detail}") % { detail: detail }
79
- Puppet.log_exception(detail, message)
80
- raise Puppet::Error, message, detail.backtrace
81
- end
82
- end
83
-
84
- @connection
85
- end
86
- end