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

Add TLS support for file monitoring #88

Merged
merged 13 commits into from Oct 10, 2017
Prev

Merge branch 'master' into tls-support-filemonitoring

  • Loading branch information
Shwetajain148
Shwetajain148 committed Oct 10, 2017
commit beeade4d570a427376c5b0f1a22b988f5db32d60
@@ -944,30 +944,75 @@ getPassword()
#function to switch system logging to insecure mode if user runs the modular script in insecure mode
switchSystemLoggingToInsecure()
{
if [[ $LOGGLY_SYSLOG_PORT == 514 ]]; then

if [ "$SUPPRESS_PROMPT" == "false" ]; then
while true;
do
read -p "Hey you are going to setup system logs in insecure mode. Do you want to overwrite this with secure mode? (yes/no)" yn
case $yn in
[Yy]* )
logMsgToConfigSysLog "INFO" "INFO: Going to overwrite the conf file: $LOGGLY_RSYSLOG_CONFFILE with secure configuration";
LOGGLY_TLS_SENDING="true"
LOGGLY_SYSLOG_PORT=6514
break;;
[Nn]* )
break;;
* ) echo "Please answer yes or no.";;
esac
done
else
logMsgToConfigSysLog "WARN" "WARN: Your system logs are being send insecurely. We prefer to send system logs securely so switching to secure configuration."
LOGGLY_TLS_SENDING="true"
LOGGLY_SYSLOG_PORT=6514

fi
fi
if [ -f $LOGGLY_RSYSLOG_CONFFILE ]; then
EXISTING_SYSLOG_PORT=$(grep -Eow 6514 $LOGGLY_RSYSLOG_CONFFILE)
if [[ $EXISTING_SYSLOG_PORT == 6514 ]]; then
if [ "$SUPPRESS_PROMPT" == "false" ]; then
while true;
do
read -p "You are running the script using insecure mode, but your system logs are using secure mode. The script only supports a single mode for both, so would you like to switch your system logs to insecure mode? (yes/no)" yn
case $yn in
[Yy]* )
logMsgToConfigSysLog "INFO" "INFO: Going to overwrite the conf file: $LOGGLY_RSYSLOG_CONFFILE with insecure configuration";
LOGGLY_TLS_SENDING="false"
LOGGLY_SYSLOG_PORT=514
break;;
[Nn]* )
logMsgToConfigSysLog "INFO" "INFO: Please re-run the script in secure mode if you want to setup secure logging"
exit 1;;
* ) echo "Please answer yes or no.";;
esac
done
else
logMsgToConfigSysLog "WARN" "WARNING: You are running the script using insecure mode, but your system logs are using secure mode. The script only supports a single mode for both, so we are switching the system logs to insecure mode as well."
LOGGLY_TLS_SENDING="false"
LOGGLY_SYSLOG_PORT=514
fi
fi
fi
}

#function to switch system logging to secure mode if user runs the modular script in secure mode
switchSystemLoggingToSecure()
{
if [ -f $LOGGLY_RSYSLOG_CONFFILE ]; then
EXISTING_SYSLOG_PORT=$(grep -Eow 514 $LOGGLY_RSYSLOG_CONFFILE)
if [[ $EXISTING_SYSLOG_PORT == 514 ]]; then
if [ "$SUPPRESS_PROMPT" == "false" ]; then
while true;
do
read -p "You are running the script using secure mode, but your system logs are using insecure mode. The script only supports a single mode for both, so would you like to switch your system logs to secure mode? (yes/no)" yn
case $yn in
[Yy]* )
logMsgToConfigSysLog "INFO" "INFO: Going to overwrite the conf file: $LOGGLY_RSYSLOG_CONFFILE with secure configuration";
LOGGLY_TLS_SENDING="true"
LOGGLY_SYSLOG_PORT=6514
break;;
[Nn]* )
logMsgToConfigSysLog "INFO" "INFO: Please re-run the script in insecure mode if you want to setup insecure logging"
exit 1;;
* ) echo "Please answer yes or no.";;
esac
done
else
logMsgToConfigSysLog "WARN" "WARNING: You are running the script using secure mode, but your system logs are using insecure mode. The script only supports a single mode for both, so we are switching the system logs to secure mode as well."
LOGGLY_TLS_SENDING="true"
LOGGLY_SYSLOG_PORT=6514
fi
fi
fi
}

#check whether the user is running the script in secure or insecure mode and then switch system logging accordingly.
checkScriptRunningMode()
{
if [ "$FORCE_SECURE" == "false" ]; then
if [[ $LOGGLY_SYSLOG_PORT == 514 ]]; then
switchSystemLoggingToInsecure
else
switchSystemLoggingToSecure
fi
fi
}

#display usage syntax
You are viewing a condensed version of this merge commit. You can view the full changes here.
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.