Sha256: e51556b3418811a2084429817b2eacbafb871695fee9633b524fe1f0457dd620
Contents?: true
Size: 712 Bytes
Versions: 1
Compression:
Stored size: 712 Bytes
Contents
require 'time' module Serverspec::Type class X509PrivateKey < Base def valid? runner_res = @runner.run_command("openssl rsa -in #{name} -check -noout") ( runner_res.exit_status == 0 && runner_res.stdout.chomp == 'RSA key ok' ) end def encrypted? @runner.run_command("grep -Ewq \"^(Proc-Type.*ENCRYPTED|-----BEGIN ENCRYPTED PRIVATE KEY-----)$\" #{name}").exit_status == 0 end def has_matching_certificate?(cert_file) h1 = @runner.run_command("openssl x509 -noout -modulus -in #{cert_file}") h2 = @runner.run_command("openssl rsa -noout -modulus -in #{name}") (h1.stdout == h2.stdout) && (h1.exit_status == 0) && (h2.exit_status == 0) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
serverspec-2.39.2 | lib/serverspec/type/x509_private_key.rb |