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

flare shipping #1352

Merged
merged 55 commits into from
Oct 12, 2023
Merged

flare shipping #1352

merged 55 commits into from
Oct 12, 2023

Conversation

James-Pickett
Copy link
Contributor

@James-Pickett James-Pickett commented Sep 13, 2023

this PR adds 2 options for flare shipping

  1. Running from the command line with something like sudo /usr/local/kolide-2/bin/launcher flare note=some_note save=upload
  2. Initiate from K2 via a control server update, there is a corresponding k2 pr here though well need to update the k2 side again if want to send down the signed upload url instead of having launcher request it

here is also a PR @directionless is working to support the gcp uploads

@James-Pickett James-Pickett changed the title first pass at flare shipping, needs work flare shipping Sep 13, 2023
cmd/launcher/flare.go Outdated Show resolved Hide resolved
cmd/launcher/flare.go Outdated Show resolved Hide resolved
pkg/debug/checkups/checkups.go Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping_test.go Outdated Show resolved Hide resolved
cmd/launcher/doctor.go Show resolved Hide resolved
cmd/launcher/flare.go Outdated Show resolved Hide resolved
pkg/debug/checkups/checkups.go Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
pkg/debug/flareshipping/flareshipping.go Outdated Show resolved Hide resolved
cmd/launcher/flare.go Outdated Show resolved Hide resolved
RebeccaMahany
RebeccaMahany previously approved these changes Oct 2, 2023
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.

Seems reasonable. Two caveats:

  • I'm not sure what's up with the SetDebugUploadRequestURL
  • I think I want to get 1.1.1 cut first, aim to merge on thurs or something? (Though maybe this is safe to merge with the command line options as they are. Thoughts?)

pkg/agent/flags/flag_controller.go Outdated Show resolved Hide resolved
ee/control/consumers/flareconsumer/flareconsumer.go Outdated Show resolved Hide resolved
ee/control/consumers/flareconsumer/flarerunner.go Outdated Show resolved Hide resolved
pkg/debug/shipper/shipper.go Outdated Show resolved Hide resolved
pkg/debug/shipper/shipper.go Outdated Show resolved Hide resolved
pkg/debug/shipper/shipper.go Outdated Show resolved Hide resolved
cmd/launcher/flare.go Fixed Show fixed Hide fixed
directionless
directionless previously approved these changes Oct 6, 2023
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.

Nice work! I think this is good to merge. A small pile of nits, but I think we can iterate on them in a future PR. I'm sure we'll need to as we get the k2 side moving with it.

cmd/launcher/flare.go Outdated Show resolved Hide resolved
cmd/launcher/flare.go Outdated Show resolved Hide resolved
cmd/launcher/flare.go Outdated Show resolved Hide resolved
ee/control/consumers/flareconsumer/flareconsumer.go Outdated Show resolved Hide resolved
ee/control/consumers/flareconsumer/flareconsumer.go Outdated Show resolved Hide resolved
@@ -250,46 +251,53 @@ func RunDoctor(ctx context.Context, k types.Knapsack, w io.Writer) {
}
}

type runtimeEnvironmentTyp string
type RuntimeEnvironmentType string
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be exported?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, this is how the consumer and cmd line paths define standalone / insitu

Copy link
Contributor

Choose a reason for hiding this comment

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

They shouldn't need the type exported, just the values for it. (Unless it's in a method signature)

Comment on lines 206 to 216
currentUser := "unknown"
consoleUsers, err := consoleuser.CurrentUsers(ctx)

switch {
case err != nil:
currentUser = fmt.Sprintf("error getting current users: %s", err)
case len(consoleUsers) > 0:
currentUser = consoleUsers[0].Username
default: // no console users
currentUser = "no console users"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

If it's run from the command line, it should be in the ENV as USER or SUDO_USER, and if it's insitu, we probably want every consuleUser. not just the first.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't quite understand what this means, we should look in the env or set in the env? Also, what should we do with the ENV?

I updated it to include all console users.

Copy link
Contributor

Choose a reason for hiding this comment

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

The variable was called currentUser, but it was grabbing the first console user. The console users are valuable, but I'm not sure they're the user taking this action. Consider someone remotely ssh'ed into a machine...

AFAIK the only way to tell the user who is taking the action is to either look at something like your process uid, or if it's from a shell examine os.GetEnv("USER"). sudo will also set os.Getenv("SUDO_USER").

I'm not sure what windows does.

ee/control/consumers/flareconsumer/flareconsumer.go Outdated Show resolved Hide resolved
cmd/launcher/flare.go Outdated Show resolved Hide resolved
pkg/debug/shipper/shipper.go Show resolved Hide resolved
pkg/debug/shipper/shipper_test.go Outdated Show resolved Hide resolved
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.

Let's try!

@James-Pickett James-Pickett added this pull request to the merge queue Oct 12, 2023
Merged via the queue into kolide:main with commit 2789a54 Oct 12, 2023
24 checks passed
@James-Pickett James-Pickett deleted the james/flare-shipping branch October 12, 2023 21:11
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.

3 participants