Hi @pete_jacob if you happen to be a Managed IDR customer you will have agent beacons in log search. Within the agent beacons we list the IP addresses of the interfaces. It would be possible to build a custom alert to fire if any of those interfaces happened to be assigned a public Ip address.
See an example here
You would need to add a custom pattern detection alert to trigger on
What this effectively checks is if any privateIP in the array of network interfaces (thats what the wildcard “*” does) is not equal to a private IP range it will match.
It could be worth reviewing some sample logs in log search to see if you get any hits for this before building the alert. Adding any exceptions or tweaks if necessary.
@david_smith how would you use a “does not equal” with this?
where(agentNetworkInterfaces..privateIps.0=/./!=IP(192.168.0.0/16)
this is invalid, is this because that is a regex and it won’t work with the IP(192.168.0.0/26)
Your posted query is where(agentNetworkInterfaces..privateIps.0=/./!=IP(192.168.0.0/16) - I’m pretty sure you can’t have your agentnetworkinterface keyword equal the wildcard then immediately have it not equal your CIDR IP without adding the keyword again, take a quick look below:
Without being able to test, have you tried something similar to:
where(agentNetworkInterfaces..privateIps.0=/./ AND agentNetworkInterfaces.*.privateIps.0!=IP(192.168.0.0/16)
that should work. One thing to note an AND operator can be used or ommitted. As a whitespace " " is also considered a logical AND. Up to the user for legibility.
@david_smith@david_smith
Sorry to be a pita about this guys.
I think I understand what is going on.
if you look in the agent bacons most assets will have a primary ip on either
agentNetworkInterfaces.0.privateIps.0 or agentNetworkInterfaces.1.privateIps.0
but will also have a loopback interface that is 127.0.0.1
so in this query it won’t work correctly
its like you have to say:
any interface that is present
not equal to the ip’s (listed above)
and btw totally ignore looking at the loopback interface
does this make sense?
I also noticed some agent bacons in the logs that just show the loopback interface (127.0.0.1)
with no indication of a agentNetworkInterfaces.*.privateIps.0 (this seems odd)
sorry guys
I ended up just creating an alert for agentNetworkInterfaces.1.privateIps.0 and a second for
agentNetworkInterfaces.0.privateIps.0
this solved my problem and is working like I want. my goal was to alert on assets that have a public ip
having two alerts for this is fine. log search and alerts can really be interesting.