In this blog post we will be installing, setting up, and utilizing Kolide Fleet as our OSQuery fleet manager. As stated by Kolide, ” Fleet is a state of the art host monitoring platform tailored for security experts. Leveraging Facebook’s battle-tested OSQuery project, Fleet delivers fast answers to big questions.” In future blog posts I plan on using this tool for incident response and threat hunting scenarios.
Kolide terms
- Node– A single machine
- Fleet – All the machines controlled and owned by an enterprise
- Queries – A query runs a set of tasks on fleet of machines on a specified interval
- Distributed queries – An on the fly query
- Packs – Group queries into packs to perform ongoing monitoring.
Install/Setup Kolide on Ubuntu 16.04
Ansible deployment – production
- git clone https://github.com/Benster900/BlogPosts/Kolide.git
- cd Kolide
- mv group_vars/all.example group_vars/all
- vim group_vars/all and set:
- timezone
- fleet_hostname
- graylog_hostname
- base_domain
- openssl rand -base64 32
- Copy the output from above
- mv group_vars/kolide.example group_vars/kolide
- vim group_vars/kolide and set:
- kolide_jwt_key to output from above
- Set necessary information for Kolide, MySQL
- Set information for certificate
- vim hosts
- Set “ansible_ssh_host” with Kolide’s IP addr under [kolide]
- ansible-playbook -i hosts deploy_kolide.yml -u <username>
Kolide webGUI setup
- Browse to “https://<Hostname/IP addr of Kolide>”
- Setup user
- Enter a username
- Enter a password
- Enter an e-mail
- Select “submit”
- Setup organization
- Enter organization name
- Enter url
- NOT the URL of Kolide
- Select “Submit”
- Set Kolide URL
- Enter “https://<fleet_hostname>.<base_domain>
- Select “Submit”
- Finish
- Select “Finish”
OSQuery Windows client deployment
Prep setup
- Browse to https://<Hostname/IP addr of Kolide>
- Select “Add new host” in top right
- Select “Reveal secret” and copy the string
- vim group_vars/agents and set:
- osquery_enroll_secret with string from Kolide
Windows deployment
- Copy contents of /etc/nginx/ssl/kolide.crt on Kolide server
- mv conf/agents/certificate.example conf/agents/certificate.crt
- vim conf/agents/certificate.crt and paste contents
- I WISH I had a better method :/
- mv group_vars/win_agents.example group_vars/win_agents
- vim group_vars/win_agents and set:
- ansible_user
- ansible_password
- vim hosts
- Set “ansible_ssh_host” to the Windows machine IP addr under “[win_agents]”
- ansible-playbook -i hosts deploy_windows_osquery_agents.yml
Linux deployment
Ubuntu 16.04 Desktop/Server OSQuery agent deployment
- vim hosts
- Set “ansible_ssh_host” to Ubuntu’s IP addr under “[linux_agents]”
- ansible-playbook -i hosts deploy_linux_osquery_agents.yml -u <user>
Centos 7.4 OSQuery agent deployment
- vim hosts
- Set “ansible_ssh_host” to Ubuntu’s IP addr under “[linux_agents]”
- ansible-playbook -i hosts deploy_linux_osquery_agents.yml -u <user>
Kolide webGUI features
Creating OSQuery query
- Browse to “https://<Hostname/IP addr of Kolide>” and login
- Select “Query” on the left then “New Query”
- Enter “Get host processes”
- Enter “SELECT * FROM processes;” into SQL
- Kolide will provide tables as you type
- Select “All hosts” for targets
- OPTIONAL – Select “Run” to test query
- Select “Save” then “Save as new
- Select “Query” on the left then “Manage Queries”
Creating OSQuery pack
- Select “Packs” on the left then “New Pack”
- Enter “test” for Query Pack Title
- Select “All hosts” for targets
- Select “Save query pack”
- On the left select “Select query” under “Choose Query” for a drop down menu of pre-created queries
- Select “Get host processes”
- Enter “300” for interval(in seconds)
- Select “All” for platforms
- Select “All” for minimum OSQuery version
- Select “Differential” for logging
- Differential means the OSQuery agent will ONLY send data if state of query changes.
- Select “Save”
Install/Setup Graylog on Ubuntu 16.04
Ansible deployment – prod
- mv group_vars/graylog.example group_vars/graylog
- vim group_vars/graylog set:
- Graylog_admin_password
- graylog_admin_password can not contain special characters: (,),;
- Graylog_admin_password
- vim hosts and set:
- Set “ansible_ssh_host” to Graylog’s IP addr under [graylog]
- ansible-playbook -i hosts deploy_graylog.yml -u <username>
Setup/Configure Graylog
Create Graylog input
- Browse to https://<graylog FQDN> and login
- Select “System” then “Inputs”
- Select “Beats” for input then “Launch new input”
- Select “<node>” for Node
- Enter “Beats input” for title
- Leave default for bind address
- Leave default for port
- Select “save”
Create Graylog stream
- Select “Streams” at the top
- Select “Create stream”
- Enter “OSQuery stream” for title
- Enter “OSQuery results from daemons” for description
- Select “Default index set” for index set
- Select “Save”
- Select “Start stream” for “OSQuery stream”
- Select “Manage Rules” for “OSQuery stream”
- Select “Add stream rule”
- Enter “tool” for Field
- Select “match exactly” for type
- Enter “osquery” for value
- Select “save”
Install/Setup Filebeat on Kolide
- vim deploy_kolide.yml and UNcomment “#- import_tasks: roles/kolide/filebeat.yml”
- vim drop filebeat.yml config into conf/filebeat/filebeat.yml
- A slightly modified config is provided but is not recommended for production
- Custom config MUST include a field of “tool: osquery”.
- ansible-playbook -i hosts deploy_kolide.yml -u <username>
You should try and publish your articles to medium.com. It allows for readers to subscribe easily and bookmark your articles. Plus, you get a much larger audience.
Hey Aun,
Thanks for the suggestion but I am to invested into WordPress at this moment. However, I will try and add an RSS feed to my blog. Enjoy your day!
Good work on the instructions so far. I have been using your work in my own personal lab. However, i am at a stand still.
In Ansible deployment – production
1. Is ansible run in python virtualenv
a. ansible-playbook -i hosts deploy_kolide.yml -u
mine [(.venv)root@user:~/File/Kolide/group_vars#ansible-playbook -i hosts
deploy_kolide.yml -u
2. In 9, can you be a little more specific about the
Kolide’s IP addr under [kolide]
a. Where is the IP address located?
3.
Hey Ralph Lawrence,
Question 1:
I installed Ansible using pip but NOT in a virtualenv. You can choose to run it in a virtualenv but my guide does not use virtualenv so you may run into issues.
Question 2:
The Kolide IP address is the IP address of the machine you want to install Kolide on. To find the IP address you can run “ip a” on the machine.