コード例 #1
0
ファイル: test_authLdap.py プロジェクト: shenjinian/dnscherry
 def testConnectSSL(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:636'
     cfg2['checkcert'] = 'on'
     inv = Auth(cfg2, cherrypy.log)
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
コード例 #2
0
ファイル: test_authLdap.py プロジェクト: kakwa/dnscherry
 def testConnectSSL(self):
     cfg2 = cfg.copy()
     cfg2["uri"] = "ldaps://ldap.dnscherry.org:636"
     cfg2["checkcert"] = "on"
     inv = Auth(cfg2, cherrypy.log)
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
コード例 #3
0
ファイル: test_authLdap.py プロジェクト: kakwa/dnscherry
 def testConnectStartTLS(self):
     cfg2 = cfg.copy()
     cfg2["uri"] = "ldap://ldap.dnscherry.org:390"
     cfg2["checkcert"] = "off"
     cfg2["starttls"] = "on"
     cfg2["ca"] = "./test/cfg/ca.crt"
     inv = Auth(cfg2, cherrypy.log)
     ldapc = inv._connect()
     ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
コード例 #4
0
ファイル: test_authLdap.py プロジェクト: shenjinian/dnscherry
 def testConnectStartTLS(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldap://ldap.dnscherry.org:390'
     cfg2['checkcert'] = 'off'
     cfg2['starttls'] = 'on'
     cfg2['ca'] = './test/cfg/ca.crt'
     inv = Auth(cfg2, cherrypy.log)
     ldapc = inv._connect()
     ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
コード例 #5
0
ファイル: test_authLdap.py プロジェクト: kakwa/dnscherry
 def testConnectSSLWrongCA(self):
     cfg2 = cfg.copy()
     cfg2["uri"] = "ldaps://ldap.dnscherry.org:636"
     cfg2["checkcert"] = "on"
     inv = Auth(cfg2, cherrypy.log)
     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"
コード例 #6
0
ファイル: test_authLdap.py プロジェクト: kakwa/dnscherry
 def testMissingCA(self):
     cfg2 = cfg.copy()
     cfg2["uri"] = "ldaps://ldap.dnscherry.org:636"
     cfg2["checkcert"] = "on"
     cfg2["ca"] = "./test/cfg/not_a_ca.crt"
     try:
         inv = Auth(cfg2, cherrypy.log)
         ldapc = inv._connect()
     except CaFileDontExist as e:
         return
コード例 #7
0
ファイル: test_authLdap.py プロジェクト: kakwa/dnscherry
 def testLdapUnavaible(self):
     cfg2 = cfg.copy()
     cfg2["uri"] = "ldaps://notaldap:636"
     cfg2["checkcert"] = "on"
     inv = Auth(cfg2, cherrypy.log)
     try:
         ldapc = inv._connect()
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         return
コード例 #8
0
ファイル: test_authLdap.py プロジェクト: shenjinian/dnscherry
 def testMissingCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:636'
     cfg2['checkcert'] = 'on'
     cfg2['ca'] = './test/cfg/not_a_ca.crt'
     try:
         inv = Auth(cfg2, cherrypy.log)
         ldapc = inv._connect()
     except CaFileDontExist as e:
         return
コード例 #9
0
ファイル: test_authLdap.py プロジェクト: shenjinian/dnscherry
 def testLdapUnavaible(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://notaldap:636'
     cfg2['checkcert'] = 'on'
     inv = Auth(cfg2, cherrypy.log)
     try:
         ldapc = inv._connect()
         ldapc.simple_bind_s(inv.binddn, inv.bindpassword)
     except ldap.SERVER_DOWN as e:
         return
コード例 #10
0
ファイル: test_authLdap.py プロジェクト: shenjinian/dnscherry
 def testConnectSSLWrongCA(self):
     cfg2 = cfg.copy()
     cfg2['uri'] = 'ldaps://ldap.dnscherry.org:636'
     cfg2['checkcert'] = 'on'
     inv = Auth(cfg2, cherrypy.log)
     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'
コード例 #11
0
ファイル: test_authLdap.py プロジェクト: kakwa/dnscherry
 def testConnect(self):
     inv = Auth(cfg, cherrypy.log)
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
     return True
コード例 #12
0
ファイル: test_authLdap.py プロジェクト: shenjinian/dnscherry
 def testConnect(self):
     inv = Auth(cfg, cherrypy.log)
     ldap = inv._connect()
     ldap.simple_bind_s(inv.binddn, inv.bindpassword)
     return True