Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install GSSAPI Python module?

I am trying to install the GSSAPI module through pip but I receive this error that I don't know how to resolve.

Could not find main GSSAPI shared library. Please try setting GSSAPI_MAIN_LIB yourself or setting ENABLE_SUPPORT_DETECTION to 'false'

I need this to work on Python 2.6 for LDAP3 authentication.

like image 549
G3tinmybelly Avatar asked Jun 17 '15 15:06

G3tinmybelly


People also ask

What is Python Gssapi?

Python-GSSAPI is a Python binding to the Generic Security Service Application Program Interface (GSSAPI). The GSSAPI provides a uniform interface to security services which applications can use without having to worry about implementation details of the underlying mechanisms.


2 Answers

Summary, for the impatient

$ sudo ln -s /usr/bin/krb5-config.mit /usr/bin/krb5-config
$ sudo ln -s /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 /usr/lib/libgssapi_krb5.so
$ sudo apt-get install python-pip libkrb5-dev
$ sudo pip install gssapi

And now the details...

I have a Debian system that uses Heimdal Kerberos. I'll take you through what I had to do to get it working for me. Hopefully, this can help someone else as well.


Problem 1 - krb5-config: command not found

setup.py for gssapi uses the krb5-config command to find the GSSAPI library to link against (see here). Because my system was installed using Heimdal instead of MIT Kerberos, the executable command has been renamed to krb5-config.mit so setup.py misses it.

$ krb5-config --libs gssapi  # doesn't work
bash: krb5-config: command not found

I created a symlink to get it to work for the install:

$ sudo ln -s /usr/bin/krb5-config.mit /usr/bin/krb5-config
$ krb5-config --libs gssapi  # does work
-L/usr/lib/x86_64-linux-gnu/mit-krb5 -Wl,-z,relro -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err

Problem 2 - libgssapi_krb5.so: cannot open shared object file: No such file or directory

setup.py is looking in /usr/lib for the gssapi library to link against. In Debian Jesse, most libs are now kept in /usr/lib/x86_64-linux-gnu. Again, a symlink can fix this:

$ sudo ln -s /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 /usr/lib/libgssapi_krb5.so

Problem 3 - error: unknown type name ‘gss_key_value_set_desc’

The build fails because it does not recognize a symbol in the library. The reason for this is that it was not able to get the right header file. Silly me, I forgot to include the -dev package for krb5 headers. Fix this with apt-get:

$ sudo apt-get install libkrb5-dev

Finally - Install gssapi

Now we should be all ready to go.

$ sudo pip install gssapi

If you want to tidy up, you can remove the symlink to the krb5-config.mit command:

$ sudo rm /usr/bin/krb5-config
like image 195
Dave Avatar answered Sep 19 '22 13:09

Dave


sudo apt install libkrb5-dev actually installs /usr/bin/krb5-config and /usr/lib/libgssapi_krb5.so

so none of the symlinking was needed, just install libkrb5-dev and you should be good.

like image 45
Jens Timmerman Avatar answered Sep 19 '22 13:09

Jens Timmerman