diff --git a/server/fleet/errors.go b/server/fleet/errors.go index ed6bf27187..c14da53e11 100644 --- a/server/fleet/errors.go +++ b/server/fleet/errors.go @@ -538,11 +538,11 @@ func (e OrbitError) Error() string { const ( // Scripts RunScriptInvalidTypeErrMsg = "File type not supported. Only .sh (Bash) and .ps1 (PowerShell) file types are allowed." - RunScriptHostOfflineErrMsg = "Script can’t run on offline host." - RunScriptHostNotFoundErrMsg = "Host doesn’t exist. Make sure you provide a valid hostname, UUID, osquery host ID, or node key." - RunScriptForbiddenErrMsg = "You don’t have the right permissions in Fleet to run the script." + RunScriptHostOfflineErrMsg = "Script can't run on offline host." + RunScriptHostNotFoundErrMsg = "Host doesn't exist. Make sure you provide a valid hostname, UUID, osquery host ID, or node key." + RunScriptForbiddenErrMsg = "You don't have the right permissions in Fleet to run the script." RunScriptAlreadyRunningErrMsg = "A script is already running on this host. Please wait about 5 minutes to let it finish." - RunScriptHostTimeoutErrMsg = "Fleet didn’t hear back from the host in under 5 minutes (timeout for live scripts). Fleet doesn’t know if the script ran because it didn’t receive the result. Please try again." + RunScriptHostTimeoutErrMsg = "Fleet didn't hear back from the host in under 5 minutes (timeout for live scripts). Fleet doesn't know if the script ran because it didn't receive the result. Please try again." RunScriptScriptsDisabledGloballyErrMsg = "Running scripts is disabled in organization settings." RunScriptDisabledErrMsg = "Scripts are disabled for this host. To run scripts, deploy the fleetd agent with scripts enabled." RunScriptsOrbitDisabledErrMsg = "Couldn't run script. To run a script, deploy the fleetd agent with --enable-scripts." @@ -550,6 +550,7 @@ const ( RunScriptAsyncScriptEnqueuedErrMsg = "Script is running or will run when the host comes online." RunScripSavedMaxLenErrMsg = "Script is too large. It's limited to 500,000 characters (approximately 10,000 lines)." RunScripUnsavedMaxLenErrMsg = "Script is too large. It's limited to 10,000 characters (approximately 125 lines)." + RunScriptGatewayTimeoutErrMsg = "Gateway timeout. Fleet didn't hear back from the host and doesn't know if the script ran. Please make sure your load balancer timeout isn't shorter than the Fleet server timeout." // End user authentication EndUserAuthDEPWebURLConfiguredErrMsg = `End user authentication can't be configured when the configured automatic enrollment (DEP) profile specifies a configuration_web_url.` // #nosec G101 diff --git a/server/service/client_scripts.go b/server/service/client_scripts.go index 18285013fd..373b3b1ebd 100644 --- a/server/service/client_scripts.go +++ b/server/service/client_scripts.go @@ -57,6 +57,11 @@ func (c *Client) runHostScript(verb, path string, hostID uint, scriptContents [] return nil, errors.New(fleet.RunScriptScriptsDisabledGloballyErrMsg) } return nil, errors.New(fleet.RunScriptForbiddenErrMsg) + // It's possible we get a GatewayTimeout error message from nginx or another + // proxy server, so we want to return a more helpful error message in that + // case. + case http.StatusGatewayTimeout: + return nil, errors.New(fleet.RunScriptGatewayTimeoutErrMsg) case http.StatusPaymentRequired: if teamID > 0 { return nil, errors.New("Team id parameter requires Fleet Premium license.")