use negative cache for Kerberos credentials
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 10 lines · Lukas Hejtmanek
Hi,
Quoted 3 lines · Trond Myklebust
Yes. I'll draft a patch of what I'm proposing later today. What I basically want to do is to add a flag to the
gss_credthat marks it as expired, and add a timestamp.is there draft of the patch anywhere? Is my kernel part patch completely wrong?
Hi Lukas,
We already have code in nfs4proc.c for handling EKEYEXPIRED, and that delays the request before allowing it to retry. What I was proposing was negative caching, so that if some other process comes along and tries to do an upcall, the RPC code just immediately returns EKEYEXPIRED instead of asking gssd again.
Something like the following (still untested) patch.
Cheers
Trond
----------------------------------------------------------------------------------------
SUNRPC: Don't spam gssd with upcall requests when the kerberos key expired
From: Trond Myklebust <[email protected]>
Now that the rpc.gssd daemon can explicitly tell us that the key expired, we should cache that information to avoid spamming gssd.
---
include/linux/sunrpc/auth.h | 1 + include/linux/sunrpc/auth_gss.h | 1 + net/sunrpc/auth_gss/auth_gss.c | 65 ++++++++++++++++++++++++++++++++------- 3 files changed, 55 insertions(+), 12 deletions(-)
include/linux/sunrpc/auth.h +1 -0
@@ -54,6 +54,7 @@ struct rpc_cred {#define RPCAUTH_CRED_NEW 0#define RPCAUTH_CRED_UPTODATE 1#define RPCAUTH_CRED_HASHED 2 +#define RPCAUTH_CRED_NEGATIVE 3#define RPCAUTH_CRED_MAGIC 0x0f4aa4f0
include/linux/sunrpc/auth_gss.h +1 -0
@@ -82,6 +82,7 @@ struct gss_cred {enum rpc_gss_svc gc_service;struct gss_cl_ctx *gc_ctx;struct gss_upcall_msg *gc_upcall; +unsigned long gc_upcall_timestamp; unsigned char gc_machine_cred : 1; };
net/sunrpc/auth_gss/auth_gss.c +53 -12
113 lines not on this page · raw message
_______________________________________________
NFSv4 mailing list
[email protected]
http://linux-nfs.org/cgi-bin/mailman/listinfo/nfsv4
Hi,
Quoted 7 lines · Trond Myklebust
We already have code in
nfs4proc.cfor handling EKEYEXPIRED, and that delays the request before allowing it to retry. What I was proposing was negative caching, so that if some other process comes along and tries to do an upcall, the RPC code just immediately returns EKEYEXPIRED instead of asking gssd again.Something like the following (still untested) patch.
we tested the patch and found the following.
Assume, we mounted NFS volume somewhere, we are non root user and we have valid kerberos ticket. We access the volume.
The following sequence of procedures is called:
gss_lookup_cred - search, whether we have the ticket gss_cred_init - create a new ticket into cache (according to gss_pipe_downcall)gss_pip_downcall - calls rpc.gssdgss_marchalgss_wrap_reqgss_validategss_unwrap_respnfs4_handle_exception: 0 - OK, we got the ticket
If the ticket is valid and has been found in cache:gss_lookup_credgss_matchgss_wrap_reqgss_validategss_unwrap_respnfs4_handle_exception: 0 - OK, we got the ticket
Now, the ticket expired.
gss_lookup_credgss_matchgss_marshalgss_wrap_reqgss_refreshgss_renew_credgss_lookup_credgss_matchgss_matchgss_destroy_credgss_pipe_downcallgss_destroy_crednfs4_handle_exeption: ticket expired
second try to access NFS with an expired ticket
gss_lookup_credgss_cred_init
gss-pipe_downcallgss_destroy_crednfs4_handle_exception: ticket expired
another try, no gss_refresh is called until a new ticket is available.
Your patch seems the gss_refresh to be called to work properly.
So, the first process accessing the NFS volume without ticket gets stopped. But the others are not.
And there is no difference how many times the application tried to access the NFS4 volume.
I think, it is useful if you do:
ls /mnt/nfs4
return immediately if you don't have a ticket or the ticked is expired.
But if the application spin fast, stop it.
What is your opinion how to solve this?
We are thinking about to move the negative cache into another function, i.e., the function that gets called. Or create different negative cache for this purpose. Or fill fake tickets into cache and catch them.
What's your idea? We can develop it but we are not about to develop something that would be refused as our previous work.
Signature · 1 line
Lukáš Hejtmánek