mirror of
https://github.com/quexten/goldwarden.git
synced 2024-12-25 04:14:02 +03:00
Improve usability of callingcontext & approval
This commit is contained in:
parent
b9be947d94
commit
f68dd3e973
@ -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
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user