Gssapi+Freeipa+Python。找不到客户负责人。但它存在。为什么?
Gssapi+Freeipa+Python. Can't find client principal. But it exists. Why?
我先做的:
>kinit
Default principal: bob@R1.COM
Valid starting Expires Service principal
18.06.2020 18:27:11 19.06.2020 18:26:26 postgres/c1.com.ru@R1.COM
18.06.2020 18:27:11 19.06.2020 18:26:26 postgres/c1s.com.com@
18.06.2020 18:26:30 19.06.2020 18:26:26 krbtgt/R1.COM@R1.COM
好的。 "postgres/c1.com.ru@R1.COM" 的主体存在。
第二个:
import gssapi
p_name = 'postgres/c1.com.ru@R1.COM'
name = gssapi.Name(p_name) #the principal for this service
creds = gssapi.Credentials(name=name, usage='initiate')
我得到这个错误:
Traceback (most recent call last):
File "gt1.py", line 8, in <module>
creds = gssapi.Credentials(name=name, usage='initiate')
File "/usr/lib/python2.7/dist-packages/gssapi/creds.py", line 64, in __new__
store=store)
File "/usr/lib/python2.7/dist-packages/gssapi/creds.py", line 137, in acquire
mechs, usage)
File "gssapi/raw/creds.pyx", line 158, in gssapi.raw.creds.acquire_cred (gssapi/raw/creds.c:2051)
gssapi.raw.misc.GSSError: Major (851968): Unspecified GSS failure. Minor code may provide more information, Minor (2529639053): Can't find client principal postgres/cu1s.rostelecom1.ru@ROSTELECOM1.RU in cache collection
为什么会这样?有任何想法吗?拜托,我需要帮助...
您混淆了两种不同的东西:客户主体和目标主体。您的凭据缓存(以 klist
列出)表明当您使用 postgres/c1.com.ru@R1.COM
作为您的客户端主体时,该缓存中的客户端主体是 bob@R1.COM
。
您需要:
- 首先使用 postgres/c1.com.ru
的密钥初始化缓存(最有可能使用一些密钥表)
- 在 Python 应用程序中初始化凭据时使用 keytab。
对于后者,您需要传递一个cred store reference。类似于 FreeIPA 中的辅助代码:https://pagure.io/freeipa/blob/master/f/ipalib/install/kinit.py#_43
我先做的:
>kinit
Default principal: bob@R1.COM
Valid starting Expires Service principal
18.06.2020 18:27:11 19.06.2020 18:26:26 postgres/c1.com.ru@R1.COM
18.06.2020 18:27:11 19.06.2020 18:26:26 postgres/c1s.com.com@
18.06.2020 18:26:30 19.06.2020 18:26:26 krbtgt/R1.COM@R1.COM
好的。 "postgres/c1.com.ru@R1.COM" 的主体存在。
第二个:
import gssapi
p_name = 'postgres/c1.com.ru@R1.COM'
name = gssapi.Name(p_name) #the principal for this service
creds = gssapi.Credentials(name=name, usage='initiate')
我得到这个错误:
Traceback (most recent call last):
File "gt1.py", line 8, in <module>
creds = gssapi.Credentials(name=name, usage='initiate')
File "/usr/lib/python2.7/dist-packages/gssapi/creds.py", line 64, in __new__
store=store)
File "/usr/lib/python2.7/dist-packages/gssapi/creds.py", line 137, in acquire
mechs, usage)
File "gssapi/raw/creds.pyx", line 158, in gssapi.raw.creds.acquire_cred (gssapi/raw/creds.c:2051)
gssapi.raw.misc.GSSError: Major (851968): Unspecified GSS failure. Minor code may provide more information, Minor (2529639053): Can't find client principal postgres/cu1s.rostelecom1.ru@ROSTELECOM1.RU in cache collection
为什么会这样?有任何想法吗?拜托,我需要帮助...
您混淆了两种不同的东西:客户主体和目标主体。您的凭据缓存(以 klist
列出)表明当您使用 postgres/c1.com.ru@R1.COM
作为您的客户端主体时,该缓存中的客户端主体是 bob@R1.COM
。
您需要:
- 首先使用 postgres/c1.com.ru
的密钥初始化缓存(最有可能使用一些密钥表)
- 在 Python 应用程序中初始化凭据时使用 keytab。
对于后者,您需要传递一个cred store reference。类似于 FreeIPA 中的辅助代码:https://pagure.io/freeipa/blob/master/f/ipalib/install/kinit.py#_43