Osquery x Fleet
What is this about?
Osquery is an open-source instrumentation framework that exposes an operating system as a relational database.
Kolide Fleet is an open-source management server for a fleet of hosts machines running Osquery.
This repo guides you through setting up and running a local Fleet server and enrolling hosts into the fleet.
Requirements
You'll need the following:
Run Kolide Fleet locally
-
Generate a certificate for the Fleet server: run the following command and make sure to set a value for the certificate common name when prompted (the value has to match the hostname or IP address of the server that will run Fleet)
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout ./cert/kolide.key -out ./cert/kolide.cert
-
Setup the environment: create the following environment variables and set values of your choosing
- MYSQL_ROOT_PASSWORD
- MYSQL_PASSWORD
- KOLIDE_AUTH_JWT_KEY
-
Initiate the services: run the following command to create the MySQL, Redis and Fleet services. Note that Fleet will prepare its database then exit, this is the expected behavior.
docker-compose -f docker-compose-init.yml up -d
-
Start Fleet and its dependencies: once Fleet database is initiated, run the following command to bring up MySQL, Redis and the Fleet Server.
docker-compose stop && docker-compose up -d
-
Configure Fleet: open
https://[fleet-server-ip]:8080/setup
in a browser and follow the instructions to create an admin user. -
Grab the Fleet enroll secret: from the Fleet UI, navigate to
Hosts > Add New Host
then copy the enroll secret from theRetrieve Osquery Enroll Secret
section and paste its value into theenroll_secret
file that's alongside this README document.
Enroll a host into Fleet
-
Make the host aware of the Fleet server: edit the
osquery.flags
file that's alongside this README document and replace theCHANGEME
placeholder on line 3 by the hostname or IP address of the Fleet server (value has to match the certificate common name set earlier). -
Create a host: run the following command to create a virtual machine that will act as a host. Osquery daemon will be automatically installed and configured following the virtual machine creation.
vagrant up
-
Check that the host has enrolled successfully: in the Fleet UI, navigate to the
Hosts
section and the host should be right there.
Experiment and have fun
From now on, you can use Fleet to run ad-hoc queries on the fly in the host, to create queries and packs, etc.
It's also possible to use Fleet command-line tool fleetctl
to manage the fleet of hosts.