Does anyone know if it’s possible to capture and geolocate the IP addresses accessing your homeassistant UI?
If anyone is using a solution to this, please share. If it helps, i’m running nginx-proxy-manager which directs the incoming traffic.
Does anyone know if it’s possible to capture and geolocate the IP addresses accessing your homeassistant UI?
If anyone is using a solution to this, please share. If it helps, i’m running nginx-proxy-manager which directs the incoming traffic.
curl ipinfo.io
I use this ssh command often on my Pi remotely. I’m doing it to be sure my VPN is up and running for that device. If it shows Canada my VPN is working. If it shows West Virgina… it aint.
It spits out a slew of data.
like so
pi@Pi-95:~ $ curl ipinfo.io
{
"ip": "204.187.100.82",
"hostname": "204-187-100-82.amanah.com",
"city": "Toronto",
"region": "Ontario",
"country": "CA",
"loc": "43.7786,-79.4450",
"org": "AS32489 Amanah Tech Inc.",
"postal": "M2R",
"timezone": "America/Toronto",
"readme": "https://ipinfo.io/missingauth"
I’m having a harder time creating a command line sensor for these results to come back to HA though.
I can do it with other device sensors from my Asus-Merlin router but not much luck yet doing it with my middle Pi.
I reread your question. I don’t think my first reply is much interest (or help) to you.
But sounds like what you might could do is save mark log those IP addresses and have them run through a reverse IP lookup website. HA has an html scrape thingy. It might could do what you want.
All the other maths and tricks involved are WAY above my head though. Good luck.
Have fun.
you might not get any “reliable” result regardless of where/who you make a request to, in best case “Country” is useful, “geo-location” is many times depended on the “provider” for “wired” customers( i’e fiber etc), and for phones sometimes, same( in best case here the “tower” where the device was connected(last seen) far from where it actually is, as it dont have to be the “nearest”… you could perform a “trace-route” thou those are sometimes blocked, so you only comes to the “providers” net, and get a total wrong result, but country, is reliable
Thank you guys for your responses. I know this is not reliable, but definitely ‘Country’ is what I was looking for.
I couldn’t find any support for this in homeassistant, so I whipped up my own which is definitely not the best, but works for now.
command_line
sensor.pyscript
integration.The result seems to work. When the IP address requesting my homeassistant install comes in, It gets logged and geoip’d.
I know this is not foolproff or accurate, but in the first 24 hours I found tons and tons of requests coming in from China, Europe, the middle east, etc. I know they’re probably just crawlers, but still.
I used the results to implement some rules on my firewall to kill that traffic.
Have you searched in Home assistant “Add-on” or “Integrations” … do you have HACS installed ? there are also extra add-ons/integrations
regarding incoming requests, it’s a Wild-World-Webb
, be sure china is at your “doorstep” within days/hours, eastern-eu/russia etc as-well, … i.e open port 80 and BOOM, yes most just crawlers ( but they are actually not “just” ) they can penetrate deep in a webb-server, if it’s not secured, hackers uses “crawlers” in their initially “process” finding vulnerable/interesting devices, to suck info from
Yes, I looked and came out empty. I have HACS installed. If you have a link or name to an already existing solution or add-on, please post.
i dont, and dont remeber if ive seen any, but then HACS integrations should be the place, or GitHUb, search for homeassistant integration in github, or in HACS i guess going through all integration is half an hours work … thou i haven’t any idea what to look for, thats why … scrollllll