This Azure template deploys a low-interaction network honeypot VM that acts as a canary detection sensor. It monitors and logs all incoming TCP connection attempts (TCP SYN packets), providing early warning of network reconnaissance and attack activities.
The deployment creates a minimal B1ls VM (1 vCPU, 0.5GB RAM) running Azure Linux 3. This demo deployment also deploys a public IP address to demonstrate functionality based on Internet port scans. The VM is configured with cloud-init to use nftables to log TCP SYN packets to the systemd-journal. Journal SYN probe logs are continuously read, transformed and stored in the Canary_CL custom Log Analytics table with columns TimeGenerated, SourceIP and DestinationPort.
Important
The VM is deployed with SSH port 22 open (secured with SSH key authentication). Connection attempts for ports other than SSH 22 are dropped with TCP RST. These factors somewhat increase scanner interest in the target.
To deploy first generate an SSH key pair (e.g. ssh-keygen -t ed25519 -a 100 -C "sshkey-canary" -f "ssh.key") then use the contents of ssh.key.pub for the sshPublicKey parameter.
Source IP addresses can be mapped to geolocations using the Kusto function geo_info_from_ip_address. The geolocations can be clustered into S2 cells using geo_point_to_s2cell which can then be visualized on a map. For example:
Canary_CL
| extend GeoInfo = geo_info_from_ip_address(SourceIP)
| extend Country = tostring(GeoInfo.country)
| extend State = tostring(GeoInfo.state)
| extend City = tostring(GeoInfo.city)
| extend Location = strcat(Country, iff(isempty(State), "", strcat(" / ", State)), iff(isempty(City), "", strcat(" / ", City)))
| extend Longitude = toreal(GeoInfo.longitude)
| extend Latitude = toreal(GeoInfo.latitude)
| extend S2Cell = geo_point_to_s2cell(Longitude, Latitude, 20)
| summarize S2CellCount = count(), S2CellName = min(Location) by S2Cell
| project S2CellPoint = geo_s2cell_to_central_point(S2Cell), S2CellCount, S2CellName
| render piechart with (kind = map)Note
Map visualizations are not supported on the Azure Monitor Log Analytics agent, but can be viewed by connecting Azure Data Explorer web UI to Azure Monitor.