Toni Sanmateu
05/07/2025, 12:51 PMToni Sanmateu
05/07/2025, 12:55 PMosquery.conf
file:
{
"schedule": {
"os_version_check": {
"query": "SELECT name AS os_name, version AS os_version FROM os_version;",
"interval": 10,
"platform": "all"
}
}
}
Toni Sanmateu
05/07/2025, 12:56 PMosquery.flags
file:
--host_identifier=uuid
--config_plugin=filesystem
--config_path=/var/osquery/osquery.conf
--disable_enrollment=true
--watchdog_memory_limit=200
--watchdog_utilization_limit=70
--watchdog_delay=60
--logger_snapshot_event_type=true
--disable_events=false
--schedule_splay_percent=10
--logger_plugin=tls
--logger_tls_period=10
--logger_tls_max=5000
--tls_hostname=<hostname>
--logger_tls_endpoint=</endpoint>
--tls_server_certs=/private/etc/ssl/cert.pem
Toni Sanmateu
05/07/2025, 12:58 PMpostinstall
script:
set -e
echo "[postinstall] Starting Orbit Agent setup..."
# 1. Symlink the orbit binary to the expected location
ln -sf /opt/orbit/bin/orbit/macos/stable/orbit /opt/orbit/bin/orbit/orbit
ln -sf /opt/orbit/bin/orbit/orbit /usr/local/bin/orbit
echo "[postinstall] Symlinked orbit binary."
# 2. Symlink osqueryd to /opt/orbit/bin/osqueryd
ln -sf /opt/orbit/bin/osqueryd/macos-app/stable/osquery.app/Contents/MacOS/osqueryd /opt/orbit/bin/osqueryd
chmod +x /opt/orbit/bin/osqueryd
echo "[postinstall] Symlinked osqueryd binary."
# 3. Place osquery.conf in /var/osquery/
mkdir -p /var/osquery
cp "$(dirname "$0")/osquery.conf" /var/osquery/osquery.conf
chmod 600 /var/osquery/osquery.conf
chown root:wheel /var/osquery/osquery.conf
echo "[postinstall] Installed osquery.conf."
# 4. Create log directory and files
mkdir -p /var/log/osquery
touch /var/log/osquery/osqueryd.results.log
touch /var/log/osquery/osqueryd.INFO
chmod 644 /var/log/osquery/osqueryd.*
chown root:wheel /var/log/osquery/osqueryd.*
echo "[postinstall] Created osquery log files."
# 5. Inject environment variable into Orbit LaunchDaemon plist
DAEMON_LABEL="com.fleetdm.orbit"
DAEMON_PLIST="/Library/LaunchDaemons/${DAEMON_LABEL}.plist"
ENV_KEY="FLEETD_SILENCE_ENROLL_ERROR"
ENV_VAL="1"
/usr/libexec/PlistBuddy -c "Add :EnvironmentVariables dict" "${DAEMON_PLIST}" 2>/dev/null || true
/usr/libexec/PlistBuddy -c "Set :EnvironmentVariables:${ENV_KEY} ${ENV_VAL}" "${DAEMON_PLIST}" || \
/usr/libexec/PlistBuddy -c "Add :EnvironmentVariables:${ENV_KEY} string ${ENV_VAL}" "${DAEMON_PLIST}"
chown root:wheel "${DAEMON_PLIST}"
chmod 644 "${DAEMON_PLIST}"
echo "[postinstall] Injected environment variable ${ENV_KEY}=${ENV_VAL} into Orbit plist."
# 6. Bootstrap LaunchDaemon
pkill fleet-desktop || true
launchctl bootout "system/${DAEMON_LABEL}" || true
launchctl enable "system/${DAEMON_LABEL}"
count=0
while ! launchctl bootstrap system "${DAEMON_PLIST}"; do
sleep 1
((count++))
if [[ $count -eq 30 ]]; then
echo "[postinstall] Failed to bootstrap ${DAEMON_PLIST}"
exit 1
fi
echo "[postinstall] Retrying launchctl bootstrap..."
done
launchctl kickstart "system/${DAEMON_LABEL}"
echo "[postinstall] Orbit agent started via launchd!"
Kathy Satterlee
05/07/2025, 2:15 PMToni Sanmateu
05/07/2025, 2:28 PMToni Sanmateu
05/07/2025, 2:47 PM➜ ~ sudo launchctl list | grep orbit
- 0 com.fleetdm.orbit
Getting quite a few system logs from orbit (see image). No "enroll failed error"Toni Sanmateu
05/07/2025, 2:50 PMToni Sanmateu
05/07/2025, 3:02 PMToni Sanmateu
05/07/2025, 8:53 PMUnthread
05/07/2025, 10:32 PMToni Sanmateu
05/07/2025, 10:55 PMKathy Satterlee
05/08/2025, 2:55 PMToni Sanmateu
05/08/2025, 5:59 PMToni Sanmateu
05/08/2025, 6:10 PM