simp-beaker-helpers 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +8 -8
  2. data/lib/simp/beaker_helpers.rb +23 -6
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- OTk4ZmEwOTk2ODBkMDc5MDUwYThhNDE1OTZlNDllNDUxYWFjY2U4Zg==
4
+ YjliNTUyNTQzNzFkNjZkYWZlNjU2YTA3OGFjMWUyZGU3NWFiZGQ2Yw==
5
5
  data.tar.gz: !binary |-
6
- NmE3ZGZkNzg1ZDUxNjkzZjUzYjUzNDdmNTZmZTJkNzFhYTQ4OTc4Yw==
6
+ N2VlYzNjMGM3ZDMwZTk5Y2ZiOWE1OWJkODUyMzA1ODJmZjVlNDQwNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- N2IzYTU4NDlhOTBmZmEzZDZjYTQ5YjkxNDNiNWJmYjIzOWMxNjJkMGFmMTBj
10
- ODhkOTc1ZDk2NzdkZTNlMDllNmE4MmYyMDFlZTY0Njc1NjhiNWExNDcyMzg5
11
- MzFlNjllMjZlMzc5ZmU4MDA2Mjg0NjgzMjk0ZWQ3ZWI4M2IzNDQ=
9
+ NzU0ZjJmZTNlNmIwNzNlYzE4ZGE3YmFmZDc5MDUzMjIyMzE5M2JmNGUxMjJm
10
+ Zjc3MzU3NDhmZWYzYTJjMjA5ODc4MDJhYjUwYzAyMTA0NTNmOTYwM2IwYWQy
11
+ NzM4NWJmMjZjZTRmOWZmYzgwMDFjNzllOGVkOTA5ZjY4MTEwZDg=
12
12
  data.tar.gz: !binary |-
13
- ZjhkN2QwZTNiNjFhNDZlOGJhYmVkMzFmMThjNGZkNDcxOTJlNjUyNGYzYzhk
14
- MjE4NTdhODc5MmM0Y2EzMDU1MmRlMmVlMzNkZTdjY2NiODFiMGIyZGQ3N2Zi
15
- MTQyOGE1ZGQ3ODc5MjM1YmU5ZDcxNzRjOTFlYmJiNGQ5ZmU4NmY=
13
+ OTc5YTI3YjBmYTI4NjU5ODcxN2FlYTE5Y2Y2NGU2NjlhMzg2NTk0NWQ1NDRl
14
+ NTdmZmMzYjFiMjNiYmI2OTExZmE1ZTQ0Mjg2ZDIxYTdmZWVhZDBjYzMzMjUw
15
+ NDc5ZWJiYjEyN2M4NjA1NzM3OTA2Y2U4ZTRmNjI0YTM5ZjA1YTE=
@@ -1,7 +1,7 @@
1
1
  module Simp; end
2
2
 
3
3
  module Simp::BeakerHelpers
4
- VERSION = '1.2.0'
4
+ VERSION = '1.2.1'
5
5
 
6
6
  # use the `puppet fact` face to look up facts on an SUT
7
7
  def pfact_on(sut, fact_name)
@@ -230,10 +230,10 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
230
230
  puts "== Fake PKI CA"
231
231
  pki_dir = File.expand_path( "../../files/pki", File.dirname(__FILE__))
232
232
  host_dir = '/root/pki'
233
- fqdns = fact_on hosts, 'fqdn'
233
+ fqdns = fact_on(hosts, 'fqdn')
234
234
 
235
235
  on ca_sut, %Q(mkdir -p "#{host_dir}")
236
- Dir[ File.join(pki_dir, '*')].each {|f| scp_to( ca_sut, f, host_dir)}
236
+ Dir[ File.join(pki_dir, '*') ].each{|f| scp_to( ca_sut, f, host_dir)}
237
237
 
238
238
  # generate PKI certs for each SUT
239
239
  Dir.mktmpdir do |dir|
@@ -241,7 +241,7 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
241
241
  File.open(pki_hosts_file, 'w'){|fh| fqdns.each{|fqdn| fh.puts fqdn}}
242
242
  scp_to(ca_sut, pki_hosts_file, host_dir)
243
243
  # generate certs
244
- on ca_sut, "cd #{host_dir}; cat #{host_dir}/pki.hosts | xargs bash make.sh"
244
+ on(ca_sut, "cd #{host_dir}; cat #{host_dir}/pki.hosts | xargs bash make.sh")
245
245
  end
246
246
 
247
247
  # if a local_dir was provided, copy everything down to it
@@ -273,10 +273,27 @@ DEFAULT_KERNEL_TITLE=`/sbin/grubby --info=\\\${DEFAULT_KERNEL_INFO} | grep -m1 t
273
273
  scp_to(sut, "#{local_host_pki_tree}/#{fqdn}.pem", "#{sut_pki_dir}/private/")
274
274
  scp_to(sut, "#{local_host_pki_tree}/#{fqdn}.pub", "#{sut_pki_dir}/public/")
275
275
 
276
- # NOTE: to match pki::copy, 'cacert.pem' is renamed to 'cacerts.pem'
276
+ # NOTE: to match pki::copy, 'cacert.pem' is copied to 'cacerts.pem'
277
277
  scp_to(sut, local_cacert, "#{sut_pki_dir}/cacerts/cacerts.pem")
278
- end
279
278
 
279
+ # Need to hash all of the CA certificates so that apps can use them
280
+ # properly! This must happen on the host itself since it needs to match
281
+ # the native hashing algorithms.
282
+ hash_cmd = <<-EOM.strip
283
+ cd #{sut_pki_dir}/cacerts; \
284
+ for x in *; do \
285
+ if [ ! -h "$x" ]; then \
286
+ `openssl x509 -in $x >/dev/null 2>&1`; \
287
+ if [ $? -eq 0 ]; then \
288
+ hash=`openssl x509 -in $x -hash | head -1`; \
289
+ ln -sf $x $hash.0; \
290
+ fi; \
291
+ fi; \
292
+ done
293
+ EOM
294
+
295
+ on(sut, hash_cmd)
296
+ end
280
297
 
281
298
  # Copy a CA keydist/ directory of CA+host certs into an SUT
282
299
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simp-beaker-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Tessmer