From 29a4e3d7da4d30bed7077e131024b60f848d85ea Mon Sep 17 00:00:00 2001 From: Stephanie Hingtgen Date: Thu, 1 Jun 2023 13:58:51 -0500 Subject: [PATCH] Secure socks proxy: allow for UI to be disabled (#69408) --- conf/defaults.ini | 2 ++ conf/sample.ini | 1 + pkg/api/frontendsettings.go | 2 +- pkg/setting/setting_secure_socks_proxy.go | 2 ++ 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/conf/defaults.ini b/conf/defaults.ini index fcfe41414a1..bb965586807 100644 --- a/conf/defaults.ini +++ b/conf/defaults.ini @@ -1587,3 +1587,5 @@ client_cert = server_name = # The address of the socks5 proxy datasources should connect to proxy_address = +# Determines if the secure socks proxy should be shown on the datasources page, defaults to true if the feature is enabled +show_ui = false \ No newline at end of file diff --git a/conf/sample.ini b/conf/sample.ini index 5d4bee32590..06c2f54c670 100644 --- a/conf/sample.ini +++ b/conf/sample.ini @@ -1491,3 +1491,4 @@ ; server_name = # The address of the socks5 proxy datasources should connect to ; proxy_address = +; show_ui = true diff --git a/pkg/api/frontendsettings.go b/pkg/api/frontendsettings.go index f8e661348b2..ccf04d75f9e 100644 --- a/pkg/api/frontendsettings.go +++ b/pkg/api/frontendsettings.go @@ -149,7 +149,7 @@ func (hs *HTTPServer) getFrontendSettings(c *contextmodel.ReqContext) (*dtos.Fro TrustedTypesDefaultPolicyEnabled: trustedTypesDefaultPolicyEnabled, CSPReportOnlyEnabled: hs.Cfg.CSPReportOnlyEnabled, DateFormats: hs.Cfg.DateFormats, - SecureSocksDSProxyEnabled: hs.Cfg.SecureSocksDSProxy.Enabled, + SecureSocksDSProxyEnabled: hs.Cfg.SecureSocksDSProxy.Enabled && hs.Cfg.SecureSocksDSProxy.ShowUI, Auth: dtos.FrontendSettingsAuthDTO{ OAuthSkipOrgRoleUpdateSync: hs.Cfg.OAuthSkipOrgRoleUpdateSync, diff --git a/pkg/setting/setting_secure_socks_proxy.go b/pkg/setting/setting_secure_socks_proxy.go index 83fbb156a9e..41689d4ef02 100644 --- a/pkg/setting/setting_secure_socks_proxy.go +++ b/pkg/setting/setting_secure_socks_proxy.go @@ -8,6 +8,7 @@ import ( type SecureSocksDSProxySettings struct { Enabled bool + ShowUI bool ClientCert string ClientKey string RootCA string @@ -24,6 +25,7 @@ func readSecureSocksDSProxySettings(iniFile *ini.File) (SecureSocksDSProxySettin s.RootCA = secureSocksProxySection.Key("root_ca_cert").MustString("") s.ProxyAddress = secureSocksProxySection.Key("proxy_address").MustString("") s.ServerName = secureSocksProxySection.Key("server_name").MustString("") + s.ShowUI = secureSocksProxySection.Key("show_ui").MustBool(true) if !s.Enabled { return s, nil