Fix orbit panic when auto-updates disabled (#40202)
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #40200 QA done as part of https://github.com/fleetdm/fleet/pull/40142 PR # Checklist for submitter - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. ## Testing - [x] QA'd all new/changed functionality manually ## fleetd/orbit/Fleet Desktop - [x] Verified compatibility with the latest released version of Fleet (see [Must rule](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/workflows/fleetd-development-and-release-strategy.md)) - [x] If the change applies to only one platform, confirmed that `runtime.GOOS` is used as needed to isolate changes - [x] Verified that fleetd runs on macOS, Linux and Windows - [x] Verified auto-update works from the released version of component to the new version (see [tools/tuf/test](../tools/tuf/test/README.md))
This commit is contained in:
@@ -0,0 +1 @@
|
||||
* Fix orbit panic when auto-updates disabled
|
||||
@@ -604,6 +604,7 @@ func main() {
|
||||
// it fetches osqueryd once as part of initialization.
|
||||
var updater *update.Updater
|
||||
var updateRunner *update.Runner
|
||||
var osqueryVersion string
|
||||
if !c.Bool("disable-updates") || c.Bool("dev-mode") {
|
||||
updater, err := update.NewUpdater(opt)
|
||||
if err != nil {
|
||||
@@ -645,6 +646,7 @@ func main() {
|
||||
if err == nil && version != "" {
|
||||
log.Info().Msgf("Found osquery version: %s", version)
|
||||
updateRunner.OsqueryVersion = version
|
||||
osqueryVersion = version
|
||||
}
|
||||
}
|
||||
|
||||
@@ -694,6 +696,10 @@ func main() {
|
||||
if err != nil {
|
||||
log.Fatal().Err(err).Msgf("locate %s", constant.OsqueryTUFTargetName)
|
||||
}
|
||||
if v, err := update.GetVersion(osquerydPath); err == nil && v != "" {
|
||||
log.Info().Msgf("Found osquery version: %s", v)
|
||||
osqueryVersion = v
|
||||
}
|
||||
if c.Bool("fleet-desktop") {
|
||||
if runtime.GOOS == "darwin" {
|
||||
desktopPath, err = updater.DirLocalPath(constant.DesktopTUFTargetName)
|
||||
@@ -924,7 +930,7 @@ func main() {
|
||||
}
|
||||
|
||||
options = append(options,
|
||||
osquery.WithFlags(osquery.FleetFlags(updateRunner.OsqueryVersion, parsedURL)),
|
||||
osquery.WithFlags(osquery.FleetFlags(osqueryVersion, parsedURL)),
|
||||
osquery.WithFlags([]string{"--tls_server_certs", certPath}),
|
||||
)
|
||||
} else if fleetURL != "https://" {
|
||||
@@ -938,7 +944,7 @@ func main() {
|
||||
}
|
||||
|
||||
options = append(options,
|
||||
osquery.WithFlags(osquery.FleetFlags(updateRunner.OsqueryVersion, parsedURL)),
|
||||
osquery.WithFlags(osquery.FleetFlags(osqueryVersion, parsedURL)),
|
||||
)
|
||||
|
||||
if certPath = c.String("fleet-certificate"); certPath != "" {
|
||||
@@ -1090,7 +1096,7 @@ func main() {
|
||||
hostIdentityCertificatePath = hostIdentityCredentials.CertificatePath
|
||||
|
||||
options = append(options,
|
||||
osquery.WithFlags(osquery.FleetFlags(updateRunner.OsqueryVersion, proxy.ParsedURL)),
|
||||
osquery.WithFlags(osquery.FleetFlags(osqueryVersion, proxy.ParsedURL)),
|
||||
|
||||
// This is overriding the previous set of --tls_server_certs in osquery.FleetFlags above.
|
||||
osquery.WithFlags([]string{"--tls_server_certs", proxy.CertificatePath}),
|
||||
|
||||
Reference in New Issue
Block a user