Simplify profile reloading
Also, increase prompt decision timeout.
This commit is contained in:
@@ -4,10 +4,11 @@ import (
|
||||
"github.com/safing/portbase/config"
|
||||
)
|
||||
|
||||
// Configuration Keys
|
||||
// Configuration Keys.
|
||||
var (
|
||||
CfgOptionEnableProcessDetectionKey = "core/enableProcessDetection"
|
||||
enableProcessDetection config.BoolOption
|
||||
|
||||
enableProcessDetection config.BoolOption
|
||||
)
|
||||
|
||||
func registerConfiguration() error {
|
||||
|
||||
@@ -45,21 +45,21 @@ func GetProcessByConnection(ctx context.Context, pktInfo *packet.Info) (process
|
||||
return process, connInbound, nil
|
||||
}
|
||||
|
||||
func GetNetworkHost(ctx context.Context, remoteIP net.IP) (process *Process, err error) {
|
||||
func GetNetworkHost(ctx context.Context, remoteIP net.IP) (process *Process, err error) { //nolint:interfacer
|
||||
now := time.Now().Unix()
|
||||
networkHost := &Process{
|
||||
Name: fmt.Sprintf("Network Host %s", remoteIP),
|
||||
UserName: "Unknown",
|
||||
UserID: -255,
|
||||
Pid: -255,
|
||||
ParentPid: -255,
|
||||
UserID: NetworkHostProcessID,
|
||||
Pid: NetworkHostProcessID,
|
||||
ParentPid: NetworkHostProcessID,
|
||||
Path: fmt.Sprintf("net:%s", remoteIP),
|
||||
FirstSeen: now,
|
||||
LastSeen: now,
|
||||
}
|
||||
|
||||
// Get the (linked) local profile.
|
||||
networkHostProfile, err := profile.GetNetworkHostProfile(remoteIP.String())
|
||||
networkHostProfile, err := profile.GetProfile(profile.SourceNetwork, remoteIP.String(), "")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ const (
|
||||
|
||||
var getProcessSingleInflight singleflight.Group
|
||||
|
||||
// A Process represents a process running on the operating system
|
||||
// A Process represents a process running on the operating system.
|
||||
type Process struct {
|
||||
record.Base
|
||||
sync.Mutex
|
||||
|
||||
@@ -9,9 +9,14 @@ import (
|
||||
"golang.org/x/sync/singleflight"
|
||||
)
|
||||
|
||||
// UnidentifiedProcessID is the PID used for anything that could not be
|
||||
// attributed to a PID for any reason.
|
||||
const UnidentifiedProcessID = -1
|
||||
const (
|
||||
// UnidentifiedProcessID is the PID used for anything that could not be
|
||||
// attributed to a PID for any reason.
|
||||
UnidentifiedProcessID = -1
|
||||
|
||||
// NetworkHostProcessID is the PID used for requests served to the network.
|
||||
NetworkHostProcessID = -255
|
||||
)
|
||||
|
||||
var (
|
||||
// unidentifiedProcess is used when a process cannot be found.
|
||||
|
||||
Reference in New Issue
Block a user