简体   繁体   English

如何安装 GSSAPI Python 模块?

[英]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.我正在尝试通过 pip 安装 GSSAPI 模块,但收到此错误,我不知道如何解决。

Could not find main GSSAPI shared library.找不到主要的 GSSAPI 共享库。 Please try setting GSSAPI_MAIN_LIB yourself or setting ENABLE_SUPPORT_DETECTION to 'false'请尝试自己设置 GSSAPI_MAIN_LIB 或将 ENABLE_SUPPORT_DETECTION 设置为 'false'

I need this to work on Python 2.6 for LDAP3 authentication.我需要它在 Python 2.6 上工作以进行 LDAP3 身份验证。

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.我有一个使用 Heimdal Kerberos 的 Debian 系统。 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问题 1 - krb5-config:找不到命令

setup.py for gssapi uses the krb5-config command to find the GSSAPI library to link against (see here ). gssapi 的setup.py使用krb5-config命令查找要链接的 GSSAPI 库(请参阅此处)。 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.因为我的系统是使用 Heimdal 而不是 MIT Kerberos 安装的,可执行命令已重命名为krb5-config.mit因此setup.py错过了它。

$ 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问题 2 - libgssapi_krb5.so:无法打开共享对象文件:没有这样的文件或目录

setup.py is looking in /usr/lib for the gssapi library to link against. setup.py正在/usr/lib中查找要链接的 gssapi 库。 In Debian Jesse, most libs are now kept in /usr/lib/x86_64-linux-gnu .在 Debian Jesse 中,大多数库现在保存在/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'问题 3 - 错误:未知类型名称 '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.愚蠢的我,我忘了为 krb5 头文件包含-dev包。 Fix this with apt-get:用 apt-get 解决这个问题:

$ sudo apt-get install libkrb5-dev

Finally - Install gssapi最后 - 安装 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:如果你想整理一下,你可以删除krb5-config.mit命令的符号链接:

$ sudo rm /usr/bin/krb5-config

sudo apt install libkrb5-dev actually installs /usr/bin/krb5-config and /usr/lib/libgssapi_krb5.so sudo apt install libkrb5-dev实际上安装了 /usr/bin/krb5-config 和 /usr/lib/libgssapi_krb5.so

so none of the symlinking was needed, just install libkrb5-dev and you should be good.所以不需要任何符号链接,只需安装 libkrb5-dev 就可以了。

For me, the issue got resolved after installing the package "krb5-libs" in Centos.对我来说,在 Centos 中安装包“krb5-libs”后问题得到了解决。 Basically we need to have libgssapi_krb5.so file for installing gssapi.基本上我们需要有 libgssapi_krb5.so 文件来安装 gssapi。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM