示例#1
0
 def _bind_external(self, authzid):
     if 'EXTERNALAUTH' not in self.cfg:
         self.skipTest("EXTERNAL authentication is not set.")
     if sys.platform == "win32":
         self.skipTest("Windows relies on set certs in its cert store.")
     tls_impl = bonsai.get_tls_impl_name()
     if tls_impl == "GnuTLS" or tls_impl == "OpenSSL":
         curdir = os.path.abspath(os.path.dirname(__file__))
         cert_path = os.path.join(curdir, 'testenv', 'certs')
         cli = LDAPClient(self.host, tls=True)
         cli.set_ca_cert(cert_path + '/cacert.pem')
         cli.set_client_cert(cert_path + '/client.pem')
         cli.set_client_key(cert_path + '/client.key')
         cli.set_credentials('EXTERNAL', (authzid,))
         try:
             conn = cli.connect()
         except (bonsai.errors.ConnectionError, \
                 bonsai.errors.AuthenticationError):
             self.fail()
         else:
             self.assertNotEqual("anonymous", conn.whoami(),
                                 "EXTERNAL authentication was"
                                 " unsuccessful.")
             return conn
     else:
         self.skipTest("")
示例#2
0
 def _bind_external(self, authzid):
     if 'EXTERNALAUTH' not in self.cfg:
         self.skipTest("EXTERNAL authentication is not set.")
     if sys.platform == "win32":
         self.skipTest("Windows relies on set certs in its cert store.")
     tls_impl = bonsai.get_tls_impl_name()
     if tls_impl == "GnuTLS" or tls_impl == "OpenSSL":
         curdir = os.path.abspath(os.path.dirname(__file__))
         cert_path = os.path.join(curdir, 'testenv', 'certs')
         cli = LDAPClient("ldap://%s" % self.cfg['SERVER']['hostname'],
                          tls=True)
         cli.set_ca_cert(cert_path + '/cacert.pem')
         cli.set_client_cert(cert_path + '/client.pem')
         cli.set_client_key(cert_path + '/client.key')
         cli.set_credentials('EXTERNAL', (authzid, ))
         try:
             conn = cli.connect()
         except (bonsai.errors.ConnectionError, \
                 bonsai.errors.AuthenticationError):
             self.fail()
         else:
             self.assertNotEqual(
                 "anonymous", conn.whoami(), "EXTERNAL authentication was"
                 " unsuccessful.")
             return conn
     else:
         self.skipTest("")
示例#3
0
 def _create_external(authzid=None):
     tls_impl = bonsai.get_tls_impl_name()
     if tls_impl == "GnuTLS" or tls_impl == "OpenSSL":
         cfg = get_config()
         curdir = os.path.abspath(os.path.dirname(__file__))
         cert_path = os.path.join(curdir, "testenv", "certs")
         host = "ldap://%s" % cfg["SERVER"]["hostname"]
         cli = LDAPClient(host, tls=True)
         cli.set_ca_cert(cert_path + "/cacert.pem")
         cli.set_client_cert(cert_path + "/client.pem")
         cli.set_client_key(cert_path + "/client.key")
         cli.set_credentials("EXTERNAL", authz_id=authzid)
         return cli.connect()
     else:
         pytest.skip("")
示例#4
0
 def _create_external(authzid=None):
     tls_impl = bonsai.get_tls_impl_name()
     if tls_impl == "GnuTLS" or tls_impl == "OpenSSL":
         cfg = get_config()
         curdir = os.path.abspath(os.path.dirname(__file__))
         cert_path = os.path.join(curdir, "testenv", "certs")
         host = "ldap://%s" % cfg["SERVER"]["hostname"]
         cli = LDAPClient(host, tls=True)
         cli.set_ca_cert(cert_path + "/cacert.pem")
         cli.set_client_cert(cert_path + "/client.pem")
         cli.set_client_key(cert_path + "/client.key")
         cli.set_credentials("EXTERNAL", authz_id=authzid)
         return cli.connect()
     else:
         pytest.skip("")
示例#5
0
def test_tls_impl_name():
    """ Test TLS implementation name. """
    tls_impl = bonsai.get_tls_impl_name()
    assert tls_impl in ("GnuTLS", "MozNSS", "OpenSSL", "SChannel")
示例#6
0
 def test_tls_impl_name(self):
     """ Test TLS implementation name. """
     tls_impl = bonsai.get_tls_impl_name()
     self.assertIn(tls_impl, ("GnuTLS", "MozNSS", "OpenSSL", "SChannel"))
示例#7
0
 def test_tls_impl_name(self):
     """ Test TLS implementation name. """
     tls_impl = bonsai.get_tls_impl_name()
     self.assertIn(tls_impl, ("GnuTLS", "MozNSS", "OpenSSL", "SChannel"))