Skip to content

Commit 330ca1a

Browse files
committed
Do not annotate sinkhole ip
1 parent c053de3 commit 330ca1a

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

dnsproxy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ func (proxy *DNSProxy) getIPByDomain(domain string) (string, error) {
104104
// the call will be blocked by the firewall
105105
proxy.Cache.Set(domain, StepSecuritySinkHoleIPAddress)
106106

107+
go proxy.ApiClient.sendDNSRecord(proxy.CorrelationId, proxy.Repo, domain, StepSecuritySinkHoleIPAddress)
108+
107109
return StepSecuritySinkHoleIPAddress, nil
108110
}
109111
}

netmon.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,21 @@ func (netMonitor *NetworkMonitor) handlePacket(attrs nflog.Attribute) {
8888
// Get actual TCP data from this layer
8989
ipv4, _ := ipv4Layer.(*layers.IPv4)
9090
netMonitor.netMutex.Lock()
91-
_, found := ipAddresses[ipv4.DstIP.String()]
91+
ipv4Address := ipv4.DstIP.String()
92+
_, found := ipAddresses[ipv4Address]
9293
if !found {
93-
ipAddresses[ipv4.DstIP.String()] = 1
94+
ipAddresses[ipv4Address] = 1
9495

9596
if isSYN {
9697
netMonitor.ApiClient.sendNetConnection(netMonitor.CorrelationId, netMonitor.Repo,
97-
ipv4.DstIP.String(), port, netMonitor.Status, timestamp, Tool{Name: Unknown, SHA256: Unknown})
98+
ipv4Address, port, netMonitor.Status, timestamp, Tool{Name: Unknown, SHA256: Unknown})
9899

99100
if netMonitor.Status == "Dropped" {
100-
go WriteLog(fmt.Sprintf("ip address dropped: %s", ipv4.DstIP.String()))
101-
go WriteAnnotation(fmt.Sprintf("Traffic to IP Address %s was blocked", ipv4.DstIP.String()))
101+
go WriteLog(fmt.Sprintf("ip address dropped: %s", ipv4Address))
102+
103+
if ipv4Address != StepSecuritySinkHoleIPAddress { // Sinkhole IP address will be covered by DNS block
104+
go WriteAnnotation(fmt.Sprintf("Traffic to IP Address %s was blocked", ipv4Address))
105+
}
102106
}
103107
}
104108
}

0 commit comments

Comments
 (0)