我正在使用 google api 与我的活动目录 2008 进行通信。这是 tutorial1 的示例代码。
from ad import Client, Creds, activate
domain = 'freeadi.org'
user = 'Administrator'
password = 'Pass123'
creds = Creds(domain)
creds.acquire(user, password)
activate(creds)
client = Client(domain)
users = client.search('(objectClass=user)')
for dn,attrs in users:
name = attrs['sAMAccountName'][0]
print '-> %s' % name
但我收到以下错误。
ldap.LOCAL_ERROR: {'info': 'SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Server not found in Kerberos database)', 'desc': 'Local error'}
. 这是来自http://code.google.com/p/python-ad/wiki/TutorialOne的示例代码。我已根据需要更改了用户名和密码。
嗨,感谢您的回复,但我仍然卡住了。我与 centrifydc 一起加入我的广告。但是当我运行代码时,我的日志文件给了我一些奇怪的日志,我真的不知道,因为我对这个话题很陌生。这是我的日志文件的输出:
Jun 28 19:22:02 sdahal1 sudo: pam_unix(sudo:session): session closed for user root
Jun 28 19:24:24 sdahal1 sshd13724?: Connection closed by 192.168.0.113 preauth?
Jun 28 19:24:54 sdahal1 adclient998?: INFO <fd:19 PAMVerifyPassword> audit User 'sadahal' authenticated based on Kerberos exchange to AD
Jun 28 19:24:54 sdahal1 adclient998?: INFO <fd:19 PAMIsUserAllowedAccess> audit User 'sadahal' is authorized
Jun 28 19:27:56 sdahal1 sudo: pam_unix(sudo:session): session closed for user root
Jun 28 19:28:04 sdahal1 python: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Server not found in Kerberos database)
Jun 28 19:28:17 sdahal1 adclient998?: INFO <fd:19 PAMVerifyPassword> audit User 'sadahal' authenticated based on Kerberos exchange to AD
Jun 28 19:28:17 sdahal1 adclient998?: INFO <fd:23 PAMIsUserAllowedAccess> audit User 'sadahal' is authorized
Jun 28 19:28:17 sdahal1 sudo: