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

Conversation

@Shwetajain148
Copy link
Contributor

@Shwetajain148 Shwetajain148 commented Jun 14, 2017

@mchaudhary @mostlyjason, I have modified code to implement below requirements in the script:

  1. If TLS package couldn't be installed then the script will show a warning message "The rsyslog-gnutls package could not be download automatically because your package manager could not be found." and will prompt to switch to insecure mode.(In prompt mode)
  2. If TLS package couldn't be installed then the script will automatically install the insecure mode.(In suppress mode)
  3. I have added a new flag --force-secure that will first show a warning message "The rsyslog-gnutls package could not be download automatically because your package manager could not be found. Please install it and restart the rsyslog service to send logs to Loggly." and then will install the secure mode in case of failure attempt of installing TLS package.

The --force-secure parameter will set the TLS configuration and when the user installs the rsyslog-gnutls package manually and restart the rsyslog service, logs will reach to Loggly. I tested this functionality.

Please review.

I have started working on testing part of the script and updating a sheet accordingly.

@@ -102,7 +102,7 @@ checkLinuxLogglyCompatibility()
checkIfUserHasRootPrivileges

#check if the OS is supported by the script. If no, then exit
checkIfSupportedOS
checkIfSupportedOS

This comment has been minimized.

@mostlyjason

mostlyjason Jun 14, 2017
Contributor

Did you change the spacing here?

read -p "Do you wish to continue with insecure mode? (yes/no)" yn
case $yn in
[Yy]* )
logMsgToConfigSysLog "INFO" "INFO: Going to overwrite the conf file: $LOGGLY_RSYSLOG_CONFFILE with insecure configuration";

This comment has been minimized.

@mostlyjason

mostlyjason Jun 14, 2017
Contributor

Does it display this if they are installing for the first time?

This comment has been minimized.

@Shwetajain148

Shwetajain148 Jun 15, 2017
Author Contributor

@mostlyjason This code will be executed whenever rsyslog-gnutls package couldn't be download or package manager is not found in the system. It will prompt the user to switch to insecure mode. For example, if I am in SUSE environment where the package manager is different from yum and apt-get so the rsyslog-gnutls package will not be downloaded. In that case, the script will prompt the user to switch to insecure mode.

@Shwetajain148 Shwetajain148 force-pushed the Shwetajain148:switch-mode branch from 2a2527e to 3a0d922 Jun 16, 2017
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.

Shwetajain148 and others added 5 commits Jun 28, 2017
@Shwetajain148
Copy link
Contributor Author

@Shwetajain148 Shwetajain148 commented Jul 18, 2017

@mchaudhary @mostlyjason I have fixed the merge conflicts and upgraded the script version to 1.18. Kindly review.

@mchaudhary mchaudhary merged commit 8ad797e into loggly:master Jul 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.