fleet/server
Lucas Manuel Rodriguez 5ec4fab440
Orbit to set --database_path when invoking osquery to retrieve system info (#10308)
#9132

The actual fix for the empty hosts is adding the `--database_path`
argument in the initial `osqueryd -S` invocation when retrieving the
UUID. Osquery attempts to retrieve the UUID from OS files/APIs, when not
possible (which is what happens on some linux distributions), then it
resorts to generating a new random UUID and storing it in the
`osquery.db`. The issue was Orbit's first invocation of `osqueryd -S`
was not using the same `osquery.db` as the main daemon invocation of
`osqueryd`.

I'm also adding a `hostname` + `platform` to the orbit enroll phase so
that if there are any issues in the future we can avoid the "empty" host
and have some information to help us troubleshoot.

## How to reproduce

On Linux, osquery reads `/sys/class/dmi/id/product_uuid` to load the
hardware UUID.
Some Linux distributions running on specific hardware or container
environments do not have such file available.
The way to reproduce on a Linux VM is to do the following:
```sh
$ sudo su
# chmod -r /sys/class/dmi/id/product_uuid
```
which will turn the file inaccessible to root.

## Checklist

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- ~[ ] Documented any API changes (docs/Using-Fleet/REST-API.md or
docs/Contributing/API-for-contributors.md)~
- ~[ ] Documented any permissions changes~
- [X] Input data is properly validated, `SELECT *` is avoided, SQL
injection is prevented (using placeholders for values in statements)
- [X] Added support on fleet's osquery simulator `cmd/osquery-perf` for
new osquery data ingestion features.
- [X] Added/updated tests
- [x] Manual QA for all new/changed functionality
  - For Orbit and Fleet Desktop changes:
- [x] Manual QA must be performed in the three main OSs, macOS, Windows
and Linux.
- [x] Auto-update manual QA, from released version of component to new
version (see [tools/tuf/test](../tools/tuf/test/README.md)).
2023-03-13 18:54:18 -03:00
..
authz Observers can observe team settings (#10447) 2023-03-13 15:34:39 -03:00
bindata Allow users to be readded if they were ever removed (#1945) 2021-09-07 13:33:40 -03:00
config add config values for MDM Okta integration (#10295) 2023-03-06 14:47:29 -03:00
contexts Add UUID to Fleet errors and clean up error msgs (#10411) 2023-03-13 13:44:06 -03:00
datastore Orbit to set --database_path when invoking osquery to retrieve system info (#10308) 2023-03-13 18:54:18 -03:00
errorstore Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
fleet Orbit to set --database_path when invoking osquery to retrieve system info (#10308) 2023-03-13 18:54:18 -03:00
health Separate health checks for MySQL and Redis (#6468) 2022-07-01 08:08:03 -03:00
launcher Ingest pending MDM hosts (#9065) 2022-12-26 15:32:39 -06:00
live_query Bump go to 1.19.1 (#7690) 2022-09-12 20:32:43 -03:00
logging fix fleetctl apply with default configuration (#10305) 2023-03-06 10:44:40 -05:00
mail update copyright year in core product transactional email templates (#3549) 2022-01-01 12:41:32 -06:00
mdm/apple allow to set up a DEP flow gated by Okta auth (#10338) 2023-03-13 10:33:32 -03:00
mock Orbit to set --database_path when invoking osquery to retrieve system info (#10308) 2023-03-13 18:54:18 -03:00
policies Refactor webhooks cron to new schedule package (#7840) 2022-09-20 14:26:36 -05:00
ptr Feature 7077: Add MSRC feed parser (#7424) 2022-08-30 16:39:50 -04:00
pubsub Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
service Orbit to set --database_path when invoking osquery to retrieve system info (#10308) 2023-03-13 18:54:18 -03:00
sso Allow setting user roles during JIT provisioning (#10193) 2023-03-01 20:18:40 -03:00
test Implement API endpoint for MDM manual enrollment profile download (#9232) 2023-01-16 10:22:12 -05:00
vulnerabilities Updated translation rules so that Docker Desktop can be mapped to the proper CPE (#10326) 2023-03-09 17:46:57 -04:00
webhooks Add ability to mark policy as critical. (#8896) 2022-12-06 15:59:20 +01:00
websocket Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
worker Add critical policies as a premium feature (#8959) 2022-12-09 19:23:08 +01:00
utils.go Modify /server/utils to handle all 2xx codes as POST success (#3534) 2021-12-30 16:00:10 -06:00