From f68dd3e973f752fc7a3b7b0ec7c8096f45764abb Mon Sep 17 00:00:00 2001 From: Bernd Schoolmann Date: Sat, 23 Dec 2023 13:44:16 +0100 Subject: [PATCH] Improve usability of callingcontext & approval --- agent/sockets/callingcontext.go | 15 +++++++-------- agent/systemauth/systemauth.go | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/agent/sockets/callingcontext.go b/agent/sockets/callingcontext.go index 4a725f0..3541094 100644 --- a/agent/sockets/callingcontext.go +++ b/agent/sockets/callingcontext.go @@ -3,7 +3,6 @@ package sockets import ( "net" "os/user" - "time" gops "github.com/mitchellh/go-ps" "inet.af/peercred" @@ -22,13 +21,13 @@ type CallingContext struct { func GetCallingContext(connection net.Conn) CallingContext { creds, err := peercred.Get(connection) errorContext := CallingContext{ - UserName: "unknown user", - ProcessName: "unknown process", - ParentProcessName: "unknown parent", - GrandParentProcessName: "unknown grandparent", - ProcessPid: time.Now().UTC().Nanosecond(), - ParentProcessPid: time.Now().UTC().Nanosecond(), - GrandParentProcessPid: time.Now().UTC().Nanosecond(), + UserName: "unknown", + ProcessName: "unknown", + ParentProcessName: "unknown", + GrandParentProcessName: "unknown", + ProcessPid: 0, + ParentProcessPid: 0, + GrandParentProcessPid: 0, } if err != nil { return errorContext diff --git a/agent/systemauth/systemauth.go b/agent/systemauth/systemauth.go index 5ebf567..78e2995 100644 --- a/agent/systemauth/systemauth.go +++ b/agent/systemauth/systemauth.go @@ -97,10 +97,10 @@ func GetPermission(sessionType SessionType, ctx sockets.CallingContext, config * } } - approval, err := pinentry.GetApproval("Goldwarden authorization", message) - if err != nil || !approval { - return false, err - } + // approval, err := pinentry.GetApproval("Goldwarden authorization", message) + // if err != nil || !approval { + // return false, err + // } log.Info("Permission granted, creating session") sessionStore.CreateSession(ctx.ProcessPid, ctx.ParentProcessPid, ctx.GrandParentProcessPid, sessionType)