Skip to content

Instantly share code, notes, and snippets.

@invalidusrname
Last active August 29, 2015 14:14
Show Gist options
  • Save invalidusrname/20f4f8d22fb45c97f730 to your computer and use it in GitHub Desktop.
Save invalidusrname/20f4f8d22fb45c97f730 to your computer and use it in GitHub Desktop.
Check certs
require 'net/https'
url = "https://www.google.com"
uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
http.start { |h| @cert = h.peer_cert }
@cert
@cert.not_after
(@cert.not_after - Time.now) / (60*60*24).to_i
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment