puppetserver-ca 1.9.4 → 1.9.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ca072b9b538db717c0a026483b7e737633a3f95199ddd027eaf2ab54f7154914
4
- data.tar.gz: 683da993f6f520a1b410699ccfb12a07b6fb294c66f5ea3842dd926de3302d3d
3
+ metadata.gz: d907539ea4170d92955b59cbad8e69bd117df6ee738949dcf8818c23edae7aad
4
+ data.tar.gz: 7965fe3863162e3c20283a89b8948eace64e7f8eb2cf04dfac1c0d167307f94c
5
5
  SHA512:
6
- metadata.gz: 28967be755677708b09d944ff1998d75f42ca83fcd095a1339fdb4f33f48f55100a17c2dfc978ea0ec89c8ab31ece4e84c5be683cf4c06f16d0e344d9e9534fb
7
- data.tar.gz: c83637fb867960f1bff097bbab00b826cbaf57f605fe42ef0aa79d0f8abeb56327ba538c409e734e181c8ba38ebf12e5b82054b5f2e1ef1b38427fd1e760372c
6
+ metadata.gz: 2f12272a7f293b09728b12b36ccea266953173e7fbea9b8453436a0d02e48a8d8f886ee878cc63d61c7d7ce936ce110da3a2031b59de62d9de3ecaf4adce1b03
7
+ data.tar.gz: db2c0c6e621ca2a4e8284e608105e03e546a60cbda0df1421e5d3f2044ba8561a6b7e6aba9da6949f0cf54058a15db22faaafe1d2c10c0dd59f45a15d438da0e
data/README.md CHANGED
@@ -61,7 +61,7 @@ puppetserver ca --help
61
61
  ```
62
62
 
63
63
  This code in this project is licensed under the Apache Software License v2,
64
- please see the included [License](https://github.com/puppetlabs/puppetserver-ca-cli/blob/master/LICENSE.md)
64
+ please see the included [License](https://github.com/puppetlabs/puppetserver-ca-cli/blob/main/LICENSE.md)
65
65
  for more details.
66
66
 
67
67
 
@@ -105,9 +105,9 @@ Freenode, or the Puppet Community Slack channel.
105
105
 
106
106
  Contributions are welcome at https://github.com/puppetlabs/puppetserver-ca-cli/pulls.
107
107
  Contributors should both be sure to read the
108
- [contributing document](https://github.com/puppetlabs/puppetserver-ca-cli/blob/master/CONTRIBUTING.md)
108
+ [contributing document](https://github.com/puppetlabs/puppetserver-ca-cli/blob/main/CONTRIBUTING.md)
109
109
  and sign the [contributor license agreement](https://cla.puppet.com/).
110
110
 
111
111
  Everyone interacting with the project’s codebase, issue tracker, etc is expected
112
112
  to follow the
113
- [code of conduct](https://github.com/puppetlabs/puppetserver-ca-cli/blob/master/CODE_OF_CONDUCT.md).
113
+ [code of conduct](https://github.com/puppetlabs/puppetserver-ca-cli/blob/main/CODE_OF_CONDUCT.md).
@@ -14,7 +14,7 @@ module Puppetserver
14
14
 
15
15
  include Puppetserver::Ca::Utils
16
16
 
17
- CERTNAME_BLACKLIST = %w{--all --config}
17
+ CERTNAME_BLOCKLIST = %w{--all --config}
18
18
 
19
19
  SUMMARY = 'Revoke cert(s) and remove related files from CA'
20
20
  BANNER = <<-BANNER
@@ -59,7 +59,7 @@ BANNER
59
59
  errors = CliParsing.parse_with_errors(parser, args)
60
60
 
61
61
  results['certnames'].each do |certname|
62
- if CERTNAME_BLACKLIST.include?(certname)
62
+ if CERTNAME_BLOCKLIST.include?(certname)
63
63
  errors << " Cannot manage cert named `#{certname}` from " +
