Use new profile functions in firewall

This commit is contained in:
Daniel 2022-10-03 22:12:58 +02:00
parent fd0ce5732d
commit f4490b4f11
3 changed files with 14 additions and 6 deletions

View file

@ -71,7 +71,10 @@ func DecideOnConnection(ctx context.Context, conn *network.Connection, pkt packe
// Check if the layered profile needs updating. // Check if the layered profile needs updating.
if layeredProfile.NeedsUpdate() { if layeredProfile.NeedsUpdate() {
// Update revision counter in connection. // Update revision counter in connection.
conn.ProfileRevisionCounter = layeredProfile.Update() conn.ProfileRevisionCounter = layeredProfile.Update(
conn.Process().MatchingData(),
conn.Process().CreateProfileCallback,
)
conn.SaveWhenFinished() conn.SaveWhenFinished()
// Reset verdict for connection. // Reset verdict for connection.

View file

@ -179,7 +179,9 @@ func createPrompt(ctx context.Context, conn *network.Connection, pkt packet.Pack
Profile: promptProfile{ Profile: promptProfile{
Source: string(localProfile.Source), Source: string(localProfile.Source),
ID: localProfile.ID, ID: localProfile.ID,
LinkedPath: localProfile.LinkedPath, // LinkedPath is used to enhance the display of the prompt in the UI.
// TODO: Using the process path is a workaround. Find a cleaner solution.
LinkedPath: conn.Process().Path,
}, },
}, },
Expires: expires, Expires: expires,
@ -259,7 +261,7 @@ func saveResponse(p *profile.Profile, entity *intel.Entity, promptResponse strin
// Update the profile if necessary. // Update the profile if necessary.
if p.IsOutdated() { if p.IsOutdated() {
var err error var err error
p, err = profile.GetProfile(p.Source, p.ID, p.LinkedPath, false) p, err = profile.GetLocalProfile(p.ID, nil, nil)
if err != nil { if err != nil {
return err return err
} }

View file

@ -70,7 +70,10 @@ func checkTunneling(ctx context.Context, conn *network.Connection) {
// Update profile. // Update profile.
if layeredProfile.NeedsUpdate() { if layeredProfile.NeedsUpdate() {
// Update revision counter in connection. // Update revision counter in connection.
conn.ProfileRevisionCounter = layeredProfile.Update() conn.ProfileRevisionCounter = layeredProfile.Update(
conn.Process().MatchingData(),
conn.Process().CreateProfileCallback,
)
conn.SaveWhenFinished() conn.SaveWhenFinished()
} else { } else {
// Check if the revision counter of the connection needs updating. // Check if the revision counter of the connection needs updating.