[python-ldap] Is it possible to bind using a kerberos keytab

Kev SMITH kev.smith at uk.bnpparibas.com
Tue Dec 23 17:23:40 CET 2014


RH 6.5
Python 2.6.8
ldap 2.3.12

I am trying to bind to windows 2003 AD using a keytab - my code successfully initialises the keytab, the ldap options but I just can not seem to get the bind to work using a keytab.
Is this type of authentication supported?

>>

kinit = 'a path to kinit'
kinitopt = '-kt'
keytab = 'a path to a keytab'
svca = 'a windows account'

kinit_args = [ kinit, kinitopt, keytab, svca ]
#print ' '.join(kinit_args)

kinit = subprocess.Popen(kinit_args, stderr = subprocess.PIPE)
output,error = kinit.communicate()
if not kinit.returncode == 0:
    if error:
        print error.rstrip()
        sys.exit(kinit.returncode)

# I have a keytab loaded at this point

ad = ldap.initialize('ldap://mydomain.acme.com')
ad.protocol_version = 3
ad.set_option(ldap.OPT_REFERRALS, 0)
ad.set_option(ldap.OPT_DEBUG_LEVEL, 255)

ad.bind() <-------------------------------------- how to bind using the keytab at this point?

<<

Any pointers appreciated - thanks!

Kev.S



___________________________________________________________
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is prohibited.

Please refer to http://www.bnpparibas.co.uk/en/email-disclaimer/ for additional disclosures.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ldap/attachments/20141223/5ea868b0/attachment.html>


More information about the python-ldap mailing list