2023-07-22 00:33:31 +00:00
# Run locally built Fleetd
2023-01-19 16:31:24 +00:00
(MacOS)
2023-07-22 00:33:31 +00:00
### Run fleet server (and the released Fleetd).
In order to run a local agent (Fleetd + osquery) the first step is to run the Fleet server locally.
2023-01-19 16:31:24 +00:00
Follow this document which will run it together with the released agent.
https://fleetdm.com/docs/contributing/building-fleet
2023-07-22 00:33:31 +00:00
### Modify the Fleetd code as needed
2023-01-19 16:31:24 +00:00
### Build and run locally.
2023-07-22 00:33:31 +00:00
In order to use a local version we need to create a local TUF service that will point the installer to take the local Fleetd (instead of the official one).
2023-01-19 16:31:24 +00:00
More details on TUF testing is here:
https://github.com/fleetdm/fleet/tree/main/tools/tuf/test
### MacOS - Prepare a script file with this content. Call it my_build.sh:
2023-09-22 21:57:40 +00:00
```sh
2023-01-19 16:31:24 +00:00
SYSTEMS="macos" \
PKG_FLEET_URL=https://localhost:8080 \
PKG_TUF_URL=http://localhost:8081 \
GENERATE_PKG=1 \
ENROLL_SECRET=< REPLACE WITH REAL SECRET KEY > \
FLEET_DESKTOP=1 \
2023-04-27 11:44:39 +00:00
USE_FLEET_SERVER_CERTIFICATE=1 \
2023-01-19 16:31:24 +00:00
./tools/tuf/test/main.sh
```
2023-07-22 00:33:31 +00:00
2023-01-19 16:31:24 +00:00
### Get a real secret key
Go to your local Fleet desktop:
https://localhost:8080/hosts/manage/?order_key=display_name& order_direction=asc
Get the secret key by clicking the __Manage Enroll Secret__
Put the real key here: ```ENROLL_SECRET=< REPLACE WITH REAL SECRET KEY > ```
### Remove previous local TUF
If you already have a local TUF running, remove it.
2023-09-22 21:57:40 +00:00
```sh
rm -rf test_tuf
```
2023-01-19 16:31:24 +00:00
### Run the local build
chmod +x my_build.sh
./my_build.sh
### What your build does now
- Download OSQ from github
2023-07-22 00:33:31 +00:00
- Build Fleetd from local src code
2023-01-19 16:31:24 +00:00
- Build fleet desktop from local src code
- Push these three things to the local TUF repository
- Create a local file server to serve the local TUF repository
- Run fleetctl package but instead of the official TUF, it fetches the target from the local TUF
- → the end result is the installer located in ```/Your-Repo-Folder/fleet/fleet-osquery.pkg```
### Install it
2023-07-22 00:33:31 +00:00
Double-click this pkg file and install the local Fleetd.
2023-01-19 16:31:24 +00:00
### Run osquery directly from the Orbit shell
```sudo orbit shell```
< meta name = "pageOrderInSection" value = "100" >
2023-07-13 16:57:17 +00:00
< meta name = "description" value = "Learn how to build and run Fleetd with modified code." >