Enhanced error handling during license check

This commit is contained in:
mboelen 2016-04-13 09:09:52 +02:00
parent 3b3a852122
commit 0288c6df34
1 changed files with 38 additions and 19 deletions

View File

@ -124,24 +124,43 @@ output "Settings file: ${SETTINGS_FILE}"
EXITCODE=$?
if [ ${EXITCODE} -gt 0 ]; then
LogText "Exit code: ${EXITCODE}"
if [ ${EXITCODE} -eq 5 ]; then
echo ""
echo "${RED}Upload Error${NORMAL}: License could not be checked. See ${LOGFILE} for details."
echo "Suggested command: tail -n 20 ${LOGFILE}"
echo ""
case ${EXITCODE} in
5)
LogText "Result: could not resolve the defined proxy server (${UPLOAD_PROXY_SERVER})."
LogText "Suggestion: check if the proxy is properly defined in the profile."
echo "${RED}Error${NORMAL}: could not use the defined proxy (${UPLOAD_PROXY_SERVER}). See ${LOGFILE} for details."
elif [ ${EXITCODE} -eq 7 ]; then
;;
6)
echo "${YELLOW}Error (6): ${NORMAL}Could not resolve the hostname of central server."
;;
7)
LogText "Result: could not contact license server."
LogText "Details: used URL ${LICENSE_SERVER_URL}"
LogText "Suggestion: check if the upload host is correctly configured."
echo "${RED}Error${NORMAL}: license server not available. See ${LOGFILE} for details."
elif [ ${EXITCODE} -eq 60 ]; then
;;
59)
echo "${YELLOW}Error (59): ${NORMAL}Could not connect because of used SSL cipher."
LogText "Result: SSL cipher used is not understood or accepted."
;;
60)
echo "${RED}Self-signed certificate used on Lynis Enterprise node${NORMAL}"
echo "If you want to accept a self-signed certificate, use the -k option in the profile."
echo "Example: ${WHITE}config:upload_options:-k:${NORMAL}"
LogText "Result: found self-signed certificate, however cURL -k option not used."
else
;;
83) echo "${YELLOW}Error (83): ${NORMAL}Could not check used certificate of server." ;;
*)
echo "${RED}Upload Error: ${NORMAL}cURL exited with code ${EXITCODE}. See ${LOGFILE} for details."
LogText "Result: cURL exited with code ${EXITCODE}."
fi
LogText "Result: cURL exited with code ${EXITCODE}. See man page of cURL for the meaning of this code."
;;
esac
LogText "Result: quitting, can't check license"
ExitFatal
fi
@ -195,7 +214,7 @@ output "Settings file: ${SETTINGS_FILE}"
# Quit
ExitClean
else
Display --indent 2 --text "Data upload status" --status OK --color GREEN
Display --indent 2 --text "Data upload status" --result OK --color GREEN
fi
else
echo "${RED}Error${NORMAL}: No hostid found in report file. Can not upload report file."