Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Je 58821 #197

Open
wants to merge 8 commits into
base: stage
Choose a base branch
from
8 changes: 8 additions & 0 deletions scripts/create-installation-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
5 changes: 3 additions & 2 deletions scripts/generate-ssl-cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ]] && {
Expand Down Expand Up @@ -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; }

Expand Down
8 changes: 8 additions & 0 deletions scripts/install-ssl.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down