Improve usability of callingcontext & approval

This commit is contained in:
Bernd Schoolmann 2023-12-23 13:44:16 +01:00
parent b9be947d94
commit f68dd3e973
No known key found for this signature in database
2 changed files with 11 additions and 12 deletions

View File

@ -3,7 +3,6 @@ package sockets
import ( import (
"net" "net"
"os/user" "os/user"
"time"
gops "github.com/mitchellh/go-ps" gops "github.com/mitchellh/go-ps"
"inet.af/peercred" "inet.af/peercred"
@ -22,13 +21,13 @@ type CallingContext struct {
func GetCallingContext(connection net.Conn) CallingContext { func GetCallingContext(connection net.Conn) CallingContext {
creds, err := peercred.Get(connection) creds, err := peercred.Get(connection)
errorContext := CallingContext{ errorContext := CallingContext{
UserName: "unknown user", UserName: "unknown",
ProcessName: "unknown process", ProcessName: "unknown",
ParentProcessName: "unknown parent", ParentProcessName: "unknown",
GrandParentProcessName: "unknown grandparent", GrandParentProcessName: "unknown",
ProcessPid: time.Now().UTC().Nanosecond(), ProcessPid: 0,
ParentProcessPid: time.Now().UTC().Nanosecond(), ParentProcessPid: 0,
GrandParentProcessPid: time.Now().UTC().Nanosecond(), GrandParentProcessPid: 0,
} }
if err != nil { if err != nil {
return errorContext return errorContext

View File

@ -97,10 +97,10 @@ func GetPermission(sessionType SessionType, ctx sockets.CallingContext, config *
} }
} }
approval, err := pinentry.GetApproval("Goldwarden authorization", message) // approval, err := pinentry.GetApproval("Goldwarden authorization", message)
if err != nil || !approval { // if err != nil || !approval {
return false, err // return false, err
} // }
log.Info("Permission granted, creating session") log.Info("Permission granted, creating session")
sessionStore.CreateSession(ctx.ProcessPid, ctx.ParentProcessPid, ctx.GrandParentProcessPid, sessionType) sessionStore.CreateSession(ctx.ProcessPid, ctx.ParentProcessPid, ctx.GrandParentProcessPid, sessionType)