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 (
"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

View File

@ -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)