开发者

kinit from Python script using keytab

Does anyone know how to kinit from within a python script usi开发者_如何学Pythonng keytab; that is to avoid having to prompt for a password?


I prefer use libraries such as krbcontext:

from krbcontext.context import krbContext

with krbContext(using_keytab=True, principal='[username]@[REALM]', keytab_file='/etc/security/keytabs/[name].keytab', ccache_file='/tmp/krb5cc_pid_appname'):
    pass


from subprocess import Popen, PIPE

kinit_args - [ '/usr/bin/kinit', '-kt', '/home/username/username.keytab', 'username@realm' ]
subp = Popen(kinit_args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
subp.wait()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