64
64
  "the CLI, if needed use the HTTP API directly"
65
65
  end
@@ -18,7 +18,7 @@ module Puppetserver
18
18
 
19
19
  # Only allow printing ascii characters, excluding /
20
20
  VALID_CERTNAME = /\A[ -.0-~]+\Z/
21
- CERTNAME_BLACKLIST = %w{--all --config}
21
+ CERTNAME_BLOCKLIST = %w{--all --config}
22
22
 
23
23
  SUMMARY = "Generate a new certificate signed by the CA"
24
24
  BANNER = <<-BANNER
@@ -35,7 +35,7 @@ Description:
35
35
  If the `--ca-client` flag is passed, the cert will be generated
36
36
  offline, without using Puppet Server's signing code, and will add
37
37
  a special extension authorizing it to talk to the CA API. This can
38
- be used for regenerating the master's host cert, or for manually
38
+ be used for regenerating the server's host cert, or for manually
39
39
  setting up other nodes to be CA clients. Do not distribute certs
40
40
  generated this way to any node that you do not intend to have
41
41
  administrative access to the CA (e.g. the ability to sign a cert).
@@ -91,7 +91,7 @@ BANNER
91
91
  errors << ' At least one certname is required to generate'
92
92
  else
93
93
  results['certnames'].each do |certname|
94
- if CERTNAME_BLACKLIST.include?(certname)
94
+ if CERTNAME_BLOCKLIST.include?(certname)
95
95
  errors << " Cannot manage cert named `#{certname}` from " +
96
96
  "the CLI, if needed use the HTTP API directly"
97
97
  end
@@ -14,7 +14,7 @@ module Puppetserver
14
14
  class Import
15
15
  include Puppetserver::Ca::Utils
16
16
 
17
- SUMMARY = "Import an external CA chain and generate master PKI"
17
+ SUMMARY = "Import an external CA chain and generate server PKI"
18
18
  BANNER = <<-BANNER
19
19
  Usage:
20
20
  puppetserver ca import [--help]
@@ -72,7 +72,7 @@ BANNER
72
72
  def import(loader, settings, signing_digest)
73
73
  ca = Puppetserver::Ca::LocalCertificateAuthority.new(signing_digest, settings)
74
74
  ca.initialize_ssl_components(loader)
75
- master_key, master_cert = ca.create_master_cert
75
+ server_key, server_cert = ca.create_server_cert
76
76
  return ca.errors if ca.errors.any?
77
77
 
78
78
  FileSystem.ensure_dirs([settings[:ssldir],
@@ -88,25 +88,25 @@ BANNER
88
88
  [settings[:cadir] + '/infra_crl.pem', loader.crls],
89
89
  [settings[:localcacert], loader.certs],
90
90
  [settings[:hostcrl], loader.crls],
91
- [settings[:hostpubkey], master_key.public_key],
92
- [settings[:hostcert], master_cert],
93
- [settings[:cert_inventory], ca.inventory_entry(master_cert)],
91
+ [settings[:hostpubkey], server_key.public_key],
92
+ [settings[:hostcert], server_cert],
93
+ [settings[:cert_inventory], ca.inventory_entry(server_cert)],
94
94
  [settings[:capub], loader.key.public_key],
95
95
  [settings[:cadir] + '/infra_inventory.txt', ''],
96
96
  [settings[:cadir] + '/infra_serials', ''],
97
97
  [settings[:serial], "002"],
98
- [File.join(settings[:signeddir], "#{settings[:certname]}.pem"), master_cert]
98
+ [File.join(settings[:signeddir], "#{settings[:certname]}.pem"), server_cert]
99
99
  ]
100
100
 
101
101
  private_files = [
102
- [settings[:hostprivkey], master_key],
102
+ [settings[:hostprivkey], server_key],
103
103
  [settings[:cakey], loader.key],
104
104
  ]
105
105
 
106
106
  files_to_check = public_files + private_files
107
- # We don't want to error if master's keys exist. Certain workflows
107
+ # We don't want to error if server's keys exist. Certain workflows
108
108
  # allow the agent to have already be installed with keys and then
109
- # upgraded to be a master. The host class will honor keys, if both
109
+ # upgraded to be a server. The host class will honor keys, if both
110
110
  # public and private exist, and error if only one exists - as is
111
111
  # previous behavior.
112
112
  files_to_check = files_to_check.map(&:first) - [settings[:hostpubkey], settings[:hostprivkey]]
@@ -178,11 +178,11 @@ ERR
178
178
  parsed['crl-chain'] = chain
179
179
  end
180
180
  opts.on('--certname NAME',
181
- 'Common name to use for the master cert') do |name|
181
+ 'Common name to use for the server cert') do |name|
182
182
  parsed['certname'] = name
