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

set kolide hosted flag #1413

Merged
merged 4 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pkg/debug/checkups/notary.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ func (nc *notaryCheckup) Summary() string { return nc.summary }
func (nc *notaryCheckup) Run(ctx context.Context, extraFH io.Writer) error {
nc.data = make(map[string]any)
if !nc.k.KolideHosted() || !nc.k.Autoupdate() {
nc.status = Unknown
if !nc.k.KolideHosted() {
nc.summary = "not kolide hosted"
} else {
nc.summary = "autoupdates are not enabled"
}

return nil
}

Expand Down
9 changes: 8 additions & 1 deletion pkg/debug/checkups/tuf.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ func (tc *tufCheckup) Summary() string { return tc.summary }

func (tc *tufCheckup) Run(ctx context.Context, extraFH io.Writer) error {
tc.data = make(map[string]any)
if !tc.k.Autoupdate() {
if !tc.k.KolideHosted() || !tc.k.Autoupdate() {
tc.status = Unknown
if !tc.k.KolideHosted() {
tc.summary = "not kolide hosted"
} else {
tc.summary = "autoupdates are not enabled"
}

return nil
}

Expand Down
1 change: 1 addition & 0 deletions pkg/debug/checkups/tuf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func TestRun_Tuf(t *testing.T) {
// Set up mock knapsack
mockKnapsack := typesmocks.NewKnapsack(t)
mockKnapsack.On("Autoupdate").Return(true)
mockKnapsack.On("KolideHosted").Return(true)
mockKnapsack.On("TufServerURL").Return(tufServerUrl)
mockKnapsack.On("UpdateChannel").Return("nightly")
mockKnapsack.On("RootDirectory").Return(tempRootDir)
Expand Down
18 changes: 5 additions & 13 deletions pkg/launcher/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,6 @@ func ParseOptions(subcommandName string, args []string) (*Options, error) {
os.Exit(0)
}

// If launcher is using a kolide host, we may override many of
// the settings. When we're ready, we can _additionally_
// conditionalize this on the ServerURL to get all the
// existing deployments
if *flKolideHosted {
*flTransport = "osquery"
*flOsqTlsConfig = "/api/osquery/v0/config"
*flOsqTlsEnroll = "/api/osquery/v0/enroll"
*flOsqTlsLogger = "/api/osquery/v0/log"
*flOsqTlsDistRead = "/api/osquery/v0/distributed/read"
*flOsqTlsDistWrite = "/api/osquery/v0/distributed/write"
}

// if an osqueryd path was not set, it's likely that we want to use the bundled
// osqueryd path, but if it cannot be found, we will fail back to using an
// osqueryd found in the path
Expand Down Expand Up @@ -352,21 +339,26 @@ func ParseOptions(subcommandName string, args []string) (*Options, error) {
switch {
case *flKolideServerURL == "k2device.kolide.com":
controlServerURL = "k2control.kolide.com"
*flKolideHosted = true

case *flKolideServerURL == "k2device-preprod.kolide.com":
controlServerURL = "k2control-preprod.kolide.com"
*flKolideHosted = true

case strings.HasSuffix(*flKolideServerURL, "herokuapp.com"):
controlServerURL = *flKolideServerURL
*flKolideHosted = true

case *flKolideServerURL == "localhost:3443":
controlServerURL = *flKolideServerURL
// We don't plumb flRootPEM through to the control server, just disable TLS for now
insecureControlTLS = true
*flKolideHosted = true

case *flKolideServerURL == "localhost:3000" || *flIAmBreakingEELicense:
controlServerURL = *flKolideServerURL
disableControlTLS = true
*flKolideHosted = true
}

opts := &Options{
Expand Down
Loading