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

Resolve invalid subdomain issue #112

Merged
merged 1 commit into from Feb 21, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Resolve invalid subdomain issue

  • Loading branch information
Ubuntu
Ubuntu committed Jan 30, 2018
commit 32bd56c790f2d66cf6cf6cf49daa6e44df96ba94
@@ -15,7 +15,7 @@ function ctrl_c() {
#name of the current script. This will get overwritten by the child script which calls this
SCRIPT_NAME=configure-linux.sh
#version of the current script. This will get overwritten by the child script which calls this
SCRIPT_VERSION=1.20
SCRIPT_VERSION=1.21

#application tag. This will get overwritten by the child script which calls this
APP_TAG=
@@ -104,6 +104,9 @@ LOGGLY_REMOVE="false"
#Setting INSECURE mode to false initially
INSECURE_MODE="false"

#Setting invalid subdomain value
INVALID_SUBDOMAIN=*".loggly.com"*

########## Variable Declarations - End ##########

#check if the Linux environment is compatible with Loggly.
@@ -350,10 +353,15 @@ checkIfLogglyServersAccessible() {
fi

echo "INFO: Checking if '$LOGGLY_ACCOUNT' subdomain is valid."
if [ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200" | wc -l) ] >0; then

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jan 30, 2018
Author Contributor

@mchaudhary, At this point earlier, if I pass any invalid subdomain which doesn't contain .loggly.com with it but also does not exist, the script was marking it as a valid subdomain and showing it is reachable. This was happening because it checks at last if wc -l > 0 then mark the subdomain valid and reachable. But actually what happens is if we pass any invalid subdomain which does not exist, the response is multiline which satisfies this condition and subdomain is marked as valid.

Note: In both valid and invalid subdomain the response is in multiline so the script could not differentiate.

echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable."
if [[ $LOGGLY_ACCOUNT != $INVALID_SUBDOMAIN ]]; then

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jan 30, 2018
Author Contributor

@mchaudhary, This condition is to check if the subdomain is not invalid i.e. it does not contain .loggly.com in it.

if [[ $(curl --head -s --request GET $LOGGLY_ACCOUNT_URL/login | grep "200 OK\|HTTP/2 200") ]]; then

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jan 30, 2018
Author Contributor

I modified this condition to grep only the 200 response code and then mark the subdomain valid.

echo "INFO: $LOGGLY_ACCOUNT_URL is valid and reachable."
else
logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with."
exit 1
fi
else
logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with."
logMsgToConfigSysLog "ERROR" "ERROR: This is not a recognized subdomain. Please ask the account owner for the subdomain they signed up with. Please note that your subdomain is just the first string in your loggly account URL not the entire account name."
exit 1
fi

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.