Skip to content

Commit

Permalink
include posture checks validation in network map generation for netwo…
Browse files Browse the repository at this point in the history
…rks routes + tests
  • Loading branch information
pascal-fischer committed Dec 28, 2024
1 parent fbce8bb commit 4bde983
Show file tree
Hide file tree
Showing 2 changed files with 933 additions and 1 deletion.
12 changes: 11 additions & 1 deletion management/server/types/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,6 +1320,10 @@ func (a *Account) GetNetworkResourcesRoutesToSync(ctx context.Context, peerID st
}

for _, policy := range resourcePolicies[resource.ID] {
isValid := a.validatePostureChecksOnPeer(ctx, policy.SourcePostureChecks, peerID)
if !isRoutingPeer && !isValid {
continue
}
for _, sourceGroup := range policy.SourceGroups() {
group := a.GetGroup(sourceGroup)
if group == nil {
Expand All @@ -1329,7 +1333,13 @@ func (a *Account) GetNetworkResourcesRoutesToSync(ctx context.Context, peerID st

// routing peer should be able to connect with all source peers
if addSourcePeers {
allSourcePeers = append(allSourcePeers, group.Peers...)
for _, sPeerId := range group.Peers {
isValid = a.validatePostureChecksOnPeer(ctx, policy.SourcePostureChecks, sPeerId)
if !isValid {
continue
}
allSourcePeers = append(allSourcePeers, sPeerId)
}
} else if slices.Contains(group.Peers, peerID) {
// add routes for the resource if the peer is in the distribution group
for peerId, router := range networkRoutingPeers {
Expand Down
Loading

0 comments on commit 4bde983

Please sign in to comment.