I am currently trying to get the gssapi module for python to run on windows. My goal is to authenticate with an Active Directory using python module ldap3. gssapi is an requirement for this to work. However, installation fails because it cannot find krb5-config. On Linux it is easy to install. I installed Kerberos for Windows but it does not have krb5-config and I could not find it anywhere else (other than for Linux). Does anyone know where to find the required tools or how to continue (if it is possible at all)?
相关问题
- How does the setup bootstrapper detect if prerequi
- how to define constructor for Python's new Nam
- streaming md5sum of contents of a large remote tar
- How to get the background from multiple images by
- Evil ctypes hack in python
I couldn't get the
gssapi
module to install on Windows either, but I did manage to get theldap3
module to authenticate against Active Directory on Windows using code like this:Following the suggestion of @keithhendry (https://github.com/cannatag/ldap3/issues/190) I replaced the
kerberos.py
underldap3\protocol\sasl\
with this one.In order to use Windows' GSSAPI, you also need to install the winkerberos package and replace the kerberos import at line 15 in kerberos.py as follows:
This works transparently because winkerberos follows the same API structure as pykerberos, on which the edited kerberos.py was based.
Now you can use
authentication=SASL, sasl_mechanism=GSSAPI
when constructing theConnection
with ldap3 and everything should automagically work (assuming that the other 999 things that can go wrong with Kerberos don't go wrong).