Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow control server to pin version for osqueryd and launcher #1629

Conversation

RebeccaMahany
Copy link
Contributor

@RebeccaMahany RebeccaMahany commented Feb 27, 2024

Relates to #1577

Some users may want to pin a particular version of osqueryd or launcher. This PR enables that functionality via the TUF autoupdater.

If a pinned version is set, the autoupdater will select that version first. If it cannot find that version, then it will fall back to using the release version for the configured update channel.

While working on this PR, I noticed I had a couple related functions about parsing and comparing versions, so I've moved them into their own file and separated out their tests as well.

Also -- updated to handle control server actions during the initial delay in a clearer and more opinionated way:

  • Flag changes should be noted and stored during the initial delay, but --
  • Autoupdates should never occur during the initial delay

@RebeccaMahany RebeccaMahany force-pushed the becca/control-server-set-update-version branch from 05ed9db to 3c3c73a Compare February 27, 2024 20:50
Copy link
Contributor

@directionless directionless left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still ambivalent about whether we need 3 flags, or 2 flags. But I think I can live with it, and the code looks reasonable.

// versionFromTarget extracts the semantic version for an update from its filename.
func versionFromTarget(binary autoupdatableBinary, targetFilename string) string {
// The target is in the form `launcher-0.13.6.tar.gz` -- trim the prefix and the file extension to return the version
prefixToTrim := fmt.Sprintf("%s-", binary)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could also SplitN

@James-Pickett
Copy link
Contributor

LGTM!

@RebeccaMahany RebeccaMahany marked this pull request as ready for review February 29, 2024 16:05
@RebeccaMahany RebeccaMahany mentioned this pull request Feb 29, 2024
7 tasks
ee/tuf/autoupdate.go Outdated Show resolved Hide resolved
zackattack01
zackattack01 previously approved these changes Feb 29, 2024
Copy link
Contributor

@zackattack01 zackattack01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@RebeccaMahany RebeccaMahany added this pull request to the merge queue Feb 29, 2024
Merged via the queue into kolide:main with commit a3198f4 Feb 29, 2024
20 of 21 checks passed
@RebeccaMahany RebeccaMahany deleted the becca/control-server-set-update-version branch February 29, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants