Hello!
I found this question and we ended up writing our own custom sensor, which is just a simple PowerShell script. I'll share with the community. I'm not PowerShell expert, but this got the job done - just place it in the special EXE directory outlined in Sebastian's link above and modify as needed.
$DNSName = "www.website.com"
$AllowedIPArray = @("x.x.x.x","y.y.y.y")
Try {
# NOTE: I use this method vs. the Resolve-DnsName since the output of the cmdlet mixes different object types
# (see link below), so it's more work to handle that.
# https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/14452845-default-resolve-dnsname-object-output-results-in-a
$DNSResultArray = [System.Net.Dns]::Resolve($DNSName).AddressList
}
# we need to catch the error thrown if DNS lookup fails
Catch {
write-host "1:DNS Lookup Error"
exit 1
}
# something is wrong, if more or less than one A record is returned.
if ($DNSResultArray.Count -ne 1) {
write-host "2:DNS Lookup Error"
exit 1 # warning
}
if ($AllowedIPArray -notcontains $DNSResultArray) {
write-host "3:New IP Found " + $DNSResultArray[0].IPAddressToString
exit 2 # error
}
write-host "0:OK"
exit 0
Add comment