mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Related to #11534 this is an extract from the code I used to build a prototype to see if `swiftDialog` would work for us. This is very similar to the work we did for Nudge previously. |
||
|---|---|---|
| .. | ||
| create_repository.sh | ||
| gen_pkgs.sh | ||
| main.sh | ||
| Nudge-auto-update-test-guide.md | ||
| Orbit-auto-update-test-guide.md | ||
| push_target.sh | ||
| README.md | ||
| run_server.sh | ||
Testing TUF
Scripts in this directory aim to ease the testing of Orbit and the TUF system.
WARNING: All of these scripts are for testing only, they are not safe for production use.
Setup
- The script is executed on a macOS host.
- Fleet server also running on the same macOS host.
- All VMs (and the macOS host itself) are configured to resolve
host.docker.internalto the macOS host IP (by modifying theirhostsfile).
PS: We use
host.docker.internalbecause the testing certificate./tools/osquery/fleet.crthas such hostname (andlocalhost) defined as SANs.
Run
The main.sh creates and runs the TUF repository and optionally generate the installers (GENERATE_PKGS):
SYSTEMS="macos windows linux" \
PKG_FLEET_URL=https://localhost:8080 \
PKG_TUF_URL=http://localhost:8081 \
DEB_FLEET_URL=https://host.docker.internal:8080 \
DEB_TUF_URL=http://host.docker.internal:8081 \
RPM_FLEET_URL=https://host.docker.internal:8080 \
RPM_TUF_URL=http://host.docker.internal:8081 \
MSI_FLEET_URL=https://host.docker.internal:8080 \
MSI_TUF_URL=http://host.docker.internal:8081 \
GENERATE_PKG=1 \
GENERATE_DEB=1 \
GENERATE_RPM=1 \
GENERATE_MSI=1 \
ENROLL_SECRET=6/EzU/+jPkxfTamWnRv1+IJsO4T9Etju \
FLEET_DESKTOP=1 \
USE_FLEET_SERVER_CERTIFICATE=1 \
./tools/tuf/test/main.sh
Separate
*_FLEET_URLand*_TUF_URLvariables are defined for each package type to support different setups.
Add new updates
To add new updates (osqueryd or orbit), use push_target.sh.
E.g. to add a new version of orbit for Windows:
# Compile a new version of Orbit:
GOOS=windows GOARCH=amd64 go build -o orbit-windows.exe ./orbit/cmd/orbit
# Push the compiled Orbit as a new version
./tools/tuf/test/push_target.sh windows orbit orbit-windows.exe 43
E.g. to add a new version of osqueryd for macOS:
# Generate osqueryd app bundle.
make osqueryd-app-tar-gz version=5.5.1 out-path=.
# Push the osqueryd target as a new version
./tools/tuf/test/push_target.sh macos-app osqueryd osqueryd.app.tar.gz 5.5.1
E.g. to add a new version of desktop for macOS:
# Compile a new version of fleet-desktop
make desktop-app-tar-gz
# Push the desktop target as a new version
./tools/tuf/test/push_target.sh macos desktop desktop.app.tar.gz 43