From 10ec5f6fc9a4ba511fa6779d917c642e7e86f8b2 Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Tue, 19 Sep 2023 22:14:03 +0200 Subject: [PATCH] Fix ssh systemauth handling --- agent/sockets/callingcontext.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/agent/sockets/callingcontext.go b/agent/sockets/callingcontext.go index c7771d5..c21e97d 100644 --- a/agent/sockets/callingcontext.go +++ b/agent/sockets/callingcontext.go @@ -24,8 +24,13 @@ func GetCallingContext(connection net.Conn) CallingContext { panic(err) } pid, _ := creds.PID() - uid, _ := creds.UserID() process, err := gops.FindProcess(pid) + if process.Executable() == "ssh-keygen" { + process, err = gops.FindProcess(process.PPid()) + pid = process.Pid() + } + + uid, _ := creds.UserID() ppid := process.PPid() if err != nil { panic(err)