Пример #1
0
    def runTest(self):
        sslUtil = SSLUtil()
        sslUtil.timeout = 10
		
        # Reset the test
        certificate = sslUtil.getServerCertificate('https://gecos.solutia-it.es:8443/')
        sslUtil.removeCertificateFromTrustedCAs(certificate)
        certificate = sslUtil.getServerCertificate('https://ws003.juntadeandalucia.es/')
        sslUtil.removeCertificateFromTrustedCAs(certificate)

        # Start the test
        SSLUtil.disableSSLCertificatesVerification()
   		self.assertFalse(SSLUtil.isSSLCertificatesVerificationEnabled())

   		self.assertFalse(SSLUtil.isSSLCertificatesVerificationEnabled())
Пример #2
0
    if (conf is not None and conf.has_key("chef")
            and conf["chef"].has_key("chef_server_uri")
            and not 'localhost' in conf["chef"]["chef_server_uri"]):
        chef_url = conf["chef"]["chef_server_uri"]
        logging.debug("chef_url retrieved from GECOS auto conf")

    if (conf is not None and conf.has_key("chef")
            and conf["chef"].has_key("chef_admin_name")):
        chef_admin_name = conf["chef"]["chef_admin_name"]
        logging.debug("chef_admin_name retrieved from GECOS auto conf")

    # Check Chef HTTPS certificate
    if chef_url.startswith('https://'):
        # Check server certificate
        sslUtil = SSLUtil()
        if not sslUtil.isServerCertificateTrusted(chef_url):
            if (
                sslUtil.getUntrustedCertificateErrorCode(chef_url) == \
                SSL_R_CERTIFICATE_VERIFY_FAILED
            ):
                # Error code SSL_R_CERTIFICATE_VERIFY_FAILED
                # means that the certificate is not trusted

                sslUtil.getUntrustedCertificateErrorCode(chef_url)
                certificate = sslUtil.getServerCertificate(chef_url)
                info = sslUtil.getCertificateInfo(certificate)

                # TODO: Disable certificate validation without asking
                SSLUtil.disableSSLCertificatesVerification()