mirror of https://github.com/CISOfy/lynis.git
Enhanced error handling during license check
This commit is contained in:
parent
3b3a852122
commit
0288c6df34
|
@ -124,24 +124,43 @@ output "Settings file: ${SETTINGS_FILE}"
|
||||||
EXITCODE=$?
|
EXITCODE=$?
|
||||||
if [ ${EXITCODE} -gt 0 ]; then
|
if [ ${EXITCODE} -gt 0 ]; then
|
||||||
LogText "Exit code: ${EXITCODE}"
|
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 "Result: could not resolve the defined proxy server (${UPLOAD_PROXY_SERVER})."
|
||||||
LogText "Suggestion: check if the proxy is properly defined in the profile."
|
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."
|
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 "Result: could not contact license server."
|
||||||
LogText "Details: used URL ${LICENSE_SERVER_URL}"
|
LogText "Details: used URL ${LICENSE_SERVER_URL}"
|
||||||
LogText "Suggestion: check if the upload host is correctly configured."
|
LogText "Suggestion: check if the upload host is correctly configured."
|
||||||
echo "${RED}Error${NORMAL}: license server not available. See ${LOGFILE} for details."
|
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 "${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 "If you want to accept a self-signed certificate, use the -k option in the profile."
|
||||||
echo "Example: ${WHITE}config:upload_options:-k:${NORMAL}"
|
echo "Example: ${WHITE}config:upload_options:-k:${NORMAL}"
|
||||||
LogText "Result: found self-signed certificate, however cURL -k option not used."
|
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."
|
echo "${RED}Upload Error: ${NORMAL}cURL exited with code ${EXITCODE}. See ${LOGFILE} for details."
|
||||||
LogText "Result: cURL exited with code ${EXITCODE}."
|
LogText "Result: cURL exited with code ${EXITCODE}. See man page of cURL for the meaning of this code."
|
||||||
fi
|
;;
|
||||||
|
esac
|
||||||
LogText "Result: quitting, can't check license"
|
LogText "Result: quitting, can't check license"
|
||||||
ExitFatal
|
ExitFatal
|
||||||
fi
|
fi
|
||||||
|
@ -195,7 +214,7 @@ output "Settings file: ${SETTINGS_FILE}"
|
||||||
# Quit
|
# Quit
|
||||||
ExitClean
|
ExitClean
|
||||||
else
|
else
|
||||||
Display --indent 2 --text "Data upload status" --status OK --color GREEN
|
Display --indent 2 --text "Data upload status" --result OK --color GREEN
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "${RED}Error${NORMAL}: No hostid found in report file. Can not upload report file."
|
echo "${RED}Error${NORMAL}: No hostid found in report file. Can not upload report file."
|
||||||
|
|
Loading…
Reference in New Issue