183
183
  end
184
184
  opts.on('--subject-alt-names NAME[,NAME]',
185
- 'Subject alternative names for the master cert') do |sans|
185
+ 'Subject alternative names for the server cert') do |sans|
186
186
  parsed['subject-alt-names'] = sans
187
187
  end
188
188
  end
@@ -12,7 +12,7 @@ module Puppetserver
12
12
 
13
13
  include Puppetserver::Ca::Utils
14
14
 
15
- CERTNAME_BLACKLIST = %w{--all --config}
15
+ CERTNAME_BLOCKLIST = %w{--all --config}
16
16
 
17
17
  SUMMARY = 'Revoke certificate(s)'
18
18
  BANNER = <<-BANNER
@@ -55,7 +55,7 @@ BANNER
55
55
  errors = CliParsing.parse_with_errors(parser, args)
56
56
 
57
57
  results['certnames'].each do |certname|
58
- if CERTNAME_BLACKLIST.include?(certname)
58
+ if CERTNAME_BLOCKLIST.include?(certname)
59
59
  errors << " Cannot manage cert named `#{certname}` from " +
60
60
  "the CLI, if needed use the HTTP API directly"
61
61
  end
@@ -23,10 +23,10 @@ Usage:
23
23
  Description:
24
24
  Setup a root and intermediate signing CA for Puppet Server
25
25
  and store generated CA keys, certs, crls, and associated
26
- master related files on disk.
26
+ server related files on disk.
27
27
 
28
28
  The `--subject-alt-names` flag can be used to add SANs to the
29
- certificate generated for the Puppet master. Multiple names can be
29
+ certificate generated for the Puppet server. Multiple names can be
30
30
  listed as a comma separated string. These can be either DNS names or
31
31
  IP addresses, differentiated by prefixes: `DNS:foo.bar.com,IP:123.456.789`.
32
32
  Names with no prefix will be treated as DNS names.
@@ -76,7 +76,7 @@ BANNER
76
76
 
77
77
  root_key, root_cert, root_crl = ca.create_root_cert
78
78
  ca.create_intermediate_cert(root_key, root_cert)
79
- master_key, master_cert = ca.create_master_cert
79
+ server_key, server_cert = ca.create_server_cert
80
80
  return ca.errors if ca.errors.any?
81
81
 
