fleet/articles/locate-assets-with-osquery.md
Eric f10e33d387
Website: update article categories (#6679)
* add deploy category, change product to guides

* update links to deployment guides

* Update deploy-fleet-on-hetzner-cloud.md

* Update enrolling-a-digital-ocean-droplet-on-a-fleet-instance.md

* Update how-to-install-osquery-and-enroll-linux-devices-into-fleet.md

* Update delivering-data-to-snowflake-from-fleet-and-osquery.md

* Update how-to-install-osquery-and-enroll-windows-devices-into-fleet.md

* Update how-to-install-osquery-and-enroll-macos-devices-into-fleet.md

* Update deploying-fleet-on-aws-with-terraform.md

* Update deploying-fleet-on-render.md

* Update how-to-uninstall-osquery.md

* Update osquery-a-tool-to-easily-ask-questions-about-operating-systems.md

* Update get-and-stay-compliant-across-your-devices-with-fleet.md

* Update work-may-be-watching-but-it-might-not-be-as-bad-as-you-think.md

* Update converting-unix-timestamps-with-osquery.md

* Update correlate-network-connections-with-community-id-in-osquery.md

* Update using-elasticsearch-and-kibana-to-visualize-osquery-performance.md

* Update fleet-quick-tips-querying-procdump-eula-has-been-accepted.md

* Update locate-assets-with-osquery.md

* Update osquery-consider-joining-against-the-users-table.md

* Update import-and-export-queries-and-packs-in-fleet.md

* Update ebpf-the-future-of-osquery-on-linux.md

* Update generate-process-trees-with-osquery.md

* Update get-and-stay-compliant-across-your-devices-with-fleet.md

* Update work-may-be-watching-but-it-might-not-be-as-bad-as-you-think.md

* Update ebpf-the-future-of-osquery-on-linux.md

* Change category meta value back to guides

Co-authored-by: Desmi-Dizney <99777687+Desmi-Dizney@users.noreply.github.com>

* change article category

* update latest article category

* add redirects for articles not handled by cloudflare rules

* Update to main nav

I did a little more housekeeping on the main nav for when we do the switch on these categories.

- Added link to /deploy under Guides on the Documentation dropdown.
- Added link to /guides under Guides on the Documentation dropdown
- Removed the now redundant "See all" from under Guides on the Documentation dropdown
- Removed the now redundant "See all" from under Articles on the Community dropdown (There's no need to point users to All categories any more, since all the category land are now linked to independently from the main nav.

* Update article category name

Co-authored-by: Desmi-Dizney <99777687+Desmi-Dizney@users.noreply.github.com>
Co-authored-by: Mike Thomas <mthomas@fleetdm.com>
2022-07-21 13:59:51 +09:00

2.1 KiB

Locate device assets in the event of an emergency.

A simple query for IP-Geolocation

Locate device assets in the event of an emergency

In the event of an emergency or public safety concern, osquery can be easily used to identify employees the direct vicinity, so that teams can push warnings or safety precautions to their staff.

This simple strategy for obtaining the location of an osquery device utilizes the ipapi.co API to retrieve the IP geolocation of the device. Note that the device must be able to connect to the internet over HTTP, and the calculated location may be skewed by VPN, proxies, etc.

Query:

SELECT JSON_EXTRACT(result, '$.ip') AS ip,
 JSON_EXTRACT(result, '$.city') AS city,
 JSON_EXTRACT(result, '$.region') AS region,
 JSON_EXTRACT(result, '$.country') AS country
FROM curl
WHERE url = 'http://ipapi.co/json';

Sample result:

+--------------+------------+------------+---------+
| ip           | city       | region     | country |
+--------------+------------+------------+---------+
| 71.92.162.65 | Sacramento | California | US      |
+--------------+------------+------------+---------+

Other techniques A common technique for geolocation of macOS devices with osquery is to use the wifi_survey table in combination with the Google Geolocation API. This strategy has become more difficult to use due to security controls introduced in macOS 10.15, and poses privacy concerns due to the precision of the location data returned by the API.