Esempio n. 1
0
 def testConnectSSL(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
Esempio n. 2
0
 def testConnectSSL(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
Esempio n. 3
0
 def testConnectStartTLS(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldap://ldap.ldapcherry.org:390'
     cfg2['checkcert'] = 'off'
     cfg2['starttls'] = 'on'
     cfg2['ca'] = './test/cfg/ca.crt'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldapc = inv._connect()
     ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
Esempio n. 4
0
 def testConnectStartTLS(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldap://ldap.ldapcherry.org:390'
     cfg2['checkcert'] = 'off'
     cfg2['starttls'] = 'on'
     cfg2['ca'] = './test/cfg/ca.crt'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldapc = inv._connect()
     ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
Esempio n. 5
0
 def testMissingCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:637'
     cfg2['checkcert'] = 'on'
     cfg2['ca'] = './test/cfg/not_a_ca.crt'
     try:
         inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
         ldapc = inv._connect()
     except CaFileDontExist as e:
         return
     else:
         raise AssertionError("expected an exception")
Esempio n. 6
0
 def testLdapUnavaible(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://notaldap:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     try:
         ldapc = inv._connect()
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         return
     else:
         raise AssertionError("expected an exception")
Esempio n. 7
0
 def testConnectSSLWrongCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.ldapcherry.org:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldapc = inv._connect()
     try:
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         assert e[0]['info'] == 'TLS: hostname does not match CN in peer certificate'
     else:
         raise AssertionError("expected an exception")
Esempio n. 8
0
 def testConnectSSLWrongCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.ldapcherry.org:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     ldapc = inv._connect()
     try:
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         assert e[0]['info'] == 'TLS: hostname does not match CN in peer certificate'
     else:
         raise AssertionError("expected an exception")
Esempio n. 9
0
 def testMissingCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:637'
     cfg2['checkcert'] = 'on'
     cfg2['ca'] = './test/cfg/not_a_ca.crt'
     try:
         inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
         ldapc = inv._connect()
     except CaFileDontExist as e:
         return
     else:
         raise AssertionError("expected an exception")
Esempio n. 10
0
 def testLdapUnavaible(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://notaldap:637'
     cfg2['checkcert'] = 'on'
     inv = Backend(cfg2, cherrypy.log, 'ldap', attr, 'uid')
     try:
         ldapc = inv._connect()
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         return
     else:
         raise AssertionError("expected an exception")
Esempio n. 11
0
 def testConnect(self):
     inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
     return True
Esempio n. 12
0
 def testConnect(self):
     inv = Backend(cfg, cherrypy.log, 'ldap', attr, 'uid')
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
     return True