diff --git a/api/client/webclient/webclient.go b/api/client/webclient/webclient.go index a05d78e0eb266..f3b6ba5586768 100644 --- a/api/client/webclient/webclient.go +++ b/api/client/webclient/webclient.go @@ -305,6 +305,10 @@ type PingResponse struct { // reserved: license_warnings ([]string) // AutomaticUpgrades describes whether agents should automatically upgrade. AutomaticUpgrades bool `json:"automatic_upgrades"` + // Edition represents the Teleport edition. Possible values are "oss", "ent", and "community". + Edition string `json:"edition"` + // FIPS represents if Teleport is using FIPS-compliant cryptography. + FIPS bool `json:"fips"` } // PingErrorResponse contains the error from /webapi/ping. diff --git a/lib/web/apiserver.go b/lib/web/apiserver.go index 89b8929f820e7..32df57c99566b 100644 --- a/lib/web/apiserver.go +++ b/lib/web/apiserver.go @@ -1520,6 +1520,9 @@ func (h *Handler) ping(w http.ResponseWriter, r *http.Request, p httprouter.Para MinClientVersion: teleport.MinClientVersion, ClusterName: h.auth.clusterName, AutomaticUpgrades: pr.ServerFeatures.GetAutomaticUpgrades(), + AutoUpdate: h.automaticUpdateSettings(r.Context()), + Edition: modules.GetModules().BuildType(), + FIPS: modules.IsBoringBinary(), }, nil } @@ -1543,29 +1546,35 @@ func (h *Handler) find(w http.ResponseWriter, r *http.Request, p httprouter.Para ServerVersion: teleport.Version, MinClientVersion: teleport.MinClientVersion, ClusterName: h.auth.clusterName, + AutoUpdate: h.automaticUpdateSettings(r.Context()), + Edition: modules.GetModules().BuildType(), + FIPS: modules.IsBoringBinary(), } - autoUpdateConfig, err := h.cfg.AccessPoint.GetAutoUpdateConfig(r.Context()) + return response, nil +} + +// TODO: add the request as a parameter when we'll need to modulate the content based on the UUID and group +func (h *Handler) automaticUpdateSettings(ctx context.Context) webclient.AutoUpdateSettings { + autoUpdateConfig, err := h.cfg.AccessPoint.GetAutoUpdateConfig(ctx) // TODO(vapopov) DELETE IN v18.0.0 check of IsNotImplemented, must be backported to all latest supported versions. if err != nil && !trace.IsNotFound(err) && !trace.IsNotImplemented(err) { - h.logger.ErrorContext(r.Context(), "failed to receive AutoUpdateConfig", "error", err) + h.logger.ErrorContext(ctx, "failed to receive AutoUpdateConfig", "error", err) } - autoUpdateVersion, err := h.cfg.AccessPoint.GetAutoUpdateVersion(r.Context()) + autoUpdateVersion, err := h.cfg.AccessPoint.GetAutoUpdateVersion(ctx) // TODO(vapopov) DELETE IN v18.0.0 check of IsNotImplemented, must be backported to all latest supported versions. if err != nil && !trace.IsNotFound(err) && !trace.IsNotImplemented(err) { - h.logger.ErrorContext(r.Context(), "failed to receive AutoUpdateVersion", "error", err) + h.logger.ErrorContext(ctx, "failed to receive AutoUpdateVersion", "error", err) } - response.AutoUpdate = webclient.AutoUpdateSettings{ + return webclient.AutoUpdateSettings{ ToolsMode: getToolsMode(autoUpdateConfig), ToolsVersion: getToolsVersion(autoUpdateVersion), AgentUpdateJitterSeconds: DefaultAgentUpdateJitterSeconds, AgentVersion: getAgentVersion(autoUpdateVersion), AgentAutoUpdate: agentShouldUpdate(autoUpdateConfig, autoUpdateVersion), } - - return response, nil } func (h *Handler) pingWithConnector(w http.ResponseWriter, r *http.Request, p httprouter.Params) (interface{}, error) {