From fd4019630f39ccc5009ff69626590bf0af530c2b Mon Sep 17 00:00:00 2001 From: Alexander Griesser <46035328+anx-ag@users.noreply.github.com> Date: Fri, 6 Jan 2023 07:49:11 +0100 Subject: [PATCH 1/3] Remove superfluous "channel" in comment (#21887) Automatic Merge --- store/sqlstore/channel_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/store/sqlstore/channel_store.go b/store/sqlstore/channel_store.go index ca7575924a..5d6b9e83f3 100644 --- a/store/sqlstore/channel_store.go +++ b/store/sqlstore/channel_store.go @@ -577,7 +577,7 @@ func (s SqlChannelStore) upsertPublicChannelT(transaction *sqlxTxWrapper, channe return nil } -// Save writes the (non-direct) channel channel to the database. +// Save writes the (non-direct) channel to the database. func (s SqlChannelStore) Save(channel *model.Channel, maxChannelsPerTeam int64) (_ *model.Channel, err error) { if channel.DeleteAt != 0 { return nil, store.NewErrInvalidInput("Channel", "DeleteAt", channel.DeleteAt) From 398476138da10ef4ace575650b355ce27ef1dac1 Mon Sep 17 00:00:00 2001 From: Allan Guwatudde Date: Fri, 6 Jan 2023 15:42:17 +0300 Subject: [PATCH 2/3] [MM-48416] - Fix flaky TestRequestTrialLicense - trial license user count less than current users (#21988) --- api4/license_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/api4/license_test.go b/api4/license_test.go index d11fe1b150..fe4d62848e 100644 --- a/api4/license_test.go +++ b/api4/license_test.go @@ -10,7 +10,6 @@ import ( "testing" "time" - "github.com/mattermost/mattermost-server/v6/app" "github.com/mattermost/mattermost-server/v6/app/platform" "github.com/mattermost/mattermost-server/v6/einterfaces/mocks" "github.com/mattermost/mattermost-server/v6/model" @@ -242,7 +241,6 @@ func TestRequestTrialLicense(t *testing.T) { }) t.Run("trial license user count less than current users", func(t *testing.T) { - t.Skip("MM-48416") nUsers := 1 license := model.NewTestLicense() license.Features.Users = model.NewInt(nUsers) @@ -268,9 +266,9 @@ func TestRequestTrialLicense(t *testing.T) { th.App.Srv().Platform().SetLicenseManager(licenseManagerMock) defer func(requestTrialURL string) { - app.RequestTrialURL = requestTrialURL - }(app.RequestTrialURL) - app.RequestTrialURL = testServer.URL + platform.RequestTrialURL = requestTrialURL + }(platform.RequestTrialURL) + platform.RequestTrialURL = testServer.URL resp, err := th.SystemAdminClient.RequestTrialLicense(nUsers) CheckErrorID(t, err, "api.license.add_license.unique_users.app_error") From 3dd934711cabf471e060a55107496f3c9e1ca9a5 Mon Sep 17 00:00:00 2001 From: Tim Scheuermann Date: Mon, 9 Jan 2023 14:34:54 +0100 Subject: [PATCH 3/3] [MM-47187] Certificate auth for Elasticsearch (#21958) --- i18n/en.json | 20 ++++++++++++++++++++ model/config.go | 15 +++++++++++++++ services/telemetry/telemetry.go | 3 +++ 3 files changed, 38 insertions(+) diff --git a/i18n/en.json b/i18n/en.json index b0cf93cf7e..6bf836abe8 100644 --- a/i18n/en.json +++ b/i18n/en.json @@ -7351,6 +7351,26 @@ "id": "ent.elasticsearch.aggregator_worker.index_job_failed.error", "translation": "Elasticsearch aggregator worker failed due to the indexing job failing" }, + { + "id": "ent.elasticsearch.create_client.ca_cert_malformed", + "translation": "Decoding of the CA for Elasticsearch failed" + }, + { + "id": "ent.elasticsearch.create_client.ca_cert_missing", + "translation": "Could not open the CA file for Elasticsearch" + }, + { + "id": "ent.elasticsearch.create_client.client_cert_malformed", + "translation": "Decoding of the client certificate for Elasticsearch failed" + }, + { + "id": "ent.elasticsearch.create_client.client_cert_missing", + "translation": "Could not open the client certificate file for Elasticsearch" + }, + { + "id": "ent.elasticsearch.create_client.client_key_missing", + "translation": "Could not open the client key file for Elasticsearch" + }, { "id": "ent.elasticsearch.create_client.connect_failed", "translation": "Setting up Elasticsearch Client Failed" diff --git a/model/config.go b/model/config.go index 7f9c807562..ad169fcbbf 100644 --- a/model/config.go +++ b/model/config.go @@ -2563,6 +2563,9 @@ type ElasticsearchSettings struct { BatchSize *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` RequestTimeoutSeconds *int `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` SkipTLSVerification *bool `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + CA *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + ClientCert *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` + ClientKey *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` Trace *string `access:"environment_elasticsearch,write_restrictable,cloud_restrictable"` } @@ -2579,6 +2582,18 @@ func (s *ElasticsearchSettings) SetDefaults() { s.Password = NewString(ElasticsearchSettingsDefaultPassword) } + if s.CA == nil { + s.CA = NewString("") + } + + if s.ClientCert == nil { + s.ClientCert = NewString("") + } + + if s.ClientKey == nil { + s.ClientKey = NewString("") + } + if s.EnableIndexing == nil { s.EnableIndexing = NewBool(false) } diff --git a/services/telemetry/telemetry.go b/services/telemetry/telemetry.go index ec88b868c0..860960c379 100644 --- a/services/telemetry/telemetry.go +++ b/services/telemetry/telemetry.go @@ -777,6 +777,9 @@ func (ts *TelemetryService) trackConfig() { "bulk_indexing_batch_size": *cfg.ElasticsearchSettings.BatchSize, "request_timeout_seconds": *cfg.ElasticsearchSettings.RequestTimeoutSeconds, "skip_tls_verification": *cfg.ElasticsearchSettings.SkipTLSVerification, + "isdefault_ca": isDefault(*cfg.ElasticsearchSettings.CA, ""), + "isdefault_client_cert": isDefault(*cfg.ElasticsearchSettings.ClientCert, ""), + "isdefault_client_key": isDefault(*cfg.ElasticsearchSettings.ClientKey, ""), "trace": *cfg.ElasticsearchSettings.Trace, })