Carry the VNC session key through the network map DB path

This commit is contained in:
Viktor Liu
2026-08-27 21:08:20 +02:00
parent ab472f572d
commit 5ec9b754fe
5 changed files with 49 additions and 3 deletions
@@ -12,7 +12,7 @@ const (
GetPoliciesQuery = `
select p.id, p.public_id, p.enabled, p.source_posture_checks, pr.enabled as rule_enabled, pr.action, pr.protocol, pr.bidirectional,
pr.sources, pr.destinations, pr.source_resource, pr.destination_resource, pr.ports, pr.port_ranges,
pr.authorized_groups, pr.authorized_user
pr.authorized_groups, pr.authorized_user, pr.session_pub_key, pr.session_display_name
from policies as p
left join policy_rules as pr on p.id = pr.policy_id
where account_id=$1
@@ -151,6 +151,8 @@ type Policy struct {
PortRanges []byte `nmap:"skip,json"`
AuthorizedGroups []byte `nmap:"skip,json"`
AuthorizedUser sql.NullString `nmap:"skip"`
SessionPubKey sql.NullString `nmap:"skip"`
SessionDisplayName sql.NullString `nmap:"skip"`
}
// Depending on db interface LastLogin contains time in different formats:
@@ -458,6 +460,12 @@ func ConvertToNmdataPolicy(policies []Policy) ([]nmdata.Policy, map[string]map[s
if p.AuthorizedUser.Valid {
pr().AuthorizedUser = p.AuthorizedUser.String
}
if p.SessionPubKey.Valid {
pr().SessionPubKey = p.SessionPubKey.String
}
if p.SessionDisplayName.Valid {
pr().SessionDisplayName = p.SessionDisplayName.String
}
if policyRule != nil {
policyRule.ID = p.ID
@@ -11,7 +11,7 @@ const (
GetPoliciesQuery = `
select p.id, p.public_id, p.enabled, p.source_posture_checks, pr.enabled as rule_enabled, pr.action, pr.protocol, pr.bidirectional,
pr.sources, pr.destinations, pr.source_resource, pr.destination_resource, pr.ports, pr.port_ranges,
pr.authorized_groups, pr.authorized_user
pr.authorized_groups, pr.authorized_user, pr.session_pub_key, pr.session_display_name
from policies as p
left join policy_rules as pr on p.id = pr.policy_id
where account_id=?