krbcontext / python-krbcontext

A Kerberos context manager
https://krbcontext.github.io/
GNU General Public License v3.0
25 stars 10 forks source link

cant seems to use this. #21

Closed rabkaman closed 7 years ago

rabkaman commented 7 years ago

Hoping you can provide me some guidance here using ktab. Seems like your pretty active last week.. so i am hoping for quick answer. I have a SaaS with impersonation needed to run back office processes on behalf of specific users (from application). I have setup ktab and installed all the required kerberos components.. Just cant get your module to work quite right..

Appreciate guidance here.

My test code.

import krbcontext  as krbContext
import os
with krbContext(using_keytab=True,
        principal='auser@MSA.TECH',
        keytab_file='/home/auser/cert/auser.keytab',
        ccache_file='/tmp/krb5cc_pid_appname'):
    pass

TypeError Traceback (most recent call last)

in () 4 principal='auser@MSA.TECH', 5 keytab_file='/home/auser/cert/auser.keytab', ----> 6 ccache_file='/tmp/krb5cc_pid_appname'): 7 pass TypeError: 'module' object is not callable -- >pip list | grep krbcontext krbcontext (0.8) my kinit ktab works fine >kinit -kt auser.keytab auser@MSA.TECH >klist Ticket cache: FILE:/tmp/krb5cc_1001 Default principal: auser@MSA.TECH Valid starting Expires Service principal 09/08/2017 18:05:11 09/09/2017 04:05:11 krbtgt/MSA.TECH@MSA.TECH renew until 09/15/2017 18:05:11
tkdchen commented 7 years ago

I think import krbcontext as krbContext should be changed to

import krbcontext.krbContext as krbContext

or

from krbcontext import krbContext
rabkaman commented 7 years ago

from krbcontext import krbContext

awesome, that worked.

tkdchen commented 7 years ago

Good to know krbcontext works for you.