Sha256: 6ffb687ccb465280c3b6997ec55443510ae32194eb95900874b957dfc46d2311
Contents?: true
Size: 890 Bytes
Versions: 3
Compression:
Stored size: 890 Bytes
Contents
#!/usr/bin/env ruby require 'tmpdir' host = 'freecluster-shard-00-00-oztdp.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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongo-2.18.3 | spec/support/certificates/retrieve-atlas-cert |
mongo-2.18.2 | spec/support/certificates/retrieve-atlas-cert |
mongo-2.18.1 | spec/support/certificates/retrieve-atlas-cert |