fleet/cmd/fleetctl
Lucas Manuel Rodriguez b65739f035
Orbit to kill pre-existing osqueryd processes during startup (#16343)
This should fix #16006.

On Windows when a process is killed by the Task Manager, it is killed
without any signaling, thus the osqueryd processes are left orphaned.
Executing osqueryd (which we do to get host information) was failing
because the lingering processes had a lock on the database file. The
solution implemented in this PR is to kill any pre-existing osqueryd
processes before running osqueryd.

- [X] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
- [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)).

PS: I added a log of the stdout+stderr of osqueryd execution when such
command fails to execute. (This helped me find the root cause.)
```
2024-01-25T11:57:56-08:00 ERR getHostInfo via osquery output= stderr="E0125 11:57:56.744843
7860 shutdown.cpp:79] IO error: Failed to create lock file:
C:\\Program Files\\Orbit\\osquery.db/LOCK: The process cannot access the file because it is
being used by another process.\r\r\n"
```

PPS: I removed some unused exported methods in the `orbit/pkg/platform`
package.
2024-01-29 16:44:50 -03:00
..
testdata Team host expiry. (#16188) 2024-01-22 10:00:02 -06:00
api.go Move external dependency fleetdm/kolide-kit to monorepo (#15861) 2024-01-02 18:22:52 -03:00
apply.go Workaround to set policy specs on a team (#9978) 2023-02-22 13:14:53 -03:00
apply_test.go feature: target profiles by labels (#16202) 2024-01-26 11:00:58 -05:00
config.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
config_test.go Enable errcheck linter for golangci-lint (#8899) 2022-12-05 16:50:49 -06:00
convert.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
convert_test.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
debug.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
debug_test.go Orbit to kill pre-existing osqueryd processes during startup (#16343) 2024-01-29 16:44:50 -03:00
delete.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
delete_test.go Add optimizations for query reports at scale (#14710) 2023-10-25 19:20:27 -03:00
flags.go improve messaging of fleetctl debug errors and archive commands (#5590) 2022-05-10 10:44:06 -03:00
fleetctl.go Move external dependency fleetdm/kolide-kit to monorepo (#15861) 2024-01-02 18:22:52 -03:00
generate.go Allow context and debug flags after fleetctl generate subcommands (#15934) 2024-01-05 12:08:58 -06:00
generate_test.go Allow context and debug flags after fleetctl generate subcommands (#15934) 2024-01-05 12:08:58 -06:00
get.go fleetctl now runs saved queries (#15667) 2023-12-15 12:55:39 -06:00
get_test.go Team host expiry. (#16188) 2024-01-22 10:00:02 -06:00
goquery.go fleetctl now runs saved queries (#15667) 2023-12-15 12:55:39 -06:00
hosts.go Use new error handling approach in other packages (#2954) 2021-11-22 09:13:26 -05:00
hosts_test.go feature: target profiles by labels (#16202) 2024-01-26 11:00:58 -05:00
kill_process.go Download and launch orbit for the current device when starting preview (#2437) 2021-10-15 18:23:06 -03:00
kill_process_windows.go Download and launch orbit for the current device when starting preview (#2437) 2021-10-15 18:23:06 -03:00
login.go Provide feedback to user in fleetctl login when using env vars (#12371) 2023-06-16 11:42:04 -03:00
logout.go Use new error handling approach in other packages (#2954) 2021-11-22 09:13:26 -05:00
logout_test.go Simplify fleetctl implementation and improve testing (#3830) 2022-01-24 16:40:51 -03:00
mdm.go Add hardware serial to host by identifier search (#15353) 2023-11-29 08:39:35 -06:00
mdm_test.go Move nanomdm dependency in monorepo (#16015) 2024-01-11 23:28:48 -03:00
package.go Enroll secret in macOS keychain and Windows Credential Manager (#16068) 2024-01-16 06:51:37 -06:00
package_test.go Add mTLS support to fleetd (#11319) 2023-04-27 08:44:39 -03:00
preview.go Move external dependency osquery-in-a-box to monorepo (#15871) 2024-01-10 11:45:52 -03:00
preview_test.go Move external dependency osquery-in-a-box to monorepo (#15871) 2024-01-10 11:45:52 -03:00
query.go fleetctl now runs saved queries (#15667) 2023-12-15 12:55:39 -06:00
query_output.go add host_display_name to live query rows (#8251) 2022-10-17 15:52:25 +02:00
query_test.go feature: target profiles by labels (#16202) 2024-01-26 11:00:58 -05:00
scripts.go feat: disable script endpoints and add error to cli (#15941) 2024-01-08 16:28:45 -05:00
scripts_test.go Queued scripts feature (#16300) 2024-01-29 11:37:54 -03:00
session_test.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
setup.go Fleet Premium: de-anonymize usage stats (#7013) 2022-08-03 14:44:34 -04:00
testing_utils.go Feat windows msmdm (#14837) 2023-11-01 11:13:12 -03:00
trigger.go Add fleetctl trigger command (#8877) 2022-12-06 09:56:54 -06:00
trigger_test.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
upgrade_packs.go fleetctl now runs saved queries (#15667) 2023-12-15 12:55:39 -06:00
upgrade_packs_test.go Save Query Results to DB (#14335) 2023-10-10 09:44:03 -03:00
user.go Create Bulk Users from CSV (#3372) 2022-06-22 13:34:58 -03:00
users_test.go chore: remove refs to deprecated io/ioutil (#14485) 2023-10-27 15:28:54 -03:00
vulnerability_data_stream.go Use NVD API 2.0 to download CVE information (#15102) 2023-11-21 12:30:07 -06:00
vulnerability_data_stream_test.go Use NVD API 2.0 to download CVE information (#15102) 2023-11-21 12:30:07 -06:00