From fbbafb72837d9902af7b5359430ba7f30a4013fd Mon Sep 17 00:00:00 2001 From: Rebecca Mahany-Horton Date: Wed, 14 Feb 2024 12:13:43 -0500 Subject: [PATCH] Deprecate notary_prefix and notary_url options --- ee/agent/flags/flag_controller.go | 18 ------ ee/agent/flags/flag_controller_test.go | 8 --- ee/agent/flags/keys/keys.go | 2 - ee/agent/types/flags.go | 8 --- ee/agent/types/mocks/flags.go | 56 ------------------- ee/agent/types/mocks/knapsack.go | 56 ------------------- ee/debug/checkups/checkpoint_test.go | 1 - pkg/launcher/options.go | 12 +--- pkg/launcher/options_test.go | 2 - .../kolide_launcher_autoupdate_config.go | 2 - 10 files changed, 3 insertions(+), 162 deletions(-) diff --git a/ee/agent/flags/flag_controller.go b/ee/agent/flags/flag_controller.go index f39c099f2..b49539dc3 100644 --- a/ee/agent/flags/flag_controller.go +++ b/ee/agent/flags/flag_controller.go @@ -423,15 +423,6 @@ func (fc *FlagController) Autoupdate() bool { return NewBoolFlagValue(WithDefaultBool(fc.cmdLineOpts.Autoupdate)).get(fc.getControlServerValue(keys.Autoupdate)) } -func (fc *FlagController) SetNotaryServerURL(url string) error { - return fc.setControlServerValue(keys.NotaryServerURL, []byte(url)) -} -func (fc *FlagController) NotaryServerURL() string { - return NewStringFlagValue( - WithDefaultString(fc.cmdLineOpts.NotaryServerURL), - ).get(fc.getControlServerValue(keys.NotaryServerURL)) -} - func (fc *FlagController) SetTufServerURL(url string) error { return fc.setControlServerValue(keys.TufServerURL, []byte(url)) } @@ -471,15 +462,6 @@ func (fc *FlagController) UpdateChannel() string { ).get(fc.getControlServerValue(keys.UpdateChannel)) } -func (fc *FlagController) SetNotaryPrefix(prefix string) error { - return fc.setControlServerValue(keys.NotaryPrefix, []byte(prefix)) -} -func (fc *FlagController) NotaryPrefix() string { - return NewStringFlagValue( - WithDefaultString(fc.cmdLineOpts.NotaryPrefix), - ).get(fc.getControlServerValue(keys.NotaryPrefix)) -} - func (fc *FlagController) SetAutoupdateInitialDelay(delay time.Duration) error { return fc.setControlServerValue(keys.AutoupdateInitialDelay, durationToBytes(delay)) } diff --git a/ee/agent/flags/flag_controller_test.go b/ee/agent/flags/flag_controller_test.go index 8dcb3e22b..9501ed845 100644 --- a/ee/agent/flags/flag_controller_test.go +++ b/ee/agent/flags/flag_controller_test.go @@ -147,14 +147,10 @@ func TestControllerStringFlags(t *testing.T) { assert.Equal(t, expectedValue, value) value = fc.ControlServerURL() assert.Equal(t, expectedValue, value) - value = fc.NotaryServerURL() - assert.Equal(t, expectedValue, value) value = fc.TufServerURL() assert.Equal(t, expectedValue, value) value = fc.MirrorServerURL() assert.Equal(t, expectedValue, value) - value = fc.NotaryPrefix() - assert.Equal(t, expectedValue, value) value = fc.UpdateDirectory() assert.Equal(t, expectedValue, value) } @@ -165,14 +161,10 @@ func TestControllerStringFlags(t *testing.T) { require.NoError(t, err) err = fc.SetControlServerURL(tt.valueToSet) require.NoError(t, err) - err = fc.SetNotaryServerURL(tt.valueToSet) - require.NoError(t, err) err = fc.SetTufServerURL(tt.valueToSet) require.NoError(t, err) err = fc.SetMirrorServerURL(tt.valueToSet) require.NoError(t, err) - err = fc.SetNotaryPrefix(tt.valueToSet) - require.NoError(t, err) err = fc.SetUpdateDirectory(tt.valueToSet) require.NoError(t, err) diff --git a/ee/agent/flags/keys/keys.go b/ee/agent/flags/keys/keys.go index faee4f0cc..839cd8d86 100644 --- a/ee/agent/flags/keys/keys.go +++ b/ee/agent/flags/keys/keys.go @@ -38,12 +38,10 @@ const ( WatchdogMemoryLimitMB FlagKey = "watchdog_memory_limit_mb" WatchdogUtilizationLimitPercent FlagKey = "watchdog_utilization_limit_percent" Autoupdate FlagKey = "autoupdate" - NotaryServerURL FlagKey = "notary_url" TufServerURL FlagKey = "tuf_url" MirrorServerURL FlagKey = "mirror_url" AutoupdateInterval FlagKey = "autoupdate_interval" UpdateChannel FlagKey = "update_channel" - NotaryPrefix FlagKey = "notary_prefix" AutoupdateInitialDelay FlagKey = "autoupdater_initial_delay" UpdateDirectory FlagKey = "update_directory" ExportTraces FlagKey = "export_traces" diff --git a/ee/agent/types/flags.go b/ee/agent/types/flags.go index 78843f47f..7fadf3e40 100644 --- a/ee/agent/types/flags.go +++ b/ee/agent/types/flags.go @@ -153,10 +153,6 @@ type Flags interface { SetAutoupdate(enabled bool) error Autoupdate() bool - // NotaryServerURL is the URL for the Notary server. - SetNotaryServerURL(url string) error - NotaryServerURL() string - // TufServerURL is the URL for the tuf server. SetTufServerURL(url string) error TufServerURL() string @@ -173,10 +169,6 @@ type Flags interface { SetUpdateChannel(channel string) error UpdateChannel() string - // NotaryPrefix is the path prefix used to store launcher and osqueryd binaries on the Notary server - SetNotaryPrefix(prefix string) error - NotaryPrefix() string - // AutoupdateInitialDelay set an initial startup delay on the autoupdater process. SetAutoupdateInitialDelay(delay time.Duration) error AutoupdateInitialDelay() time.Duration diff --git a/ee/agent/types/mocks/flags.go b/ee/agent/types/mocks/flags.go index 63a4bfad0..a87df6f1a 100644 --- a/ee/agent/types/mocks/flags.go +++ b/ee/agent/types/mocks/flags.go @@ -482,34 +482,6 @@ func (_m *Flags) MirrorServerURL() string { return r0 } -// NotaryPrefix provides a mock function with given fields: -func (_m *Flags) NotaryPrefix() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// NotaryServerURL provides a mock function with given fields: -func (_m *Flags) NotaryServerURL() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // OsqueryFlags provides a mock function with given fields: func (_m *Flags) OsqueryFlags() []string { ret := _m.Called() @@ -1015,34 +987,6 @@ func (_m *Flags) SetMirrorServerURL(url string) error { return r0 } -// SetNotaryPrefix provides a mock function with given fields: prefix -func (_m *Flags) SetNotaryPrefix(prefix string) error { - ret := _m.Called(prefix) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(prefix) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SetNotaryServerURL provides a mock function with given fields: url -func (_m *Flags) SetNotaryServerURL(url string) error { - ret := _m.Called(url) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(url) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // SetOsqueryHealthcheckStartupDelay provides a mock function with given fields: delay func (_m *Flags) SetOsqueryHealthcheckStartupDelay(delay time.Duration) error { ret := _m.Called(delay) diff --git a/ee/agent/types/mocks/knapsack.go b/ee/agent/types/mocks/knapsack.go index 0638960b8..4116eefab 100644 --- a/ee/agent/types/mocks/knapsack.go +++ b/ee/agent/types/mocks/knapsack.go @@ -612,34 +612,6 @@ func (_m *Knapsack) MirrorServerURL() string { return r0 } -// NotaryPrefix provides a mock function with given fields: -func (_m *Knapsack) NotaryPrefix() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - -// NotaryServerURL provides a mock function with given fields: -func (_m *Knapsack) NotaryServerURL() string { - ret := _m.Called() - - var r0 string - if rf, ok := ret.Get(0).(func() string); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(string) - } - - return r0 -} - // OsqueryFlags provides a mock function with given fields: func (_m *Knapsack) OsqueryFlags() []string { ret := _m.Called() @@ -1225,34 +1197,6 @@ func (_m *Knapsack) SetMirrorServerURL(url string) error { return r0 } -// SetNotaryPrefix provides a mock function with given fields: prefix -func (_m *Knapsack) SetNotaryPrefix(prefix string) error { - ret := _m.Called(prefix) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(prefix) - } else { - r0 = ret.Error(0) - } - - return r0 -} - -// SetNotaryServerURL provides a mock function with given fields: url -func (_m *Knapsack) SetNotaryServerURL(url string) error { - ret := _m.Called(url) - - var r0 error - if rf, ok := ret.Get(0).(func(string) error); ok { - r0 = rf(url) - } else { - r0 = ret.Error(0) - } - - return r0 -} - // SetOsqueryHealthcheckStartupDelay provides a mock function with given fields: delay func (_m *Knapsack) SetOsqueryHealthcheckStartupDelay(delay time.Duration) error { ret := _m.Called(delay) diff --git a/ee/debug/checkups/checkpoint_test.go b/ee/debug/checkups/checkpoint_test.go index 7bd878525..1380f09e6 100644 --- a/ee/debug/checkups/checkpoint_test.go +++ b/ee/debug/checkups/checkpoint_test.go @@ -27,7 +27,6 @@ func TestInterrupt_Multiple(t *testing.T) { mockKnapsack.On("InModernStandby").Return(false).Maybe() mockKnapsack.On("RootDirectory").Return("").Maybe() mockKnapsack.On("Autoupdate").Return(true).Maybe() - mockKnapsack.On("NotaryServerURL").Return("localhost").Maybe() mockKnapsack.On("LatestOsquerydPath").Return("").Maybe() mockKnapsack.On("ServerProvidedDataStore").Return(nil).Maybe() checkupLogger := NewCheckupLogger(log.NewNopLogger(), mockKnapsack) diff --git a/pkg/launcher/options.go b/pkg/launcher/options.go index 368471802..31089810c 100644 --- a/pkg/launcher/options.go +++ b/pkg/launcher/options.go @@ -77,8 +77,6 @@ type Options struct { // Autoupdate enables the autoupdate functionality. Autoupdate bool - // NotaryServerURL is the URL for the Notary server. - NotaryServerURL string // TufServerURL is the URL for the tuf server. TufServerURL string // MirrorServerURL is the URL for the Notary mirror. @@ -88,8 +86,6 @@ type Options struct { AutoupdateInterval time.Duration // UpdateChannel is the channel to pull options from (stable, beta, nightly). UpdateChannel autoupdate.UpdateChannel - // NotaryPrefix is the path prefix used to store launcher and osqueryd binaries on the Notary server - NotaryPrefix string // AutoupdateInitialDelay set an initial startup delay on the autoupdater process. AutoupdateInitialDelay time.Duration // UpdateDirectory is the location of the update libraries for osqueryd and launcher @@ -247,12 +243,10 @@ func ParseOptions(subcommandName string, args []string) (*Options, error) { // Autoupdate options flAutoupdate = flagset.Bool("autoupdate", DefaultAutoupdate, "Whether or not the osquery autoupdater is enabled (default: false)") - flNotaryServerURL = flagset.String("notary_url", autoupdate.DefaultNotary, "The Notary update server (default: https://notary.kolide.co)") flTufServerURL = flagset.String("tuf_url", DefaultTufServer, "TUF update server (default: https://tuf.kolide.com)") flMirrorURL = flagset.String("mirror_url", autoupdate.DefaultMirror, "The mirror server for autoupdates (default: https://dl.kolide.co)") flAutoupdateInterval = flagset.Duration("autoupdate_interval", 1*time.Hour, "The interval to check for updates (default: once every hour)") flUpdateChannel = flagset.String("update_channel", "stable", "The channel to pull updates from (options: stable, beta, nightly)") - flNotaryPrefix = flagset.String("notary_prefix", autoupdate.DefaultNotaryPrefix, "The prefix for Notary path that contains the collections (default: kolide/)") flAutoupdateInitialDelay = flagset.Duration("autoupdater_initial_delay", 1*time.Hour, "Initial autoupdater subprocess delay") flUpdateDirectory = flagset.String("update_directory", "", "Local directory to hold updates for osqueryd and launcher") @@ -270,7 +264,9 @@ func ParseOptions(subcommandName string, args []string) (*Options, error) { _ = flagset.String("debug_log_file", "", "DEPRECATED") _ = flagset.Bool("control", false, "DEPRECATED") _ = flagset.String("control_hostname", "", "DEPRECATED") - _ = flagset.Bool("disable_control_tls", false, "Disable TLS encryption for the control features") + _ = flagset.Bool("disable_control_tls", false, "DEPRECATED") + _ = flagset.String("notary_url", autoupdate.DefaultNotary, "DEPRECATED") + _ = flagset.String("notary_prefix", autoupdate.DefaultNotaryPrefix, "DEPRECATED") ) flagset.Var(&flOsqueryFlags, "osquery_flag", "Flags to pass to osquery (possibly overriding Launcher defaults)") @@ -406,8 +402,6 @@ func ParseOptions(subcommandName string, args []string) (*Options, error) { LogMaxBytesPerBatch: *flLogMaxBytesPerBatch, LoggingInterval: *flLoggingInterval, MirrorServerURL: *flMirrorURL, - NotaryPrefix: *flNotaryPrefix, - NotaryServerURL: *flNotaryServerURL, TufServerURL: *flTufServerURL, OsqueryFlags: flOsqueryFlags, OsqueryTlsConfigEndpoint: *flOsqTlsConfig, diff --git a/pkg/launcher/options_test.go b/pkg/launcher/options_test.go index dcde40236..85bb5d330 100644 --- a/pkg/launcher/options_test.go +++ b/pkg/launcher/options_test.go @@ -255,8 +255,6 @@ func getArgsAndResponse() (map[string]string, *Options) { KolideServerURL: randomHostname, LoggingInterval: time.Duration(randomInt) * time.Second, MirrorServerURL: "https://dl.kolide.co", - NotaryPrefix: "kolide", - NotaryServerURL: "https://notary.kolide.co", TufServerURL: "https://tuf.kolide.com", OsquerydPath: windowsAddExe("/dev/null"), OsqueryHealthcheckStartupDelay: 10 * time.Minute, diff --git a/pkg/osquery/table/kolide_launcher_autoupdate_config.go b/pkg/osquery/table/kolide_launcher_autoupdate_config.go index fca18d575..612d10182 100644 --- a/pkg/osquery/table/kolide_launcher_autoupdate_config.go +++ b/pkg/osquery/table/kolide_launcher_autoupdate_config.go @@ -12,7 +12,6 @@ const launcherAutoupdateConfigTableName = "kolide_launcher_autoupdate_config" func LauncherAutoupdateConfigTable(flags types.Flags) *table.Plugin { columns := []table.ColumnDefinition{ table.TextColumn("autoupdate"), - table.TextColumn("notary_server_url"), table.TextColumn("mirror_server_url"), table.TextColumn("tuf_server_url"), table.TextColumn("autoupdate_interval"), @@ -35,7 +34,6 @@ func generateLauncherAutoupdateConfigTable(flags types.Flags) table.GenerateFunc return []map[string]string{ { "autoupdate": boolToString(flags.Autoupdate()), - "notary_server_url": flags.NotaryServerURL(), "mirror_server_url": flags.MirrorServerURL(), "tuf_server_url": flags.TufServerURL(), "autoupdate_interval": flags.AutoupdateInterval().String(),