|
|
|
@ -216,72 +216,6 @@ class CheckingClientHTTPSConnection(CheckingHTTPSConnection):
|
|
|
|
|
else:
|
|
|
|
|
print _("Certificate not added to trusted")
|
|
|
|
|
sys.exit()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#def add_ca_cert(self, cert, list_ca_certs, prev_host = None):
|
|
|
|
|
|
|
|
|
|
#certobj = OpenSSL.crypto.load_certificate \
|
|
|
|
|
#(OpenSSL.SSL.FILETYPE_PEM, cert)
|
|
|
|
|
|
|
|
|
|
#Issuer = certobj.get_issuer().get_components()
|
|
|
|
|
#for item in Issuer:
|
|
|
|
|
#if item[0] == 'L':
|
|
|
|
|
#print '\nNetwork adress : ', item[1]
|
|
|
|
|
#current_host = item[1]
|
|
|
|
|
##print prev_host, item[1]
|
|
|
|
|
|
|
|
|
|
#try:
|
|
|
|
|
#host, port = item[1].split(':')
|
|
|
|
|
#port = int(port)
|
|
|
|
|
#except:
|
|
|
|
|
#print _("Network adress must be host:port. port must be int")
|
|
|
|
|
#return 1
|
|
|
|
|
|
|
|
|
|
#try:
|
|
|
|
|
#ca_cert = ssl.get_server_certificate(addr = (host, port))
|
|
|
|
|
#except:
|
|
|
|
|
#print _("Connection aborted!")
|
|
|
|
|
#sys.exit()
|
|
|
|
|
|
|
|
|
|
#certobj = OpenSSL.crypto.load_certificate \
|
|
|
|
|
#(OpenSSL.SSL.FILETYPE_PEM, ca_cert)
|
|
|
|
|
#print _("\nFingerprint = %s") % certobj.digest('SHA1')
|
|
|
|
|
#print _("Serial Number = "), certobj.get_serial_number()
|
|
|
|
|
#Issuer = certobj.get_issuer().get_components()
|
|
|
|
|
#print _("\nIssuer")
|
|
|
|
|
#for i in Issuer:
|
|
|
|
|
#print "%s : %s" %(i[0], i[1])
|
|
|
|
|
#Subject = certobj.get_subject().get_components()
|
|
|
|
|
#print _("\nSubject")
|
|
|
|
|
#for subj in Subject:
|
|
|
|
|
#print "%s : %s" %(subj[0], subj[1])
|
|
|
|
|
|
|
|
|
|
#if prev_host == item[1]:
|
|
|
|
|
#'''
|
|
|
|
|
#получить корневой сертификат и проверить его на рутовость
|
|
|
|
|
#'''
|
|
|
|
|
|
|
|
|
|
#print _("\nThis is root certificate!")
|
|
|
|
|
#print _("Add all CA certificates to trusted?\n"
|
|
|
|
|
#"ATTENTION! It allows access to all those who "
|
|
|
|
|
#"signed these certificates.\n"
|
|
|
|
|
#"This may affect your safety!")
|
|
|
|
|
#ans = raw_input (_("Add all CA certificates to trusted? "
|
|
|
|
|
#"y/[n]:"))
|
|
|
|
|
#if ans.lower() in ['y','yes']:
|
|
|
|
|
#self.add_all_ca_cert(list_ca_certs)
|
|
|
|
|
#else:
|
|
|
|
|
#print _("Certificate not added to trusted")
|
|
|
|
|
#sys.exit()
|
|
|
|
|
|
|
|
|
|
#ans = raw_input (_("\nNext? y/[n]: "))
|
|
|
|
|
#if not ans.lower() in ['y','yes']:
|
|
|
|
|
#print _("Exit")
|
|
|
|
|
#sys.exit()
|
|
|
|
|
#list_ca_certs.append(ca_cert)
|
|
|
|
|
#self.add_ca_cert(cert, self.list_ca_certs, current_host)
|
|
|
|
|
|
|
|
|
|
#print _("In this certificate not found field 'L' (Network adress)")
|
|
|
|
|
|
|
|
|
|
# add certificate server in trusted
|
|
|
|
|
def add_server_cert(self, cert):
|
|
|
|
@ -421,7 +355,6 @@ class CheckingClientHTTPSConnection(CheckingHTTPSConnection):
|
|
|
|
|
add['certfile'] = self.cert_file
|
|
|
|
|
else:
|
|
|
|
|
wrap_class = ssl.SSLSocket
|
|
|
|
|
# print 'HHHHHHHHHHHHHHHHHHHHHH'
|
|
|
|
|
self.sock = wrap_class(sock, ca_certs=self.ca_certs, **add)
|
|
|
|
|
|
|
|
|
|
return 0
|
|
|
|
|