pynfs: rpc AuthGss.init_cred fails on missing attrs/wrong usage of gssapi (nfs4 client)
From: Volodymyr Khomenko <hidden>
Date: 2021-06-02 09:36:05
Using the latest pynfs (from git) with python-gssapi 0.6.4.
Trying to test NFS4 client with flavor=rpc.RPCSEC_GSS from python:
opts=...
opts.flavor=rpc.RPCSEC_GSS
self.env = environment.Environment(opts)
Getting 'AttributeError' from different places.
Stack trace1:
nfs4/nfs4_client.py:61: in __init__
self.env = environment.Environment(opts)
lib/python3.6/site-packages/nfs4/server41tests/environment.py:128: in __init__
krb5_cred = AuthGss().init_cred(call, target="nfs@%s" % opts.server)
lib/python3.6/site-packages/rpc/security.py:249: AttributeErrortarget = gssapi.Name(target, gssapi.NT_HOSTBASED_SERVICE)
E AttributeError: module 'gssapi' has no attribute 'NT_HOSTBASED_SERVICE'
For this error, in python-gssapi-0.6.4/gssapi/__init__.py I see that
correct name for this attribute is 'C_NT_HOSTBASED_SERVICE' (not
'NT_HOSTBASED_SERVICE'):
C_NT_HOSTBASED_SERVICE = bindings.C.GSS_C_NT_HOSTBASED_SERVICE
Stack trace2:
nfs4/nfs4_client.py:61: in __init__
self.env = environment.Environment(opts)
lib/python3.6/site-packages/nfs4/server41tests/environment.py:128: in __init__
krb5_cred = AuthGss().init_cred(call, target="nfs@%s" % opts.server)
lib/python3.6/site-packages/rpc/security.py:267: AttributeErrortoken = context.init(target, token, gss_cred)
E AttributeError: 'Context' object has no attribute 'init' For this error, in python-gssapi-0.6.4/gssapi/ctx.py file I see that the 'Context' class __init__ method has no parameters, init() method is really missing. I suspect that python-gssapi was changed or I'm using the wrong version/code of the gssapi library. I tried to use the old gssapi lib version (before fork) - gssapi-1.6.13 - but I get similar errors. 'README' file for pynfs says that we need the 'python3-gssapi' package, but it is missing in the repository, so I have to install it manually. Please advise what gssapi python library version is proven to work with pynfs. Thanks!