@@ -0,0 +1,549 @@
+import socket%0Aimport logging%0A%0Afrom OpenSSL import SSL, crypto%0Aimport certifi%0A%0A%0Alog = logging.getLogger(__name__)%0A%0A%0Adef get_host_certificate(host, port=443):%0A  ip_addr = socket.gethostbyname(host)%0A  sock = socket.socket()%0A  context = SSL.Context(SSL.TLSv1_METHOD)%0A  context.set_options(SSL.OP_NO_SSLv2)%0A  context.load_verify_locations(certifi.where(), None)%0A  ssl_sock = SSL.Connection(context, sock)%0A  ssl_sock.connect((ip_addr, port))%0A  ssl_sock.do_handshake()%0A  return crypto.dump_certificate(crypto.FILETYPE_PEM, ssl_sock.get_peer_certificate())%0A

Add a simple client to fetch SSL certs from hosts.