Sha256: de7ac5215fd691d01fb8a72dc997711393e0a6b1fabaa091e2ea8e106458652e
Contents?: true
Size: 940 Bytes
Versions: 2
Compression:
Stored size: 940 Bytes
Contents
#!/usr/bin/env ruby # frozen_string_literal: true # rubocop:todo all require 'tmpdir' host = 'ac-ulwcmzm-shard-00-00.g6fyiaq.mongodb-dev.net' output = `openssl s_client -showcerts -servername #{host} -connect #{host}:27017 </dev/null` if output.empty? raise 'Something bad happened' end certs = output.scan(/(-----BEGIN CERTIFICATE(.|\n)+?END CERTIFICATE-----)/) cert, ca_cert = certs.map { |g| g.first } Dir.mktmpdir do |path| cert_path = File.join(path, 'cert.pem') File.open(cert_path, 'w') do |f| f << cert end output = `openssl x509 -noout -text -in #{cert_path}` File.open('atlas-ocsp.crt', 'w') do |f| f << output f << "\n" f << cert end cert_path = File.join(path, 'cert.pem') File.open(cert_path, 'w') do |f| f << ca_cert end output = `openssl x509 -noout -text -in #{cert_path}` File.open('atlas-ocsp-ca.crt', 'w') do |f| f << output f << "\n" f << ca_cert end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mongo-2.21.0 | spec/support/certificates/retrieve-atlas-cert |
mongo-2.20.1 | spec/support/certificates/retrieve-atlas-cert |