puppet 2.7.1 → 2.7.3
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.
- data/CHANGELOG +225 -1
- data/CONTRIBUTING.md +299 -0
- data/README.md +0 -1
- data/conf/redhat/puppet.spec +132 -25
- data/conf/solaris/pkginfo +1 -1
- data/conf/suse/puppet.spec +5 -2
- data/ext/envpuppet +56 -3
- data/ext/vim/README +2 -1
- data/ext/vim/ftplugin/puppet.vim +94 -0
- data/ext/vim/indent/puppet.vim +76 -0
- data/lib/puppet.rb +2 -3
- data/lib/puppet/application/agent.rb +7 -7
- data/lib/puppet/application/apply.rb +20 -8
- data/lib/puppet/application/ca.rb +5 -0
- data/lib/puppet/application/cert.rb +2 -1
- data/lib/puppet/application/certificate.rb +0 -5
- data/lib/puppet/application/device.rb +4 -4
- data/lib/puppet/application/doc.rb +23 -12
- data/lib/puppet/application/face_base.rb +2 -1
- data/lib/puppet/application/inspect.rb +5 -2
- data/lib/puppet/configurer.rb +60 -56
- data/lib/puppet/configurer/fact_handler.rb +6 -1
- data/lib/puppet/defaults.rb +20 -1
- data/lib/puppet/face/ca.rb +233 -0
- data/lib/puppet/face/certificate.rb +15 -11
- data/lib/puppet/face/certificate_request.rb +9 -11
- data/lib/puppet/face/certificate_revocation_list.rb +5 -7
- data/lib/puppet/face/node/clean.rb +154 -0
- data/lib/puppet/face/status.rb +1 -0
- data/lib/puppet/file_serving/configuration/parser.rb +6 -13
- data/lib/puppet/indirector/exec.rb +3 -3
- data/lib/puppet/indirector/face.rb +17 -7
- data/lib/puppet/indirector/report/processor.rb +29 -16
- data/lib/puppet/indirector/rest.rb +42 -7
- data/lib/puppet/indirector/yaml.rb +5 -0
- data/lib/puppet/interface.rb +7 -2
- data/lib/puppet/interface/action.rb +57 -23
- data/lib/puppet/interface/action_manager.rb +10 -5
- data/lib/puppet/interface/face_collection.rb +43 -52
- data/lib/puppet/interface/option.rb +19 -0
- data/lib/puppet/interface/option_builder.rb +13 -0
- data/lib/puppet/interface/option_manager.rb +2 -1
- data/lib/puppet/metatype/manager.rb +7 -20
- data/lib/puppet/module.rb +4 -1
- data/lib/puppet/network/authconfig.rb +3 -1
- data/lib/puppet/network/authstore.rb +14 -5
- data/lib/puppet/network/handler/fileserver.rb +3 -0
- data/lib/puppet/network/http/webrick.rb +1 -1
- data/lib/puppet/network/rest_authconfig.rb +6 -1
- data/lib/puppet/network/rest_authorization.rb +1 -1
- data/lib/puppet/parser/compiler.rb +8 -11
- data/lib/puppet/parser/functions.rb +1 -6
- data/lib/puppet/parser/functions/create_resources.rb +6 -5
- data/lib/puppet/parser/functions/regsubst.rb +26 -0
- data/lib/puppet/parser/functions/shellquote.rb +26 -0
- data/lib/puppet/parser/functions/sprintf.rb +26 -0
- data/lib/puppet/parser/grammar.ra +34 -60
- data/lib/puppet/parser/lexer.rb +5 -5
- data/lib/puppet/parser/parser.rb +913 -1196
- data/lib/puppet/parser/resource.rb +18 -1
- data/lib/puppet/parser/scope.rb +2 -2
- data/lib/puppet/provider/augeas/augeas.rb +42 -17
- data/lib/puppet/provider/mount/parsed.rb +19 -1
- data/lib/puppet/provider/naginator.rb +9 -1
- data/lib/puppet/provider/nameservice/directoryservice.rb +11 -8
- data/lib/puppet/provider/network_device.rb +1 -1
- data/lib/puppet/provider/package/aptitude.rb +1 -0
- data/lib/puppet/provider/package/pacman.rb +94 -0
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +0 -6
- data/lib/puppet/rails/host.rb +7 -0
- data/lib/puppet/reports/store.rb +15 -0
- data/lib/puppet/resource/catalog.rb +15 -6
- data/lib/puppet/ssl/certificate.rb +6 -0
- data/lib/puppet/ssl/inventory.rb +2 -0
- data/lib/puppet/transaction.rb +9 -17
- data/lib/puppet/transaction/report.rb +3 -3
- data/lib/puppet/type.rb +13 -24
- data/lib/puppet/type/file.rb +8 -2
- data/lib/puppet/type/file/source.rb +2 -2
- data/lib/puppet/type/service.rb +20 -24
- data/lib/puppet/type/ssh_authorized_key.rb +12 -0
- data/lib/puppet/type/user.rb +8 -0
- data/lib/puppet/util.rb +0 -1
- data/lib/puppet/util/network_device.rb +3 -3
- data/lib/puppet/util/settings.rb +1 -1
- data/lib/puppet/util/settings/file_setting.rb +1 -0
- data/lib/semver.rb +65 -0
- data/spec/integration/defaults_spec.rb +23 -1
- data/spec/integration/network/rest_authconfig_spec.rb +145 -0
- data/spec/integration/node/facts_spec.rb +1 -1
- data/spec/integration/parser/functions_spec.rb +1 -1
- data/spec/integration/parser/parser_spec.rb +31 -0
- data/spec/integration/provider/ssh_authorized_key_spec.rb +207 -0
- data/spec/integration/type_spec.rb +11 -0
- data/spec/lib/puppet/face/1.0.0/huzzah.rb +8 -0
- data/spec/lib/puppet/face/huzzah.rb +1 -0
- data/spec/lib/puppet/face/huzzah/obsolete.rb +6 -0
- data/spec/shared_behaviours/things_that_declare_options.rb +115 -3
- data/spec/unit/application/agent_spec.rb +2 -2
- data/spec/unit/application/apply_spec.rb +74 -56
- data/spec/unit/application/cert_spec.rb +10 -0
- data/spec/unit/application/device_spec.rb +2 -3
- data/spec/unit/application/face_base_spec.rb +1 -0
- data/spec/unit/application/facts_spec.rb +1 -0
- data/spec/unit/application/inspect_spec.rb +5 -0
- data/spec/unit/configurer/fact_handler_spec.rb +45 -37
- data/spec/unit/configurer_spec.rb +405 -327
- data/spec/unit/face/ca_spec.rb +355 -0
- data/spec/unit/face/certificate_spec.rb +16 -4
- data/spec/unit/face/node_spec.rb +261 -1
- data/spec/unit/file_serving/configuration/parser_spec.rb +8 -0
- data/spec/unit/indirector/certificate/rest_spec.rb +1 -0
- data/spec/unit/indirector/certificate_status/file_spec.rb +4 -0
- data/spec/unit/indirector/exec_spec.rb +4 -4
- data/spec/unit/indirector/face_spec.rb +3 -1
- data/spec/unit/indirector/facts/couch_spec.rb +2 -2
- data/spec/unit/indirector/facts/network_device_spec.rb +2 -6
- data/spec/unit/indirector/node/exec_spec.rb +1 -1
- data/spec/unit/indirector/report/processor_spec.rb +31 -8
- data/spec/unit/indirector/rest_spec.rb +53 -5
- data/spec/unit/indirector/yaml_spec.rb +18 -0
- data/spec/unit/interface/action_spec.rb +112 -8
- data/spec/unit/interface/face_collection_spec.rb +46 -36
- data/spec/unit/interface/option_spec.rb +44 -0
- data/spec/unit/interface_spec.rb +11 -6
- data/spec/unit/module_spec.rb +38 -9
- data/spec/unit/network/authconfig_spec.rb +23 -0
- data/spec/unit/network/authstore_spec.rb +36 -4
- data/spec/unit/network/handler/fileserver_spec.rb +32 -0
- data/spec/unit/network/rest_authconfig_spec.rb +1 -1
- data/spec/unit/node_spec.rb +1 -0
- data/spec/unit/parser/compiler_spec.rb +8 -46
- data/spec/unit/parser/lexer_spec.rb +27 -17
- data/spec/unit/parser/resource_spec.rb +61 -3
- data/spec/unit/parser/scope_spec.rb +5 -1
- data/spec/unit/provider/augeas/augeas_spec.rb +106 -1
- data/spec/unit/provider/cisco_spec.rb +3 -4
- data/spec/unit/provider/interface/cisco_spec.rb +1 -2
- data/spec/unit/provider/mount/parsed_spec.rb +41 -0
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +60 -0
- data/spec/unit/provider/network_device_spec.rb +1 -2
- data/spec/unit/provider/package/pacman_spec.rb +237 -0
- data/spec/unit/provider/package/pkgutil_spec.rb +2 -3
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +21 -32
- data/spec/unit/provider/vlan/cisco_spec.rb +1 -2
- data/spec/unit/rails/host_spec.rb +8 -0
- data/spec/unit/resource/catalog_spec.rb +55 -8
- data/spec/unit/semver_spec.rb +187 -0
- data/spec/unit/ssl/certificate_spec.rb +25 -0
- data/spec/unit/transaction/report_spec.rb +3 -3
- data/spec/unit/transaction_spec.rb +8 -2
- data/spec/unit/type/file_spec.rb +57 -0
- data/spec/unit/type/interface_spec.rb +1 -2
- data/spec/unit/type/schedule_spec.rb +73 -42
- data/spec/unit/type/ssh_authorized_key_spec.rb +180 -70
- data/spec/unit/type/user_spec.rb +8 -0
- data/spec/unit/type/vlan_spec.rb +1 -2
- data/spec/unit/type_spec.rb +66 -0
- data/spec/unit/util/network_device/cisco/device_spec.rb +1 -2
- data/spec/unit/util/network_device/cisco/facts_spec.rb +2 -3
- data/spec/unit/util/network_device/cisco/interface_spec.rb +1 -2
- data/spec/unit/util/network_device/config_spec.rb +3 -4
- data/spec/unit/util/network_device/ipcalc_spec.rb +1 -2
- data/spec/unit/util/network_device/transport/base_spec.rb +1 -2
- data/spec/unit/util/network_device/transport/ssh_spec.rb +1 -2
- data/spec/unit/util/network_device/transport/telnet_spec.rb +1 -2
- data/spec/unit/util/network_device_spec.rb +2 -2
- data/spec/unit/util/settings/file_setting_spec.rb +4 -0
- data/spec/unit/util/settings_spec.rb +11 -0
- data/test/lib/puppettest/railstesting.rb +0 -34
- metadata +19 -4
@@ -16,7 +16,12 @@ module Puppet::Configurer::FactHandler
|
|
16
16
|
# compile them and then "cache" them on the server.
|
17
17
|
begin
|
18
18
|
reload_facter
|
19
|
-
Puppet::Node::Facts.indirection.find(Puppet[:
|
19
|
+
facts = Puppet::Node::Facts.indirection.find(Puppet[:node_name_value])
|
20
|
+
unless Puppet[:node_name_fact].empty?
|
21
|
+
Puppet[:node_name_value] = facts.values[Puppet[:node_name_fact]]
|
22
|
+
facts.name = Puppet[:node_name_value]
|
23
|
+
end
|
24
|
+
facts
|
20
25
|
rescue SystemExit,NoMemoryError
|
21
26
|
raise
|
22
27
|
rescue Exception => detail
|
data/lib/puppet/defaults.rb
CHANGED
@@ -466,7 +466,7 @@ module Puppet
|
|
466
466
|
:desc => "The directory in which to store reports
|
467
467
|
received from the client. Each client gets a separate
|
468
468
|
subdirectory."},
|
469
|
-
:reporturl => ["http://localhost:3000/reports",
|
469
|
+
:reporturl => ["http://localhost:3000/reports/upload",
|
470
470
|
"The URL used by the http reports processor to send reports"],
|
471
471
|
:fileserverconfig => ["$confdir/fileserver.conf", "Where the fileserver configuration is stored."],
|
472
472
|
:strict_hostname_checking => [false, "Whether to only search for the complete
|
@@ -493,6 +493,25 @@ module Puppet
|
|
493
493
|
)
|
494
494
|
|
495
495
|
setdefaults(:agent,
|
496
|
+
:node_name_value => { :default => "$certname",
|
497
|
+
:desc => "The explicit value used for the node name for all requests the agent
|
498
|
+
makes to the master. WARNING: This setting is mutually exclusive with
|
499
|
+
node_name_fact. Changing this setting also requires changes to the default
|
500
|
+
auth.conf configuration on the Puppet Master. Please see
|
501
|
+
http://links.puppetlabs.com/node_name_value for more information."
|
502
|
+
},
|
503
|
+
:node_name_fact => { :default => "",
|
504
|
+
:desc => "The fact name used to determine the node name used for all requests the agent
|
505
|
+
makes to the master. WARNING: This setting is mutually exclusive with
|
506
|
+
node_name_value. Changing this setting also requires changes to the default
|
507
|
+
auth.conf configuration on the Puppet Master. Please see
|
508
|
+
http://links.puppetlabs.com/node_name_fact for more information.",
|
509
|
+
:hook => proc do |value|
|
510
|
+
if !value.empty? and Puppet[:node_name_value] != Puppet[:certname]
|
511
|
+
raise "Cannot specify both the node_name_value and node_name_fact settings"
|
512
|
+
end
|
513
|
+
end
|
514
|
+
},
|
496
515
|
:localconfig => { :default => "$statedir/localconfig",
|
497
516
|
:owner => "root",
|
498
517
|
:mode => 0660,
|
@@ -0,0 +1,233 @@
|
|
1
|
+
require 'puppet/face'
|
2
|
+
|
3
|
+
Puppet::Face.define(:ca, '0.1.0') do
|
4
|
+
copyright "Puppet Labs", 2011
|
5
|
+
license "Apache 2 license; see COPYING"
|
6
|
+
|
7
|
+
summary "Local Puppet Certificate Authority management."
|
8
|
+
|
9
|
+
description <<-TEXT
|
10
|
+
This provides local management of the Puppet Certificate Authority.
|
11
|
+
|
12
|
+
You can use this subcommand to sign outstanding certificate requests, list
|
13
|
+
and manage local certificates, and inspect the state of the CA.
|
14
|
+
TEXT
|
15
|
+
|
16
|
+
action :list do
|
17
|
+
summary "List certificates and/or certificate requests."
|
18
|
+
|
19
|
+
description <<-TEXT
|
20
|
+
This will list the current certificates and certificate signing requests
|
21
|
+
in the Puppet CA. You will also get the fingerprint, and any certificate
|
22
|
+
verification failure reported.
|
23
|
+
TEXT
|
24
|
+
|
25
|
+
option "--[no-]all" do
|
26
|
+
summary "Include all certificates and requests."
|
27
|
+
end
|
28
|
+
|
29
|
+
option "--[no-]pending" do
|
30
|
+
summary "Include pending certificate signing requests."
|
31
|
+
end
|
32
|
+
|
33
|
+
option "--[no-]signed" do
|
34
|
+
summary "Include signed certificates."
|
35
|
+
end
|
36
|
+
|
37
|
+
option "--subject PATTERN" do
|
38
|
+
summary "Only list if the subject matches PATTERN."
|
39
|
+
|
40
|
+
description <<-TEXT
|
41
|
+
Only include certificates or requests where subject matches PATTERN.
|
42
|
+
|
43
|
+
PATTERN is interpreted as a regular expression, allowing complex
|
44
|
+
filtering of the content.
|
45
|
+
TEXT
|
46
|
+
end
|
47
|
+
|
48
|
+
when_invoked do |options|
|
49
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
50
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
51
|
+
raise "Unable to fetch the CA"
|
52
|
+
end
|
53
|
+
|
54
|
+
pattern = options[:subject].nil? ? nil :
|
55
|
+
Regexp.new(options[:subject], Regexp::IGNORECASE)
|
56
|
+
|
57
|
+
pending = options[:pending].nil? ? options[:all] : options[:pending]
|
58
|
+
signed = options[:signed].nil? ? options[:all] : options[:signed]
|
59
|
+
|
60
|
+
# By default we list pending, so if nothing at all was requested...
|
61
|
+
unless pending or signed then pending = true end
|
62
|
+
|
63
|
+
hosts = []
|
64
|
+
|
65
|
+
pending and hosts += ca.waiting?
|
66
|
+
signed and hosts += ca.list
|
67
|
+
|
68
|
+
pattern and hosts = hosts.select {|hostname| pattern.match hostname }
|
69
|
+
|
70
|
+
hosts.sort.map {|host| Puppet::SSL::Host.new(host) }
|
71
|
+
end
|
72
|
+
|
73
|
+
when_rendering :console do |hosts|
|
74
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
75
|
+
raise "Unable to fetch the CA"
|
76
|
+
end
|
77
|
+
|
78
|
+
length = hosts.map{|x| x.name.length }.max + 1
|
79
|
+
|
80
|
+
hosts.map do |host|
|
81
|
+
name = host.name.ljust(length)
|
82
|
+
if host.certificate_request then
|
83
|
+
" #{name} (#{host.certificate_request.fingerprint})"
|
84
|
+
else
|
85
|
+
begin
|
86
|
+
ca.verify(host.certificate)
|
87
|
+
"+ #{name} (#{host.certificate.fingerprint})"
|
88
|
+
rescue Puppet::SSL::CertificateAuthority::CertificateVerificationError => e
|
89
|
+
"- #{name} (#{host.certificate.fingerprint}) (#{e.to_s})"
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end.join("\n")
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
action :destroy do
|
97
|
+
when_invoked do |host, options|
|
98
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
99
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
100
|
+
raise "Unable to fetch the CA"
|
101
|
+
end
|
102
|
+
|
103
|
+
ca.destroy host
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
action :revoke do
|
108
|
+
when_invoked do |host, options|
|
109
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
110
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
111
|
+
raise "Unable to fetch the CA"
|
112
|
+
end
|
113
|
+
|
114
|
+
begin
|
115
|
+
ca.revoke host
|
116
|
+
rescue ArgumentError => e
|
117
|
+
# This is a bit naff, but it makes the behaviour consistent with the
|
118
|
+
# destroy action. The underlying tools could be nicer for that sort
|
119
|
+
# of thing; they have fairly inconsistent reporting of failures.
|
120
|
+
raise unless e.to_s =~ /Could not find a serial number for /
|
121
|
+
"Nothing was revoked"
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
action :generate do
|
127
|
+
when_invoked do |host, options|
|
128
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
129
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
130
|
+
raise "Unable to fetch the CA"
|
131
|
+
end
|
132
|
+
|
133
|
+
begin
|
134
|
+
ca.generate host
|
135
|
+
rescue RuntimeError => e
|
136
|
+
if e.to_s =~ /already has a requested certificate/
|
137
|
+
"#{host} already has a certificate request; use sign instead"
|
138
|
+
else
|
139
|
+
raise
|
140
|
+
end
|
141
|
+
rescue ArgumentError => e
|
142
|
+
if e.to_s =~ /A Certificate already exists for /
|
143
|
+
"#{host} already has a certificate"
|
144
|
+
else
|
145
|
+
raise
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
action :sign do
|
152
|
+
when_invoked do |host, options|
|
153
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
154
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
155
|
+
raise "Unable to fetch the CA"
|
156
|
+
end
|
157
|
+
|
158
|
+
begin
|
159
|
+
ca.sign host
|
160
|
+
rescue ArgumentError => e
|
161
|
+
if e.to_s =~ /Could not find certificate request/
|
162
|
+
e.to_s
|
163
|
+
else
|
164
|
+
raise
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
action :print do
|
171
|
+
when_invoked do |host, options|
|
172
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
173
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
174
|
+
raise "Unable to fetch the CA"
|
175
|
+
end
|
176
|
+
|
177
|
+
ca.print host
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
action :fingerprint do
|
182
|
+
option "--digest ALGORITHM" do
|
183
|
+
summary "The hash algorithm to use when displaying the fingerprint"
|
184
|
+
end
|
185
|
+
|
186
|
+
when_invoked do |host, options|
|
187
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
188
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
189
|
+
raise "Unable to fetch the CA"
|
190
|
+
end
|
191
|
+
|
192
|
+
begin
|
193
|
+
# I want the default from the CA, not to duplicate it, but passing
|
194
|
+
# 'nil' explicitly means that we don't get that. This works...
|
195
|
+
if options.has_key? :digest
|
196
|
+
ca.fingerprint host, options[:digest]
|
197
|
+
else
|
198
|
+
ca.fingerprint host
|
199
|
+
end
|
200
|
+
rescue ArgumentError => e
|
201
|
+
raise unless e.to_s =~ /Could not find a certificate or csr for/
|
202
|
+
nil
|
203
|
+
end
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
action :verify do
|
208
|
+
when_invoked do |host, options|
|
209
|
+
raise "Not a CA" unless Puppet::SSL::CertificateAuthority.ca?
|
210
|
+
unless ca = Puppet::SSL::CertificateAuthority.instance
|
211
|
+
raise "Unable to fetch the CA"
|
212
|
+
end
|
213
|
+
|
214
|
+
begin
|
215
|
+
ca.verify host
|
216
|
+
{ :host => host, :valid => true }
|
217
|
+
rescue ArgumentError => e
|
218
|
+
raise unless e.to_s =~ /Could not find a certificate for/
|
219
|
+
{ :host => host, :valid => false, :error => e.to_s }
|
220
|
+
rescue Puppet::SSL::CertificateAuthority::CertificateVerificationError => e
|
221
|
+
{ :host => host, :valid => false, :error => e.to_s }
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
when_rendering :console do |value|
|
226
|
+
if value[:valid]
|
227
|
+
nil
|
228
|
+
else
|
229
|
+
"Could not verify #{value[:host]}: #{value[:error]}"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
end
|
@@ -6,7 +6,7 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
6
6
|
license "Apache 2 license; see COPYING"
|
7
7
|
|
8
8
|
summary "Provide access to the CA for certificate management."
|
9
|
-
description <<-
|
9
|
+
description <<-EOT
|
10
10
|
This subcommand interacts with a local or remote Puppet certificate
|
11
11
|
authority. Currently, its behavior is not a full superset of `puppet
|
12
12
|
cert`; specifically, it is unable to mimic puppet cert's "clean" option,
|
@@ -15,8 +15,9 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
15
15
|
EOT
|
16
16
|
|
17
17
|
option "--ca-location LOCATION" do
|
18
|
+
required
|
18
19
|
summary "Which certificate authority to use (local or remote)."
|
19
|
-
description <<-
|
20
|
+
description <<-EOT
|
20
21
|
Whether to act on the local certificate authority or one provided by a
|
21
22
|
remote puppet master. Allowed values are 'local' and 'remote.'
|
22
23
|
|
@@ -24,6 +25,9 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
24
25
|
EOT
|
25
26
|
|
26
27
|
before_action do |action, args, options|
|
28
|
+
unless [:remote, :local, :only].include? options[:ca_location].to_sym
|
29
|
+
raise ArgumentError, "Valid values for ca-location are 'remote', 'local', 'only'."
|
30
|
+
end
|
27
31
|
Puppet::SSL::Host.ca_location = options[:ca_location].to_sym
|
28
32
|
end
|
29
33
|
end
|
@@ -32,7 +36,7 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
32
36
|
summary "Generate a new certificate signing request."
|
33
37
|
arguments "<host>"
|
34
38
|
returns "Nothing."
|
35
|
-
description <<-
|
39
|
+
description <<-EOT
|
36
40
|
Generates and submits a certificate signing request (CSR) for the
|
37
41
|
specified host. This CSR will then have to be signed by a user
|
38
42
|
with the proper authorization on the certificate authority.
|
@@ -41,7 +45,7 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
41
45
|
primarily useful for requesting certificates for individual users and
|
42
46
|
external applications.
|
43
47
|
EOT
|
44
|
-
examples <<-
|
48
|
+
examples <<-EOT
|
45
49
|
Request a certificate for "somenode" from the site's CA:
|
46
50
|
|
47
51
|
$ puppet certificate generate somenode.puppetlabs.lan --ca-location remote
|
@@ -56,7 +60,7 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
56
60
|
|
57
61
|
action :list do
|
58
62
|
summary "List all certificate signing requests."
|
59
|
-
returns <<-
|
63
|
+
returns <<-EOT
|
60
64
|
An array of #inspect output from CSR objects. This output is
|
61
65
|
currently messy, but does contain the names of nodes requesting
|
62
66
|
certificates. This action returns #inspect strings even when used
|
@@ -73,10 +77,10 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
73
77
|
action :sign do
|
74
78
|
summary "Sign a certificate signing request for HOST."
|
75
79
|
arguments "<host>"
|
76
|
-
returns <<-
|
80
|
+
returns <<-EOT
|
77
81
|
A string that appears to be (but isn't) an x509 certificate.
|
78
82
|
EOT
|
79
|
-
examples <<-
|
83
|
+
examples <<-EOT
|
80
84
|
Sign somenode.puppetlabs.lan's certificate:
|
81
85
|
|
82
86
|
$ puppet certificate sign somenode.puppetlabs.lan --ca-location remote
|
@@ -93,9 +97,9 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
93
97
|
find = get_action(:find)
|
94
98
|
find.summary "Retrieve a certificate."
|
95
99
|
find.arguments "<host>"
|
96
|
-
find.
|
97
|
-
|
98
|
-
|
100
|
+
find.render_as = :s
|
101
|
+
find.returns <<-EOT
|
102
|
+
An x509 SSL certificate.
|
99
103
|
|
100
104
|
Note that this action has a side effect of caching a copy of the
|
101
105
|
certificate in Puppet's `ssldir`.
|
@@ -105,7 +109,7 @@ Puppet::Indirector::Face.define(:certificate, '0.0.1') do
|
|
105
109
|
destroy.summary "Delete a certificate."
|
106
110
|
destroy.arguments "<host>"
|
107
111
|
destroy.returns "Nothing."
|
108
|
-
destroy.description <<-
|
112
|
+
destroy.description <<-EOT
|
109
113
|
Deletes a certificate. This action currently only works on the local CA.
|
110
114
|
EOT
|
111
115
|
|
@@ -5,7 +5,7 @@ Puppet::Indirector::Face.define(:certificate_request, '0.0.1') do
|
|
5
5
|
license "Apache 2 license; see COPYING"
|
6
6
|
|
7
7
|
summary "Manage certificate requests."
|
8
|
-
description <<-
|
8
|
+
description <<-EOT
|
9
9
|
This subcommand retrieves and submits certificate signing requests (CSRs).
|
10
10
|
EOT
|
11
11
|
|
@@ -15,14 +15,12 @@ Puppet::Indirector::Face.define(:certificate_request, '0.0.1') do
|
|
15
15
|
find = get_action(:find)
|
16
16
|
find.summary "Retrieve a single CSR."
|
17
17
|
find.arguments "<host>"
|
18
|
-
find.
|
18
|
+
find.render_as = :s
|
19
|
+
find.returns <<-EOT
|
19
20
|
A single certificate request. When used from the Ruby API, returns a
|
20
21
|
Puppet::SSL::CertificateRequest object.
|
21
|
-
|
22
|
-
RENDERING ISSUES: In most cases, you will want to render this as a string
|
23
|
-
('--render-as s').
|
24
22
|
EOT
|
25
|
-
find.examples <<-
|
23
|
+
find.examples <<-EOT
|
26
24
|
Retrieve a single CSR from the puppet master's CA:
|
27
25
|
|
28
26
|
$ puppet certificate_request find somenode.puppetlabs.lan --terminus rest
|
@@ -31,10 +29,10 @@ Puppet::Indirector::Face.define(:certificate_request, '0.0.1') do
|
|
31
29
|
search = get_action(:search)
|
32
30
|
search.summary "Retrieve all outstanding CSRs."
|
33
31
|
search.arguments "<dummy_text>"
|
34
|
-
search.
|
35
|
-
|
36
|
-
|
37
|
-
Puppet::SSL::CertificateRequest objects.
|
32
|
+
search.render_as = :s
|
33
|
+
search.returns <<-EOT
|
34
|
+
A list of certificate requests. When used from the Ruby API, returns an
|
35
|
+
array of Puppet::SSL::CertificateRequest objects.
|
38
36
|
EOT
|
39
37
|
search.short_description <<-EOT
|
40
38
|
Retrieves all outstanding certificate signing requests. Due to a known bug,
|
@@ -44,7 +42,7 @@ Puppet::Indirector::Face.define(:certificate_request, '0.0.1') do
|
|
44
42
|
Although this action always returns all CSRs, it requires a dummy search
|
45
43
|
key; this is a known bug.
|
46
44
|
EOT
|
47
|
-
search.examples <<-
|
45
|
+
search.examples <<-EOT
|
48
46
|
Retrieve all CSRs from the local CA (similar to 'puppet cert list'):
|
49
47
|
|
50
48
|
$ puppet certificate_request search x --terminus ca
|
@@ -5,7 +5,7 @@ Puppet::Indirector::Face.define(:certificate_revocation_list, '0.0.1') do
|
|
5
5
|
license "Apache 2 license; see COPYING"
|
6
6
|
|
7
7
|
summary "Manage the list of revoked certificates."
|
8
|
-
description <<-
|
8
|
+
description <<-EOT
|
9
9
|
This subcommand is primarily for retrieving the certificate revocation
|
10
10
|
list from the CA.
|
11
11
|
EOT
|
@@ -13,12 +13,10 @@ Puppet::Indirector::Face.define(:certificate_revocation_list, '0.0.1') do
|
|
13
13
|
find = get_action(:find)
|
14
14
|
find.summary "Retrieve the certificate revocation list."
|
15
15
|
find.arguments "<dummy_text>"
|
16
|
-
find.
|
16
|
+
find.render_as = :s
|
17
|
+
find.returns <<-EOT
|
17
18
|
The certificate revocation list. When used from the Ruby API: returns an
|
18
19
|
OpenSSL::X509::CRL object.
|
19
|
-
|
20
|
-
RENDERING ISSUES: this should usually be rendered as a string
|
21
|
-
('--render-as s').
|
22
20
|
EOT
|
23
21
|
find.short_description <<-EOT
|
24
22
|
Retrieves the certificate revocation list. Due to a known bug, this action
|
@@ -28,7 +26,7 @@ Puppet::Indirector::Face.define(:certificate_revocation_list, '0.0.1') do
|
|
28
26
|
Although this action always returns the CRL from the specified terminus, it
|
29
27
|
requires a dummy argument; this is a known bug.
|
30
28
|
EOT
|
31
|
-
find.examples <<-
|
29
|
+
find.examples <<-EXAMPLES
|
32
30
|
Retrieve a copy of the puppet master's CRL:
|
33
31
|
|
34
32
|
$ puppet certificate_revocation_list find crl --terminus rest
|
@@ -38,7 +36,7 @@ Puppet::Indirector::Face.define(:certificate_revocation_list, '0.0.1') do
|
|
38
36
|
destroy.summary "Delete the certificate revocation list."
|
39
37
|
destroy.arguments "<dummy_text>"
|
40
38
|
destroy.returns "Nothing."
|
41
|
-
destroy.description <<-
|
39
|
+
destroy.description <<-EOT
|
42
40
|
Deletes the certificate revocation list. This cannot be done over REST, but
|
43
41
|
it is possible to delete the locally cached copy or the local CA's copy of
|
44
42
|
the CRL.
|