如何在python中验证kerberos主体

2024-06-28 15:12:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我安装了kerberos模块,并尝试引用this document进行身份验证

鉴于此:
负责人:username@A.B.com
密码:mypassword123

我尝试的是:

>>> __, krb_context = kerberos.authGSSClientInit("username@A.B.com")
>>> kerberos.authGSSClientStep(krb_context, "")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
kerberos.GSSError: (('Unspecified GSS failure.  Minor code may provide more information', 851968), ('Server krbtgt/B.com@A.B.com not found in Kerberos database', -1765328377))

当我在终端中验证kerberos主体时,它工作得很好

root@server:/home1/user:$ kinit username@A.B.com
Password for username@A.B.com:

root@server:/home1/user:$ klist
Ticket cache: FILE:/tmp/krb5cc_0
Default principal: username@A.B.com

Valid starting       Expires              Service principal
06/02/2021 21:45:00  06/03/2021 21:44:57  krbtgt/A.B.com@A.B.com
    renew until 06/09/2021 21:44:57

两者之间的区别是,当在python中尝试时,它说

'Server krbtgt/B.com@A.B.com not found in Kerberos database'

A在此错误日志中被省略

我找不到python kerberos模块的详细说明文档

而且,我不知道该把密码放在哪里。 任何链接或评论感谢


Tags: 模块incom密码servercontextusernamenot
1条回答
网友
1楼 · 发布于 2024-06-28 15:12:00

试试看

sparkSession = SparkSession \
.builder.appName("working_with_oracle") \
.master('local[*]') \
.config("spark.sql.debug.maxToStringFields", '2000') \
.config('spark.sql.parquet.writeLegacyFormat', 'true') \
.config("spark.kerberos.keytab" , '/tmp/krb5cc_1000') \
.config("spark.kerberos.principal" , 'xxx') \
.config("spark.kerberos.access.hadoopFileSystems" , 'webhdfs://xxxx:50070') \
.enableHiveSupport() \
.getOrCreate() 

相关问题 更多 >