{"id":8365,"date":"2021-03-22T21:37:25","date_gmt":"2021-03-22T18:37:25","guid":{"rendered":"https:\/\/kifarunix.com\/?p=8365"},"modified":"2024-03-19T18:41:45","modified_gmt":"2024-03-19T15:41:45","slug":"install-fleet-osquery-manager-on-debian-10","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-fleet-osquery-manager-on-debian-10\/","title":{"rendered":"Install Fleet Osquery Manager on Debian 10"},"content":{"rendered":"\n

In this tutorial, you will learn how to install Fleet<\/a> osquery manager on Debian 10. With the official retirement of the Kolide Fleet as on November 4th, 2020, there has been yet another Fleet<\/a> that offers the same functionality as Kolide Fleet. According to its Github repository<\/a>, “Fleet is the most widely used open source osquery manager. Deploying osquery with Fleet enables programmable live queries, streaming logs, and effective management of osquery across 50,000+ servers, containers, and laptops. It’s especially useful for talking to multiple devices at the same time.<\/em>“<\/p>\n\n\n\n

If you are using Ubuntu, you can use the guide below;<\/p>\n\n\n\n

Install Fleet Osquery Manager on Ubuntu 20.04\/Ubuntu 22.04<\/a><\/p>\n\n\n\n

Installing Fleet Osquery Manager on Debian<\/h2>\n\n\n\n

Prerequisites<\/h3>\n\n\n\n

In order to install Fleet osquery manager on Debian, there are a few requirements. In our setup, we will be using Debian 10 as our base OS.<\/p>\n\n\n\n

Install MySQL Database<\/h4>\n\n\n\n

Fleet uses MySQL as its main database<\/p>\n\n\n\n

In this setup, we will use MariaDB database. Hence, create latest MariaDB (currently v10.5) APT repository<\/p>\n\n\n\n

apt install software-properties-common<\/code><\/pre>\n\n\n\n
apt-key adv --fetch-keys https:\/\/mariadb.org\/mariadb_release_signing_key.asc<\/code><\/pre>\n\n\n\n
echo \"deb [arch=amd64,arm64,ppc64el] http:\/\/sfo1.mirrors.digitalocean.com\/mariadb\/repo\/10.5\/debian $(lsb_release -sc) main\" > \/etc\/apt\/sources.list.d\/mariadb-10.5.list<\/code><\/pre>\n\n\n\n

If you need, you can choose other MariaDB mirrors closed to your region<\/a>.<\/p>\n\n\n\n

Update your package cache.<\/p>\n\n\n\n

apt update<\/code><\/pre>\n\n\n\n

Run the command install MariaDB server 10.5 on Debian 10<\/p>\n\n\n\n

apt install mariadb-server<\/code><\/pre>\n\n\n\n
systemctl status mariadb.service<\/code><\/pre>\n\n\n\n

MariaDB is started and enabled to run on system boot upon installation.<\/p>\n\n\n\n

\n\u25cf mariadb.service - MariaDB 10.5.9 database server\n   Loaded: loaded (\/lib\/systemd\/system\/mariadb.service; enabled; vendor preset: enabled)\n  Drop-In: \/etc\/systemd\/system\/mariadb.service.d\n           \u2514\u2500migrated-from-my.cnf-settings.conf\n   Active: active (running) since Mon 2021-03-22 13:19:24 EDT; 10min ago\n     Docs: man:mariadbd(8)\n           https:\/\/mariadb.com\/kb\/en\/library\/systemd\/\n Main PID: 16307 (mariadbd)\n   Status: \"Taking your SQL requests now...\"\n    Tasks: 8 (limit: 1149)\n   Memory: 69.7M\n   CGroup: \/system.slice\/mariadb.service\n           \u2514\u250016307 \/usr\/sbin\/mariadbd\n\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: performance_schema\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: Phase 6\/7: Checking and upgrading tables\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: Processing databases\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: fleetdb\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: information_schema\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: performance_schema\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: Phase 7\/7: Running 'FLUSH PRIVILEGES'\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16330]: OK\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16481]: Checking for insecure root accounts.\nMar 22 13:20:34 debian \/etc\/mysql\/debian-start[16485]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables\n<\/code><\/pre>\n\n\n\n

Create Fleet Database and Database User<\/h4>\n\n\n\n

Run the initial MySQL security script, mysql_secure_installation<\/strong>, to remove anonymous database users, test tables, disable remote root login.<\/p>\n\n\n\n

mysql_secure_installation<\/code><\/pre>\n\n\n\n

By default, MariaDB 10.5 uses unix_socket for authentication by default and hence, can login by just running, mysql -u root<\/strong><\/code>. If have however enabled password authentication, simply run;<\/p>\n\n\n\n

mysql -u root -p<\/code><\/pre>\n\n\n\n

Next, create the Fleet database.<\/p>\n\n\n\n

Note:<\/strong> the database database names used here are not standard. Choose any name of your preference.<\/strong><\/p>\n\n\n\n

create database fleetdb;<\/code><\/pre>\n\n\n\n

Create Fleet database user with all grants on Fleet DB created above.<\/p>\n\n\n\n

grant all on fleetdb.* to fleetadmin@localhost identified by 'StrongP@SS';<\/code><\/pre>\n\n\n\n

Reload privileges tables and exit the database;<\/p>\n\n\n\n

flush privileges;\nexit<\/code><\/pre>\n\n\n\n

Install Redis on Debian 10<\/h4>\n\n\n\n

Fleet uses Redis to ingest and queue the results of distributed queries, cache data, etc.<\/em><\/p>\n\n\n\n

Install Redis on Debian 10 by running the command below;<\/p>\n\n\n\n

apt install redis<\/code><\/pre>\n\n\n\n

Redis server is similarly started upon installation;<\/p>\n\n\n\n

systemctl status redis-server.service<\/code><\/pre>\n\n\n\n
\n\u25cf redis-server.service - Advanced key-value store\n   Loaded: loaded (\/lib\/systemd\/system\/redis-server.service; enabled; vendor preset: enabled)\n   Active: active (running) since Mon 2021-03-22 13:29:24 EDT; 1s ago\n     Docs: http:\/\/redis.io\/documentation,\n           man:redis-server(1)\n  Process: 17869 ExecStart=\/usr\/bin\/redis-server \/etc\/redis\/redis.conf (code=exited, status=0\/SUCCESS)\n Main PID: 17870 (redis-server)\n    Tasks: 4 (limit: 1149)\n   Memory: 2.2M\n   CGroup: \/system.slice\/redis-server.service\n           \u2514\u250017870 \/usr\/bin\/redis-server 127.0.0.1:6379\n\nMar 22 13:29:24 debian systemd[1]: Starting Advanced key-value store...\n<\/code><\/pre>\n\n\n\n

Enable it to run on system boot;<\/p>\n\n\n\n

systemctl enable redis-server<\/code><\/pre>\n\n\n\n

Install Fleet Osquery Manager<\/h3>\n\n\n\n

Install the Fleet binary on Debian 10<\/h4>\n\n\n\n

The Fleet application is distributed as a single static binary. This binary serves:<\/em><\/p>\n\n\n\n