82
82
  FileSystem.ensure_dirs([settings[:ssldir],
@@ -90,28 +90,28 @@ BANNER
90
90
  [settings[:cacert], [ca.cert, root_cert]],
91
91
  [settings[:cacrl], [ca.crl, root_crl]],
92
92
  [settings[:cadir] + '/infra_crl.pem', [ca.crl, root_crl]],
93
- [settings[:hostcert], master_cert],
93
+ [settings[:hostcert], server_cert],
94
94
  [settings[:localcacert], [ca.cert, root_cert]],
95
95
  [settings[:hostcrl], [ca.crl, root_crl]],
96
- [settings[:hostpubkey], master_key.public_key],
96
+ [settings[:hostpubkey], server_key.public_key],
97
97
  [settings[:capub], ca.key.public_key],
98
- [settings[:cert_inventory], ca.inventory_entry(master_cert)],
98
+ [settings[:cert_inventory], ca.inventory_entry(server_cert)],
99
99
  [settings[:cadir] + '/infra_inventory.txt', ''],
100
100
  [settings[:cadir] + '/infra_serials', ''],
101
101
  [settings[:serial], "002"],
102
- [File.join(settings[:signeddir], "#{settings[:certname]}.pem"), master_cert],
102
+ [File.join(settings[:signeddir], "#{settings[:certname]}.pem"), server_cert],
103
103
  ]
104
104
 
105
105
  private_files = [
106
- [settings[:hostprivkey], master_key],
106
+ [settings[:hostprivkey], server_key],
107
107
  [settings[:rootkey], root_key],
108
108
  [settings[:cakey], ca.key],
109
109
  ]
110
110
 
111
111
  files_to_check = public_files + private_files
112
- # We don't want to error if master's keys exist. Certain workflows
112
+ # We don't want to error if server's keys exist. Certain workflows
113
113
  # allow the agent to have already be installed with keys and then
114
- # upgraded to be a master. The host class will honor keys, if both
114
+ # upgraded to be a server. The host class will honor keys, if both
115
115
  # public and private exist, and error if only one exists - as is
116
116
  # previous behavior.
117
117
  files_to_check = files_to_check.map(&:first) - [settings[:hostpubkey], settings[:hostprivkey]]
@@ -160,7 +160,7 @@ ERR
160
160
  parsed['config'] = conf
161
161
  end
162
162
  opts.on('--subject-alt-names NAME[,NAME]',
163
- 'Subject alternative names for the master cert') do |sans|
163
+ 'Subject alternative names for the server cert') do |sans|
164
164
  parsed['subject-alt-names'] = sans
165
165
  end
166
166
  opts.on('--ca-name NAME',
@@ -168,7 +168,7 @@ ERR
168
168
  parsed['ca-name'] = name
169
169
  end
170
170
  opts.on('--certname NAME',
171
- 'Common name to use for the master cert') do |name|
171
+ 'Common name to use for the server cert') do |name|
172
172
  parsed['certname'] = name
173
173
  end
174
174
  end
@@ -74,6 +74,9 @@ module Puppetserver
74
74
 
75
75
  overrides = results[:agent].merge(results[:main]).merge(results[:master]).merge(results[:server])
76
76
  overrides.merge!(cli_overrides)
77
+ if overrides[:masterport]
78
+ overrides[:serverport] ||= overrides.delete(:masterport)
79
+ end
77
80
 
78
81
  @settings = resolve_settings(overrides).freeze
79
82
  end
@@ -108,7 +111,7 @@ module Puppetserver
108
111
  [:certdir, '$ssldir/certs'],
109
112
  [:certname, default_certname],
110
113
  [:server, 'puppet'],
111
- [:masterport, '8140'],
114
+ [:serverport, '8140'],
112
115
  [:privatekeydir, '$ssldir/private_keys'],
113
116
  [:publickeydir, '$ssldir/public_keys'],
114
117
  ]
@@ -126,7 +129,7 @@ module Puppetserver
126
129
  :serial => '$cadir/serial',
127
130
  :cert_inventory => '$cadir/inventory.txt',
128
131
  :ca_server => '$server',
129
- :ca_port => '$masterport',
132
+ :ca_port => '$serverport',
130
133
  :localcacert => '$certdir/ca.pem',
131
134
  :hostcrl => '$ssldir/crl.pem',
132
135
  :hostcert => '$certdir/$certname.pem',
@@ -276,7 +279,7 @@ module Puppetserver
276
279
  end
277
280
 
278
281
  if settings.dig(:server_list, 0, 1) &&
279
- settings[:ca_port] == '$masterport'
282
+ settings[:ca_port] == '$serverport'
280
283
 
281
284
  settings[:ca_port] = settings.dig(:server_list, 0, 1)
