Skip to content
Snippets Groups Projects
Commit 216191beab43 authored by Kenneth Chu's avatar Kenneth Chu
Browse files

Use the openssl gem to find the key_size

parent 290ab7cfbe84
No related branches found
No related tags found
2 merge requests!51Validate shift of Heptapod 0.25 to oldstable series,!44GitLab 14.0
......@@ -22,8 +22,8 @@
helper = LetsEncryptHelper.new(node)
contact_info = helper.contact
staging_key = `/opt/gitlab/embedded/bin/openssl rsa -text -noout -in #{new_resource.key}-staging`
staging_key_size = staging_key.lines.grep(/Private.Key/i).first[/[0-9]* bit/].split.first.to_i
staging_key = OpenSSL::PKey::RSA.new ::File.read "#{new_resource.key}-staging"
staging_key_size = staging_key.to_text.split(/\n/).first[/[0-9]* bit/].split.first.to_i
if new_resource.key_size.nil?
unless staging_key_size == node['acme']['key_size']
......@@ -58,8 +58,8 @@
end
end
production_key = `/opt/gitlab/embedded/bin/openssl rsa -text -noout -in #{new_resource.key}`
production_key_size = production_key.lines.grep(/Private.Key/i).first[/[0-9]* bit/].split.first.to_i
production_key = OpenSSL::PKey::RSA.new ::File.read new_resource.key
production_key_size = production_key.to_text.split(/\n/).first[/[0-9]* bit/].split.first.to_i
if new_resource.key_size.nil?
unless production_key_size == node['acme']['key_size']
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment