From a137821862ea7f78888d4ea5eb3e5b3ff4c8138b Mon Sep 17 00:00:00 2001 From: Michal Klos Date: Fri, 14 Aug 2026 13:09:46 +0200 Subject: [PATCH] feat: [stable-8.2][OCISDEV-1115] harden nats communication (#12792) feat: [OCISDEV-1115] harden nats communication (#12777) * feat: [OCISDEV-1115] harden nats communication * feat: bump reva for tls-enabled stores --- changelog/unreleased/enhancement-nats-tls.md | 8 +++ ocis-pkg/natsjsregistry/registry.go | 34 +++++++-- ocis-pkg/shared/shared_types.go | 7 +- services/activitylog/pkg/command/server.go | 1 + services/activitylog/pkg/config/config.go | 7 +- services/collaboration/pkg/command/server.go | 1 + services/collaboration/pkg/config/store.go | 7 +- services/eventhistory/pkg/command/server.go | 1 + services/eventhistory/pkg/config/config.go | 7 +- services/gateway/pkg/config/config.go | 7 +- services/gateway/pkg/revaconfig/config.go | 7 +- services/graph/pkg/config/cache.go | 7 +- services/graph/pkg/service/v0/service.go | 1 + services/notifications/pkg/command/server.go | 1 + services/notifications/pkg/config/config.go | 7 +- services/ocs/pkg/config/config.go | 7 +- services/ocs/pkg/server/http/server.go | 1 + services/postprocessing/pkg/command/server.go | 1 + services/postprocessing/pkg/config/config.go | 7 +- services/proxy/pkg/command/server.go | 2 + services/proxy/pkg/config/config.go | 14 ++-- services/settings/pkg/config/config.go | 7 +- services/settings/pkg/store/metadata/cache.go | 2 + .../storage-publiclink/pkg/config/config.go | 7 +- .../pkg/revaconfig/config.go | 7 +- services/storage-system/pkg/config/config.go | 7 +- .../storage-system/pkg/revaconfig/config.go | 7 +- services/storage-users/pkg/config/config.go | 14 ++-- .../storage-users/pkg/revaconfig/drivers.go | 70 +++++++++++++------ services/userlog/pkg/command/server.go | 1 + services/userlog/pkg/config/config.go | 7 +- web/package.json | 4 +- web/pnpm-lock.yaml | 12 ++-- 33 files changed, 208 insertions(+), 72 deletions(-) create mode 100644 changelog/unreleased/enhancement-nats-tls.md diff --git a/changelog/unreleased/enhancement-nats-tls.md b/changelog/unreleased/enhancement-nats-tls.md new file mode 100644 index 00000000000..b1eba8a82f2 --- /dev/null +++ b/changelog/unreleased/enhancement-nats-tls.md @@ -0,0 +1,8 @@ +Enhancement: Add TLS support for NATS store and registry connections + +All `nats-js-kv` store, cache, and service registry connections now support +TLS. Configure via `OCIS_CACHE_ENABLE_TLS`, `OCIS_PERSISTENT_STORE_ENABLE_TLS`, +and `MICRO_REGISTRY_ENABLE_TLS`, with corresponding `*_TLS_INSECURE` and +`*_TLS_ROOT_CA_CERTIFICATE` variants per connection type. + +https://github.com/owncloud/ocis/pull/12765 diff --git a/ocis-pkg/natsjsregistry/registry.go b/ocis-pkg/natsjsregistry/registry.go index 49555a7d612..cc30af5ae8b 100644 --- a/ocis-pkg/natsjsregistry/registry.go +++ b/ocis-pkg/natsjsregistry/registry.go @@ -3,6 +3,7 @@ package natsjsregistry import ( "context" + "crypto/tls" "encoding/json" "errors" "fmt" @@ -14,6 +15,7 @@ import ( natsjskv "github.com/go-micro/plugins/v4/store/nats-js-kv" "github.com/nats-io/nats.go" "github.com/owncloud/ocis/v2/ocis-pkg/generators" + revastore "github.com/owncloud/reva/v2/pkg/store" "go-micro.dev/v4/registry" "go-micro.dev/v4/server" "go-micro.dev/v4/store" @@ -21,10 +23,13 @@ import ( ) var ( - _registryName = "nats-js-kv" - _registryAddressEnv = "MICRO_REGISTRY_ADDRESS" - _registryUsernameEnv = "MICRO_REGISTRY_AUTH_USERNAME" - _registryPasswordEnv = "MICRO_REGISTRY_AUTH_PASSWORD" + _registryName = "nats-js-kv" + _registryAddressEnv = "MICRO_REGISTRY_ADDRESS" + _registryUsernameEnv = "MICRO_REGISTRY_AUTH_USERNAME" + _registryPasswordEnv = "MICRO_REGISTRY_AUTH_PASSWORD" + _registryEnableTLSEnv = "MICRO_REGISTRY_ENABLE_TLS" + _registryTLSInsecureEnv = "MICRO_REGISTRY_TLS_INSECURE" + _registryTLSRootCAEnv = "MICRO_REGISTRY_TLS_ROOT_CA_CERTIFICATE" _serviceDelimiter = "@" ) @@ -211,6 +216,10 @@ func (n *storeregistry) storeOptions(opts registry.Options) []store.Option { natsOptions := nats.GetDefaultOptions() natsOptions.Name = generators.GenerateConnectionName(serviceName, generators.NTypeRegistry) natsOptions.User, natsOptions.Password = getAuth() + if tlsConf := getTLS(); tlsConf != nil { + natsOptions.TLSConfig = tlsConf + natsOptions.Secure = true + } natsOptions.ReconnectedCB = func(_ *nats.Conn) { if err := n.Init(); err != nil { fmt.Println("cannot reconnect to nats") @@ -233,3 +242,20 @@ func (n *storeregistry) storeOptions(opts registry.Options) []store.Option { func getAuth() (string, string) { return os.Getenv(_registryUsernameEnv), os.Getenv(_registryPasswordEnv) } + +var ( + _tlsOnce sync.Once + _tlsConfig *tls.Config +) + +func getTLS() *tls.Config { + _tlsOnce.Do(func() { + if os.Getenv(_registryEnableTLSEnv) != "true" { + return + } + insecure := os.Getenv(_registryTLSInsecureEnv) == "true" + rootCA := os.Getenv(_registryTLSRootCAEnv) + _tlsConfig = revastore.BuildNatsTLSConfig(insecure, rootCA) + }) + return _tlsConfig +} diff --git a/ocis-pkg/shared/shared_types.go b/ocis-pkg/shared/shared_types.go index db78b9c0c46..4fd757c1cc5 100644 --- a/ocis-pkg/shared/shared_types.go +++ b/ocis-pkg/shared/shared_types.go @@ -62,8 +62,11 @@ type Cache struct { Table string `yaml:"table" env:"OCIS_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL" desc:"Time to live for events in the store. The duration can be set as number followed by a unit identifier like s, m or h." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` - AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"` - AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"` + AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"` + AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"pre5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the NATS store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the NATS store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate used to validate the NATS store TLS certificate. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // Commons holds configuration that are common to all extensions. Each extension can then decide whether diff --git a/services/activitylog/pkg/command/server.go b/services/activitylog/pkg/command/server.go index 28bdf997f24..44a5c88eb18 100644 --- a/services/activitylog/pkg/command/server.go +++ b/services/activitylog/pkg/command/server.go @@ -90,6 +90,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Database(cfg.Store.Database), microstore.Table(cfg.Store.Table), store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword), + store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate), ) tm, err := pool.StringToTLSMode(cfg.GRPCClientTLS.Mode) diff --git a/services/activitylog/pkg/config/config.go b/services/activitylog/pkg/config/config.go index 8b646f65782..d8abf8d2b2e 100644 --- a/services/activitylog/pkg/config/config.go +++ b/services/activitylog/pkg/config/config.go @@ -52,8 +52,11 @@ type Store struct { Database string `yaml:"database" env:"ACTIVITYLOG_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` Table string `yaml:"table" env:"ACTIVITYLOG_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;ACTIVITYLOG_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;ACTIVITYLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;ACTIVITYLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;ACTIVITYLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;ACTIVITYLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;ACTIVITYLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;ACTIVITYLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;ACTIVITYLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // ServiceAccount is the configuration for the used service account diff --git a/services/collaboration/pkg/command/server.go b/services/collaboration/pkg/command/server.go index d27e46cd586..cb6a93f8b38 100644 --- a/services/collaboration/pkg/command/server.go +++ b/services/collaboration/pkg/command/server.go @@ -83,6 +83,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Database(cfg.Store.Database), microstore.Table(cfg.Store.Table), store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword), + store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate), ) gr := runner.NewGroup() diff --git a/services/collaboration/pkg/config/store.go b/services/collaboration/pkg/config/store.go index 6f2051e4b10..93a5da5507c 100644 --- a/services/collaboration/pkg/config/store.go +++ b/services/collaboration/pkg/config/store.go @@ -9,6 +9,9 @@ type Store struct { Database string `yaml:"database" env:"COLLABORATION_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"7.0.0"` Table string `yaml:"table" env:"COLLABORATION_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"7.0.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;COLLABORATION_STORE_TTL" desc:"Time to live for events in the store. Defaults to '30m' (30 minutes). See the Environment Variable Types description for more details." introductionVersion:"7.0.0"` - AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;COLLABORATION_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"` - AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;COLLABORATION_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"` + AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;COLLABORATION_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"` + AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;COLLABORATION_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.0.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;COLLABORATION_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;COLLABORATION_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;COLLABORATION_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/eventhistory/pkg/command/server.go b/services/eventhistory/pkg/command/server.go index 06df1fd00bb..920fb8999df 100644 --- a/services/eventhistory/pkg/command/server.go +++ b/services/eventhistory/pkg/command/server.go @@ -72,6 +72,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Database(cfg.Store.Database), microstore.Table(cfg.Store.Table), store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword), + store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate), ) service := grpc.NewService( diff --git a/services/eventhistory/pkg/config/config.go b/services/eventhistory/pkg/config/config.go index 0841fd9243f..78b07bd0744 100644 --- a/services/eventhistory/pkg/config/config.go +++ b/services/eventhistory/pkg/config/config.go @@ -42,8 +42,11 @@ type Store struct { Database string `yaml:"database" env:"EVENTHISTORY_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` Table string `yaml:"table" env:"EVENTHISTORY_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;EVENTHISTORY_STORE_TTL" desc:"Time to live for events in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;EVENTHISTORY_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;EVENTHISTORY_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;EVENTHISTORY_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;EVENTHISTORY_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;EVENTHISTORY_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;EVENTHISTORY_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;EVENTHISTORY_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // Events combines the configuration options for the event bus. diff --git a/services/gateway/pkg/config/config.go b/services/gateway/pkg/config/config.go index 786d1d0f7aa..0c9d0d4eb8c 100644 --- a/services/gateway/pkg/config/config.go +++ b/services/gateway/pkg/config/config.go @@ -93,6 +93,9 @@ type Cache struct { ProviderCacheDatabase string `yaml:"provider_cache_database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` ProviderCacheTTL time.Duration `yaml:"provider_cache_ttl" env:"OCIS_CACHE_TTL;GATEWAY_PROVIDER_CACHE_TTL" desc:"Default time to live for user info in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` ProviderCacheDisablePersistence bool `yaml:"provider_cache_disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GATEWAY_PROVIDER_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the provider cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` - ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + ProviderCacheAuthUsername string `yaml:"provider_cache_auth_username" env:"OCIS_CACHE_AUTH_USERNAME;GATEWAY_PROVIDER_CACHE_AUTH_USERNAME" desc:"The username to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + ProviderCacheAuthPassword string `yaml:"provider_cache_auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;GATEWAY_PROVIDER_CACHE_AUTH_PASSWORD" desc:"The password to use for authentication. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + ProviderCacheEnableTLS bool `yaml:"provider_cache_enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GATEWAY_PROVIDER_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + ProviderCacheTLSInsecure bool `yaml:"provider_cache_tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GATEWAY_PROVIDER_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + ProviderCacheTLSRootCACertificate string `yaml:"provider_cache_tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GATEWAY_PROVIDER_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/gateway/pkg/revaconfig/config.go b/services/gateway/pkg/revaconfig/config.go index 0a7d90a8fdd..7f5d675826b 100644 --- a/services/gateway/pkg/revaconfig/config.go +++ b/services/gateway/pkg/revaconfig/config.go @@ -72,8 +72,11 @@ func GatewayConfigFromStruct(cfg *config.Config, logger log.Logger) map[string]i "cache_table": "provider", "cache_ttl": cfg.Cache.ProviderCacheTTL, "disable_persistence": cfg.Cache.ProviderCacheDisablePersistence, - "cache_auth_username": cfg.Cache.ProviderCacheAuthUsername, - "cache_auth_password": cfg.Cache.ProviderCacheAuthPassword, + "cache_auth_username": cfg.Cache.ProviderCacheAuthUsername, + "cache_auth_password": cfg.Cache.ProviderCacheAuthPassword, + "cache_enable_tls": cfg.Cache.ProviderCacheEnableTLS, + "cache_tls_insecure": cfg.Cache.ProviderCacheTLSInsecure, + "cache_tls_root_ca_certificate": cfg.Cache.ProviderCacheTLSRootCACertificate, }, }, "authregistry": map[string]interface{}{ diff --git a/services/graph/pkg/config/cache.go b/services/graph/pkg/config/cache.go index ca7a103a8dc..a39d451cbd7 100644 --- a/services/graph/pkg/config/cache.go +++ b/services/graph/pkg/config/cache.go @@ -10,6 +10,9 @@ type Cache struct { Table string `yaml:"table" env:"GRAPH_CACHE_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;GRAPH_CACHE_TTL" desc:"Time to live for cache records in the graph. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;GRAPH_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;GRAPH_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;GRAPH_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;GRAPH_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;GRAPH_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;GRAPH_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;GRAPH_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;GRAPH_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/graph/pkg/service/v0/service.go b/services/graph/pkg/service/v0/service.go index 85c17725f03..0b571c9a4d0 100644 --- a/services/graph/pkg/service/v0/service.go +++ b/services/graph/pkg/service/v0/service.go @@ -190,6 +190,7 @@ func NewService(opts ...Option) (Graph, error) { //nolint:maintidx microstore.Table(options.Config.Cache.Table), store.DisablePersistence(options.Config.Cache.DisablePersistence), store.Authentication(options.Config.Cache.AuthUsername, options.Config.Cache.AuthPassword), + store.TLS(options.Config.Cache.EnableTLS, options.Config.Cache.TLSInsecure, options.Config.Cache.TLSRootCACertificate), } m := roles.NewManager( roles.StoreOptions(storeOptions), diff --git a/services/notifications/pkg/command/server.go b/services/notifications/pkg/command/server.go index 1b0113b0869..9e56702464b 100644 --- a/services/notifications/pkg/command/server.go +++ b/services/notifications/pkg/command/server.go @@ -134,6 +134,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Database(cfg.Store.Database), microstore.Table(cfg.Store.Table), store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword), + store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate), ) svc := service.NewEventsNotifier(traceProvider, evts, channel, logger, gatewaySelector, valueService, diff --git a/services/notifications/pkg/config/config.go b/services/notifications/pkg/config/config.go index cb049dc268a..e5c16c32a73 100644 --- a/services/notifications/pkg/config/config.go +++ b/services/notifications/pkg/config/config.go @@ -76,6 +76,9 @@ type Store struct { Database string `yaml:"database" env:"NOTIFICATIONS_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"7.1.0"` Table string `yaml:"table" env:"NOTIFICATIONS_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"7.1.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;NOTIFICATIONS_STORE_TTL" desc:"Time to live for notifications in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"7.1.0"` - AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;NOTIFICATIONS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.1.0"` - AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;NOTIFICATIONS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.1.0"` + AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;NOTIFICATIONS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.1.0"` + AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;NOTIFICATIONS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"7.1.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;NOTIFICATIONS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;NOTIFICATIONS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;NOTIFICATIONS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/ocs/pkg/config/config.go b/services/ocs/pkg/config/config.go index 4097ff4ef68..657577cb5dd 100644 --- a/services/ocs/pkg/config/config.go +++ b/services/ocs/pkg/config/config.go @@ -35,6 +35,9 @@ type SigningKeys struct { Store string `yaml:"store" env:"OCIS_CACHE_STORE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE" desc:"The type of the signing key store. Supported values are: 'redis-sentinel' and 'nats-js-kv'. See the text description for details." introductionVersion:"5.0"` Nodes []string `yaml:"addresses" env:"OCIS_CACHE_STORE_NODES;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_NODES" desc:"A list of nodes to access the configured store. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TTL" desc:"Default time to live for signing keys. See the Environment Variable Types description for more details." introductionVersion:"5.0"` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the signing key store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the signing key store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;OCS_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the signing key store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/ocs/pkg/server/http/server.go b/services/ocs/pkg/server/http/server.go index 6277eb5e4d1..491fdf1fdc7 100644 --- a/services/ocs/pkg/server/http/server.go +++ b/services/ocs/pkg/server/http/server.go @@ -43,6 +43,7 @@ func Server(opts ...Option) (http.Service, error) { microstore.Database("proxy"), microstore.Table("signing-keys"), store.Authentication(options.Config.SigningKeys.AuthUsername, options.Config.SigningKeys.AuthPassword), + store.TLS(options.Config.SigningKeys.EnableTLS, options.Config.SigningKeys.TLSInsecure, options.Config.SigningKeys.TLSRootCACertificate), ) handle := svc.NewService( diff --git a/services/postprocessing/pkg/command/server.go b/services/postprocessing/pkg/command/server.go index eeb99c73f12..521c27b1897 100644 --- a/services/postprocessing/pkg/command/server.go +++ b/services/postprocessing/pkg/command/server.go @@ -65,6 +65,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Database(cfg.Store.Database), microstore.Table(cfg.Store.Table), store.Authentication(cfg.Store.AuthUsername, cfg.Store.AuthPassword), + store.TLS(cfg.Store.EnableTLS, cfg.Store.TLSInsecure, cfg.Store.TLSRootCACertificate), ) svc, err := service.NewPostprocessingService(ctx, bus, logger, st, traceProvider, cfg.Postprocessing) diff --git a/services/postprocessing/pkg/config/config.go b/services/postprocessing/pkg/config/config.go index 8919df2f7a1..f7c750b18a4 100644 --- a/services/postprocessing/pkg/config/config.go +++ b/services/postprocessing/pkg/config/config.go @@ -62,6 +62,9 @@ type Store struct { Database string `yaml:"database" env:"POSTPROCESSING_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` Table string `yaml:"table" env:"POSTPROCESSING_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;POSTPROCESSING_STORE_TTL" desc:"Time to live for events in the store. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;POSTPROCESSING_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;POSTPROCESSING_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;POSTPROCESSING_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;POSTPROCESSING_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;POSTPROCESSING_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;POSTPROCESSING_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;POSTPROCESSING_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/proxy/pkg/command/server.go b/services/proxy/pkg/command/server.go index fd12bfe51d2..d3a95d43483 100644 --- a/services/proxy/pkg/command/server.go +++ b/services/proxy/pkg/command/server.go @@ -77,6 +77,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Table(cfg.OIDC.UserinfoCache.Table), store.DisablePersistence(cfg.OIDC.UserinfoCache.DisablePersistence), store.Authentication(cfg.OIDC.UserinfoCache.AuthUsername, cfg.OIDC.UserinfoCache.AuthPassword), + store.TLS(cfg.OIDC.UserinfoCache.EnableTLS, cfg.OIDC.UserinfoCache.TLSInsecure, cfg.OIDC.UserinfoCache.TLSRootCACertificate), ) signingKeyStore := store.Create( @@ -86,6 +87,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Database("proxy"), microstore.Table("signing-keys"), store.Authentication(cfg.PreSignedURL.SigningKeys.AuthUsername, cfg.PreSignedURL.SigningKeys.AuthPassword), + store.TLS(cfg.PreSignedURL.SigningKeys.EnableTLS, cfg.PreSignedURL.SigningKeys.TLSInsecure, cfg.PreSignedURL.SigningKeys.TLSRootCACertificate), ) cfg.GrpcClient, err = grpc.NewClient( diff --git a/services/proxy/pkg/config/config.go b/services/proxy/pkg/config/config.go index d3b030b6bec..3587b189ddf 100644 --- a/services/proxy/pkg/config/config.go +++ b/services/proxy/pkg/config/config.go @@ -144,8 +144,11 @@ type Cache struct { Table string `yaml:"table" env:"PROXY_OIDC_USERINFO_CACHE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;PROXY_OIDC_USERINFO_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;PROXY_OIDC_USERINFO_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"pre5.0"` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_OIDC_USERINFO_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_OIDC_USERINFO_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_OIDC_USERINFO_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_OIDC_USERINFO_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;PROXY_OIDC_USERINFO_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;PROXY_OIDC_USERINFO_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;PROXY_OIDC_USERINFO_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // RoleAssignment contains the configuration for how to assign roles to users during login @@ -199,8 +202,11 @@ type SigningKeys struct { Nodes []string `yaml:"addresses" env:"OCIS_CACHE_STORE_NODES;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_NODES" desc:"A list of nodes to access the configured store. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_TTL" desc:"Default time to live for signing keys. See the Environment Variable Types description for more details." introductionVersion:"5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_DISABLE_PERSISTENCE" desc:"Disables persistence of the store. Only applies when store type 'nats-js-kv' is configured. Defaults to true." introductionVersion:"5.0"` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the signing key store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the signing key store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;PROXY_PRESIGNEDURL_SIGNING_KEYS_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the signing key store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // ClaimsSelectorConf is the config for the claims-selector diff --git a/services/settings/pkg/config/config.go b/services/settings/pkg/config/config.go index 7dca0fb2406..59cc7cd1fdb 100644 --- a/services/settings/pkg/config/config.go +++ b/services/settings/pkg/config/config.go @@ -63,6 +63,9 @@ type Cache struct { DirectoryTable string `yaml:"directories_table" env:"SETTINGS_DIRECTORY_CACHE_TABLE" desc:"The database table the store should use for the directory cache." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;SETTINGS_CACHE_TTL" desc:"Default time to live for entries in the cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;SETTINGS_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;SETTINGS_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;SETTINGS_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;SETTINGS_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;SETTINGS_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;SETTINGS_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;SETTINGS_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;SETTINGS_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/settings/pkg/store/metadata/cache.go b/services/settings/pkg/store/metadata/cache.go index 3f365e8e466..c5fc6a4d15e 100644 --- a/services/settings/pkg/store/metadata/cache.go +++ b/services/settings/pkg/store/metadata/cache.go @@ -140,6 +140,7 @@ func (c *CachedMDC) Init(ctx context.Context, id string) error { microstore.Table(c.cfg.Metadata.Cache.DirectoryTable), store.DisablePersistence(c.cfg.Metadata.Cache.DisablePersistence), store.Authentication(c.cfg.Metadata.Cache.AuthUsername, c.cfg.Metadata.Cache.AuthPassword), + store.TLS(c.cfg.Metadata.Cache.EnableTLS, c.cfg.Metadata.Cache.TLSInsecure, c.cfg.Metadata.Cache.TLSRootCACertificate), ) c.filesCache = store.Create( store.Store(c.cfg.Metadata.Cache.Store), @@ -149,6 +150,7 @@ func (c *CachedMDC) Init(ctx context.Context, id string) error { microstore.Table(c.cfg.Metadata.Cache.FileTable), store.DisablePersistence(c.cfg.Metadata.Cache.DisablePersistence), store.Authentication(c.cfg.Metadata.Cache.AuthUsername, c.cfg.Metadata.Cache.AuthPassword), + store.TLS(c.cfg.Metadata.Cache.EnableTLS, c.cfg.Metadata.Cache.TLSInsecure, c.cfg.Metadata.Cache.TLSRootCACertificate), ) return c.next.Init(ctx, id) } diff --git a/services/storage-publiclink/pkg/config/config.go b/services/storage-publiclink/pkg/config/config.go index 12d26a1c476..d9b7bffec0e 100644 --- a/services/storage-publiclink/pkg/config/config.go +++ b/services/storage-publiclink/pkg/config/config.go @@ -68,6 +68,9 @@ type Store struct { Nodes []string `yaml:"nodes" env:"OCIS_PERSISTENT_STORE_NODES;STORAGE_PUBLICLINK_STORE_NODES" desc:"A list of nodes to access the configured store. This has no effect when 'memory' store is configured. Note that the behaviour how nodes are used is dependent on the library of the configured store. See the Environment Variable Types description for more details." introductionVersion:"8.0.0"` Database string `yaml:"database" env:"STORAGE_PUBLICLINK_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"8.0.0"` Table string `yaml:"table" env:"STORAGE_PUBLICLINK_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"8.0.0"` - AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;STORAGE_PUBLICLINK_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.0.0"` - AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;STORAGE_PUBLICLINK_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.0.0"` + AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;STORAGE_PUBLICLINK_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.0.0"` + AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;STORAGE_PUBLICLINK_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.0.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;STORAGE_PUBLICLINK_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;STORAGE_PUBLICLINK_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;STORAGE_PUBLICLINK_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/storage-publiclink/pkg/revaconfig/config.go b/services/storage-publiclink/pkg/revaconfig/config.go index 1464bacc320..2551bd932f6 100644 --- a/services/storage-publiclink/pkg/revaconfig/config.go +++ b/services/storage-publiclink/pkg/revaconfig/config.go @@ -44,8 +44,11 @@ func StoragePublicLinkConfigFromStruct(cfg *config.Config) map[string]interface{ "store_nodes": cfg.Store.Nodes, "store_database": cfg.Store.Database, "store_table": cfg.Store.Table, - "store_username": cfg.Store.AuthUsername, - "store_password": cfg.Store.AuthPassword, + "store_username": cfg.Store.AuthUsername, + "store_password": cfg.Store.AuthPassword, + "store_enable_tls": cfg.Store.EnableTLS, + "store_tls_insecure": cfg.Store.TLSInsecure, + "store_tls_root_ca_certificate": cfg.Store.TLSRootCACertificate, }, }, }, diff --git a/services/storage-system/pkg/config/config.go b/services/storage-system/pkg/config/config.go index e215ba6e610..d270ef641b9 100644 --- a/services/storage-system/pkg/config/config.go +++ b/services/storage-system/pkg/config/config.go @@ -91,6 +91,9 @@ type Cache struct { Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_SYSTEM_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_SYSTEM_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` - AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_SYSTEM_CACHE_AUTH_USERNAME" desc:"Username for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_SYSTEM_CACHE_AUTH_PASSWORD" desc:"Password for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"auth_username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_SYSTEM_CACHE_AUTH_USERNAME" desc:"Username for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"auth_password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_SYSTEM_CACHE_AUTH_PASSWORD" desc:"Password for the configured store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_SYSTEM_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_SYSTEM_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_SYSTEM_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } diff --git a/services/storage-system/pkg/revaconfig/config.go b/services/storage-system/pkg/revaconfig/config.go index b7684a21505..418377b9bee 100644 --- a/services/storage-system/pkg/revaconfig/config.go +++ b/services/storage-system/pkg/revaconfig/config.go @@ -169,8 +169,11 @@ func metadataDrivers(localEndpoint string, cfg *config.Config) map[string]interf "cache_database": cfg.FileMetadataCache.Database, "cache_ttl": cfg.FileMetadataCache.TTL, "cache_disable_persistence": cfg.FileMetadataCache.DisablePersistence, - "cache_auth_username": cfg.FileMetadataCache.AuthUsername, - "cache_auth_password": cfg.FileMetadataCache.AuthPassword, + "cache_auth_username": cfg.FileMetadataCache.AuthUsername, + "cache_auth_password": cfg.FileMetadataCache.AuthPassword, + "cache_enable_tls": cfg.FileMetadataCache.EnableTLS, + "cache_tls_insecure": cfg.FileMetadataCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.FileMetadataCache.TLSRootCACertificate, }, }, } diff --git a/services/storage-users/pkg/config/config.go b/services/storage-users/pkg/config/config.go index a1fc33b1a5c..44688ca2cc7 100644 --- a/services/storage-users/pkg/config/config.go +++ b/services/storage-users/pkg/config/config.go @@ -229,8 +229,11 @@ type FilemetadataCache struct { Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_FILEMETADATA_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens has no expiration. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_FILEMETADATA_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_FILEMETADATA_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_USERS_FILEMETADATA_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_USERS_FILEMETADATA_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_USERS_FILEMETADATA_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // IDCache holds cache config @@ -240,8 +243,11 @@ type IDCache struct { Database string `yaml:"database" env:"OCIS_CACHE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_CACHE_TTL;STORAGE_USERS_ID_CACHE_TTL" desc:"Default time to live for user info in the user info cache. Only applied when access tokens have no expiration. Defaults to 300s which is derived from the underlaying package though not explicitly set as default. See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` DisablePersistence bool `yaml:"disable_persistence" env:"OCIS_CACHE_DISABLE_PERSISTENCE;STORAGE_USERS_ID_CACHE_DISABLE_PERSISTENCE" desc:"Disables persistence of the cache. Only applies when store type 'nats-js-kv' is configured. Defaults to false." introductionVersion:"5.0"` - AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_ID_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_ID_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_CACHE_AUTH_USERNAME;STORAGE_USERS_ID_CACHE_AUTH_USERNAME" desc:"The username to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_CACHE_AUTH_PASSWORD;STORAGE_USERS_ID_CACHE_AUTH_PASSWORD" desc:"The password to authenticate with the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_CACHE_ENABLE_TLS;STORAGE_USERS_ID_CACHE_ENABLE_TLS" desc:"Activate TLS for the connection to the cache store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_CACHE_TLS_INSECURE;STORAGE_USERS_ID_CACHE_TLS_INSECURE" desc:"Disable TLS certificate verification for the cache store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_CACHE_TLS_ROOT_CA_CERTIFICATE;STORAGE_USERS_ID_CACHE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the cache store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // S3Driver is the storage driver configuration when using 's3' storage driver diff --git a/services/storage-users/pkg/revaconfig/drivers.go b/services/storage-users/pkg/revaconfig/drivers.go index 20e08015521..0c59be695b6 100644 --- a/services/storage-users/pkg/revaconfig/drivers.go +++ b/services/storage-users/pkg/revaconfig/drivers.go @@ -102,8 +102,11 @@ func Posix(cfg *config.Config, enableFSWatch bool) map[string]interface{} { "cache_database": cfg.IDCache.Database, "cache_ttl": cfg.IDCache.TTL, "cache_disable_persistence": cfg.IDCache.DisablePersistence, - "cache_auth_username": cfg.IDCache.AuthUsername, - "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_enable_tls": cfg.IDCache.EnableTLS, + "cache_tls_insecure": cfg.IDCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate, }, "filemetadatacache": map[string]interface{}{ "cache_store": cfg.FilemetadataCache.Store, @@ -111,8 +114,11 @@ func Posix(cfg *config.Config, enableFSWatch bool) map[string]interface{} { "cache_database": cfg.FilemetadataCache.Database, "cache_ttl": cfg.FilemetadataCache.TTL, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, - "cache_auth_username": cfg.FilemetadataCache.AuthUsername, - "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_enable_tls": cfg.FilemetadataCache.EnableTLS, + "cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate, }, "use_space_groups": cfg.Drivers.Posix.UseSpaceGroups, "watch_fs": enableFSWatch, @@ -186,8 +192,11 @@ func Ocis(cfg *config.Config) map[string]interface{} { "cache_database": cfg.FilemetadataCache.Database, "cache_ttl": cfg.FilemetadataCache.TTL, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, - "cache_auth_username": cfg.FilemetadataCache.AuthUsername, - "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_enable_tls": cfg.FilemetadataCache.EnableTLS, + "cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -195,8 +204,11 @@ func Ocis(cfg *config.Config) map[string]interface{} { "cache_database": cfg.IDCache.Database, "cache_ttl": cfg.IDCache.TTL, "cache_disable_persistence": cfg.IDCache.DisablePersistence, - "cache_auth_username": cfg.IDCache.AuthUsername, - "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_enable_tls": cfg.IDCache.EnableTLS, + "cache_tls_insecure": cfg.IDCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate, }, "events": map[string]interface{}{ "numconsumers": cfg.Events.NumConsumers, @@ -242,8 +254,11 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "cache_database": cfg.FilemetadataCache.Database, "cache_ttl": cfg.FilemetadataCache.TTL, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, - "cache_auth_username": cfg.FilemetadataCache.AuthUsername, - "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_enable_tls": cfg.FilemetadataCache.EnableTLS, + "cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -251,8 +266,11 @@ func OcisNoEvents(cfg *config.Config) map[string]interface{} { "cache_database": cfg.IDCache.Database, "cache_ttl": cfg.IDCache.TTL, "cache_disable_persistence": cfg.IDCache.DisablePersistence, - "cache_auth_username": cfg.IDCache.AuthUsername, - "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_enable_tls": cfg.IDCache.EnableTLS, + "cache_tls_insecure": cfg.IDCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate, }, } } @@ -312,8 +330,11 @@ func S3NG(cfg *config.Config) map[string]interface{} { "cache_database": cfg.FilemetadataCache.Database, "cache_ttl": cfg.FilemetadataCache.TTL, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, - "cache_auth_username": cfg.FilemetadataCache.AuthUsername, - "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_enable_tls": cfg.FilemetadataCache.EnableTLS, + "cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -321,8 +342,11 @@ func S3NG(cfg *config.Config) map[string]interface{} { "cache_database": cfg.IDCache.Database, "cache_ttl": cfg.IDCache.TTL, "cache_disable_persistence": cfg.IDCache.DisablePersistence, - "cache_auth_username": cfg.IDCache.AuthUsername, - "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_enable_tls": cfg.IDCache.EnableTLS, + "cache_tls_insecure": cfg.IDCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate, }, "events": map[string]interface{}{ "numconsumers": cfg.Events.NumConsumers, @@ -372,8 +396,11 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "cache_database": cfg.FilemetadataCache.Database, "cache_ttl": cfg.FilemetadataCache.TTL, "cache_disable_persistence": cfg.FilemetadataCache.DisablePersistence, - "cache_auth_username": cfg.FilemetadataCache.AuthUsername, - "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_auth_username": cfg.FilemetadataCache.AuthUsername, + "cache_auth_password": cfg.FilemetadataCache.AuthPassword, + "cache_enable_tls": cfg.FilemetadataCache.EnableTLS, + "cache_tls_insecure": cfg.FilemetadataCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.FilemetadataCache.TLSRootCACertificate, }, "idcache": map[string]interface{}{ "cache_store": cfg.IDCache.Store, @@ -381,8 +408,11 @@ func S3NGNoEvents(cfg *config.Config) map[string]interface{} { "cache_database": cfg.IDCache.Database, "cache_ttl": cfg.IDCache.TTL, "cache_disable_persistence": cfg.IDCache.DisablePersistence, - "cache_auth_username": cfg.IDCache.AuthUsername, - "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_auth_username": cfg.IDCache.AuthUsername, + "cache_auth_password": cfg.IDCache.AuthPassword, + "cache_enable_tls": cfg.IDCache.EnableTLS, + "cache_tls_insecure": cfg.IDCache.TLSInsecure, + "cache_tls_root_ca_certificate": cfg.IDCache.TLSRootCACertificate, }, } } diff --git a/services/userlog/pkg/command/server.go b/services/userlog/pkg/command/server.go index 615ae1e2ecc..e89054db02f 100644 --- a/services/userlog/pkg/command/server.go +++ b/services/userlog/pkg/command/server.go @@ -95,6 +95,7 @@ func Server(cfg *config.Config) *cli.Command { microstore.Database(cfg.Persistence.Database), microstore.Table(cfg.Persistence.Table), store.Authentication(cfg.Persistence.AuthUsername, cfg.Persistence.AuthPassword), + store.TLS(cfg.Persistence.EnableTLS, cfg.Persistence.TLSInsecure, cfg.Persistence.TLSRootCACertificate), ) tm, err := pool.StringToTLSMode(cfg.GRPCClientTLS.Mode) diff --git a/services/userlog/pkg/config/config.go b/services/userlog/pkg/config/config.go index 46b75f5ce27..a9857c55b5e 100644 --- a/services/userlog/pkg/config/config.go +++ b/services/userlog/pkg/config/config.go @@ -45,8 +45,11 @@ type Persistence struct { Database string `yaml:"database" env:"USERLOG_STORE_DATABASE" desc:"The database name the configured store should use." introductionVersion:"pre5.0"` Table string `yaml:"table" env:"USERLOG_STORE_TABLE" desc:"The database table the store should use." introductionVersion:"pre5.0"` TTL time.Duration `yaml:"ttl" env:"OCIS_PERSISTENT_STORE_TTL;USERLOG_STORE_TTL" desc:"Time to live for events in the store. Defaults to '336h' (2 weeks). See the Environment Variable Types description for more details." introductionVersion:"pre5.0"` - AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;USERLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` - AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;USERLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthUsername string `yaml:"username" env:"OCIS_PERSISTENT_STORE_AUTH_USERNAME;USERLOG_STORE_AUTH_USERNAME" desc:"The username to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + AuthPassword string `yaml:"password" env:"OCIS_PERSISTENT_STORE_AUTH_PASSWORD;USERLOG_STORE_AUTH_PASSWORD" desc:"The password to authenticate with the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"5.0"` + EnableTLS bool `yaml:"enable_tls" env:"OCIS_PERSISTENT_STORE_ENABLE_TLS;USERLOG_STORE_ENABLE_TLS" desc:"Activate TLS for the connection to the store. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSInsecure bool `yaml:"tls_insecure" env:"OCIS_PERSISTENT_STORE_TLS_INSECURE;USERLOG_STORE_TLS_INSECURE" desc:"Disable TLS certificate verification for the store connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` + TLSRootCACertificate string `yaml:"tls_root_ca_certificate" env:"OCIS_PERSISTENT_STORE_TLS_ROOT_CA_CERTIFICATE;USERLOG_STORE_TLS_ROOT_CA_CERTIFICATE" desc:"Path to the PEM-encoded root CA certificate for the store TLS connection. Only applies when store type 'nats-js-kv' is configured." introductionVersion:"8.3.0"` } // Events combines the configuration options for the event bus. diff --git a/web/package.json b/web/package.json index 60cd30c0601..cceba749f98 100644 --- a/web/package.json +++ b/web/package.json @@ -102,7 +102,7 @@ }, "pnpm": { "overrides": { - "nanoid": "^3.3.17", + "nanoid": "^3.3.18", "elliptic": "6.6.1", "sha.js": "2.4.12", "vitest": "4.1.6", @@ -118,7 +118,7 @@ "ws": "8.21.0", "js-yaml": "4.3.1", "postcss": "8.5.18", - "nanoid@^3.0.0": "3.3.17", + "nanoid@^3.0.0": "3.3.18", "nanoid@^5.0.0": "5.1.16" }, "patchedDependencies": { diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index 89d68e7d1a0..4619b464428 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -5,7 +5,7 @@ settings: excludeLinksFromLockfile: false overrides: - nanoid: ^3.3.17 + nanoid: ^3.3.18 elliptic: 6.6.1 sha.js: 2.4.12 vitest: 4.1.6 @@ -21,7 +21,7 @@ overrides: ws: 8.21.0 js-yaml: 4.3.1 postcss: 8.5.18 - nanoid@^3.0.0: 3.3.17 + nanoid@^3.0.0: 3.3.18 nanoid@^5.0.0: 5.1.16 patchedDependencies: @@ -5840,8 +5840,8 @@ packages: namespace-emitter@2.0.1: resolution: {integrity: sha512-N/sMKHniSDJBjfrkbS/tpkPj4RAbvW3mr8UAzvlMHyun93XEm83IAvhWtJVHo+RHn/oO8Job5YN4b+wRjSVp5g==} - nanoid@3.3.17: - resolution: {integrity: sha512-xQLf0A3HOMlgHq0n247/LRuAOYmB7dXJ/DvAxGvsSBij45XtBSmQycu+F8ODbHwns/XyFZagyL1+J0Offw1E0g==} + nanoid@3.3.18: + resolution: {integrity: sha512-DTg4MJbGMWkfi6VZFdNt2/caMbQy4Ou+Op/hJQvGEWcnVfoA1QA+xzRKAzw9jD6+GVOOeYr/mIcuDSdug6F6+w==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} hasBin: true @@ -12824,7 +12824,7 @@ snapshots: namespace-emitter@2.0.1: {} - nanoid@3.3.17: {} + nanoid@3.3.18: {} nanoid@5.1.16: {} @@ -13265,7 +13265,7 @@ snapshots: postcss@8.5.18: dependencies: - nanoid: 3.3.17 + nanoid: 3.3.18 picocolors: 1.1.1 source-map-js: 1.2.1