282
285
  end
@@ -58,10 +58,10 @@ module Puppetserver
58
58
  @errors = []
59
59
  end
60
60
 
61
- # If both the private and public keys exist for a master then we want
61
+ # If both the private and public keys exist for a server then we want
62
62
  # to honor them here, if only one key exists we want to surface an error,
63
63
  # and if neither exist we generate a new key. This logic is necessary for
64
- # proper bootstrapping for certain master workflows.
64
+ # proper bootstrapping for certain server workflows.
65
65
  def create_private_key(keylength, private_path = '', public_path = '')
66
66
  if File.exists?(private_path) && File.exists?(public_path)
67
67
  return OpenSSL::PKey.read(File.read(private_path))
@@ -20,7 +20,7 @@ module Puppetserver
20
20
 
21
21
  CLI_AUTH_EXT_OID = "1.3.6.1.4.1.34380.1.3.39"
22
22
 
23
- MASTER_EXTENSIONS = [
23
+ SERVER_EXTENSIONS = [
24
24
  ["basicConstraints", "CA:FALSE", true],
25
25
  ["nsComment", "Puppet Server Internal Certificate", false],
26
26
  ["authorityKeyIdentifier", "keyid:always", false],
@@ -132,23 +132,23 @@ module Puppetserver
132
132
  time.strftime('%Y-%m-%dT%H:%M:%S%Z')
133
133
  end
134
134
 
135
- def create_master_cert
136
- master_cert = nil
137
- master_key = @host.create_private_key(@settings[:keylength],
135
+ def create_server_cert
136
+ server_cert = nil
137
+ server_key = @host.create_private_key(@settings[:keylength],
138
138
  @settings[:hostprivkey],
139
139
  @settings[:hostpubkey])
140
- if master_key
141
- master_csr = @host.create_csr(name: @settings[:certname], key: master_key)
140
+ if server_key
141
+ server_csr = @host.create_csr(name: @settings[:certname], key: server_key)
142
142
  if @settings[:subject_alt_names].empty?
143
143
  alt_names = "DNS:puppet, DNS:#{@settings[:certname]}"
144
144
  else
145
145
  alt_names = @settings[:subject_alt_names]
146
146
  end
147
147
 
148
- master_cert = sign_authorized_cert(master_csr, alt_names)
148
+ server_cert = sign_authorized_cert(server_csr, alt_names)
149
149
  end
150
150
 
151
- return master_key, master_cert
151
+ return server_key, server_cert
152
152
  end
153
153
 
154
154
  def sign_authorized_cert(csr, alt_names = '')
@@ -176,7 +176,7 @@ module Puppetserver
176
176
  end
177
177
 
178
178
  def add_authorized_extensions(cert, ef)
179
- MASTER_EXTENSIONS.each do |ext|
179
+ SERVER_EXTENSIONS.each do |ext|
180
180
  extension = ef.create_extension(*ext)
181
181
  cert.add_extension(extension)
182
182
  end
@@ -166,7 +166,7 @@ module Puppetserver
166
166
  def self.check_server_online(settings, logger)
167
167
  status_url = URL.new('https', settings[:ca_server], settings[:ca_port], 'status', 'v1', 'simple', 'ca')
168
168
  begin
169
- # Generating certs offline is necessary if the master cert has been destroyed
169
+ # Generating certs offline is necessary if the server cert has been destroyed
170
170
  # or compromised. Since querying the status endpoint does not require a client cert, and
171
171
  # we commonly won't have one, don't require one for creating the connection.
172
172
  # Additionally, we want to ensure the server is stopped before migrating the CA dir to
@@ -1,5 +1,5 @@
1
1
  module Puppetserver
2
2
  module Ca
3
- VERSION = "1.9.4"
3
+ VERSION = "1.9.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetserver-ca
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.4
4
+ version: 1.9.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet, Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-04-15 00:00:00.000000000 Z
11
+ date: 2021-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: facter