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

switch-to-insecure-mode-if-tlsdownload-fails #97

Merged
merged 8 commits into from Jul 20, 2017

switch from wget to curl and handle selinux error

  • Loading branch information
root
root committed Jun 23, 2017
commit e1e10bdf93b40ee2b6a83dbca0dcda1d91db4a4e
@@ -458,8 +458,9 @@ checkIfSelinuxServiceEnforced()
if [ $? -ne 0 ]; then
logMsgToConfigSysLog "INFO" "INFO: selinux status is not enforced."
elif [ $(getenforce | grep "Enforcing" | wc -l) -gt 0 ]; then
logMsgToConfigSysLog "ERROR" "ERROR: selinux status is 'Enforcing'. Please disable it and start the rsyslog daemon manually."
exit 1
logMsgToConfigSysLog "Info" "Info: selinux status is 'Enforcing'. Setting it to the permissive mode and restarting the rsyslog daemon."
setenforce 0
restartRsyslog
fi

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jun 23, 2017
Author Contributor

@mchaudhary and @mostlyjason, while running our script on different distributions, I found one more thing that was breaking our script execution(on RedHat) i.e. if SELinux status is enforcing in the system then the script exits by showing the above error message which I thought should not happen so if SELinux status is set to enforcing then I am showing an info message and setting the SELinux status to permissive mode by setting its value to 0 and restarting the rsyslog service so that changes take effect. In this way, our script will not exit in between and will run smoothly.

}

@@ -875,7 +876,7 @@ searchAndFetch()
{
url=$2

result=$(wget -qO- /dev/null --user "$LOGGLY_USERNAME" --password "$LOGGLY_PASSWORD" "$url")
result=$(curl -s -u $LOGGLY_USERNAME:$LOGGLY_PASSWORD $url)

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jun 23, 2017
Author Contributor

@mchaudhary and @mostlyjason, Here I have replaced the wget command wth curl. I looked in differents environments to check if curl is present or not and I found it installed in almost each distribution listed below

Amazon AMI 2017.03
Ubuntu 14
RedHat
SUSE
Fedora
CentOS

I have also tested the configure-linux.sh script with this updated code and everything looked fine to me.

This comment has been minimized.

@mchaudhary

mchaudhary Jul 19, 2017
Contributor

@Shwetajain148 Can we try this on Ubuntu 12.04. I am almost certain that 12.04 doesn't have curl in it

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jul 19, 2017
Author Contributor

@mchaudhary I just created a new Ubuntu 12.04 instance on Amazon and I could see that curl is pre-installed on it and there is no need to install it manually.

This comment has been minimized.

@mostlyjason

mostlyjason Jul 19, 2017
Contributor

We have had curl built into our script for a long time and haven't heard any complaints. I'm guessing it's common or easy to install.


if [ -z "$result" ]; then
logMsgToConfigSysLog "ERROR" "ERROR: Please check your network/firewall settings & ensure Loggly subdomain, username and password is specified correctly."
@@ -889,7 +890,7 @@ searchAndFetch()
url="$LOGGLY_ACCOUNT_URL/apiv2/events?rsid=$id"

# retrieve the data
result=$(wget -qO- /dev/null --user "$LOGGLY_USERNAME" --password "$LOGGLY_PASSWORD" "$url")
result=$(curl -s -u $LOGGLY_USERNAME:$LOGGLY_PASSWORD $url)
count=$(echo "$result" | grep total_events | awk '{print $2}')
count="${count%\,}"
eval $1="'$count'"
@@ -1021,4 +1022,3 @@ fi
########## Get Inputs from User - End ########## -------------------------------------------------------
# End of Syslog Logging Directives for Loggly
#

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