Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

Commit

Permalink
Merge pull request #622 from smortex/print-csr-fingerprint
Browse files Browse the repository at this point in the history
(#623) Print CSR fingerprint in request_cert application
  • Loading branch information
ripienaar authored Jun 14, 2020
2 parents 7571198 + a20c5ca commit 4fa2dda
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/mcollective/application/choria.rb
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ def request_cert_command
puts("Waiting up to 240 seconds for it to be signed")
puts

puts("Key fingerprint: %s" % choria.csr_fingerprint)
puts

24.times do |time|
print "Attempting to download certificate %s: %d / 24\r" % [certname, time]

Expand Down
9 changes: 9 additions & 0 deletions lib/mcollective/util/choria.rb
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,15 @@ def has_csr?
File.exist?(csr_path)
end

# The formatted string representation of the CSR fingerprint
#
# @return [String]
def csr_fingerprint
require "puppet"
csr = OpenSSL::X509::Request.new(File.read(csr_path))
Puppet::SSL::Digest.new(nil, csr.to_der)
end

# Searches the PATH for an executable command
#
# @param command [String] a command to search for
Expand Down

0 comments on commit 4fa2dda

Please sign in to comment.