diff --git a/scripts/create-installation-script.js b/scripts/create-installation-script.js index 40f0ddc9..3a8d3163 100644 --- a/scripts/create-installation-script.js +++ b/scripts/create-installation-script.js @@ -52,7 +52,15 @@ function run() { function use(script, config) { var Transport = com.hivext.api.core.utils.Transport, + error, + body; + + try { body = new Transport().get(baseUrl + "/" + script + "?_r=" + Math.random()); + } catch (e) { + error = !body ? "Unable to download 'ssl-manager' script from GitHub. Error: " + e : ""; + if (error) return error; + } return new (new Function("return " + body)())(config); } diff --git a/scripts/generate-ssl-cert.sh b/scripts/generate-ssl-cert.sh index 1388bb3a..6cca2cee 100644 --- a/scripts/generate-ssl-cert.sh +++ b/scripts/generate-ssl-cert.sh @@ -73,7 +73,7 @@ do [[ -z $error ]] && { error=$(sed -rn 's/.*\s(.*)(Invalid response from http:\/\/.*)\\\"".*/\2/p' $LOG_FILE | sed '$!d') - [[ ! -z $error ]] && invalid_domain=$(echo $error | sed -rn 's/Invalid response from http:\/\/([^/]*)\/\.well-known.*/\1/p') + [[ ! -z $error ]] && invalid_domain=$(echo $error | sed -rn 's/Invalid response from https?:\/\/([^/]*)\/\.well-known.*/\1/p') } [[ -z $error ]] && { @@ -126,10 +126,11 @@ sed -i "s|^domain=.*|domain='${domain}'|g" ${SETTINGS}; if [ "$result_code" != "0" ]; then [[ $resp == *"does not exist or is not a directory"* ]] && invalid_webroot_dir=true [[ $resp == *"Read timed out"* ]] && timed_out=true + [[ $resp == *"Error retrieving account"* ]] && error_retrieve=true fi [[ $invalid_webroot_dir == true ]] && exit $WRONG_WEBROOT_ERROR; -[[ $timed_out == true ]] && exit $TIME_OUT_ERROR; +[[ $timed_out == true || $error_retrieve == true ]] && exit $TIME_OUT_ERROR; [[ $rate_limit_exceeded == true ]] && { echo "$error"; exit $TOO_MANY_CERTS; } [[ $result_code != "0" ]] && { echo "$all_invalid_domains_errors"; exit $GENERAL_RESULT_ERROR; } diff --git a/scripts/install-ssl.js b/scripts/install-ssl.js index 8cae7499..ef500228 100644 --- a/scripts/install-ssl.js +++ b/scripts/install-ssl.js @@ -51,7 +51,15 @@ function run() { function use(script, config) { var Transport = com.hivext.api.core.utils.Transport, + error, + body; + + try { body = new Transport().get(baseUrl + "/" + script + "?_r=" + Math.random()); + } catch (e) { + error = !body ? "Unable to download 'ssl-manager' script from GitHub. Error: " + e : ""; + if (error) return error; + } return new (new Function("return " + body)())(config); }