Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CISOfy/lynis.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormboelen <michael@cisofy.com>2015-08-19 16:31:24 +0300
committermboelen <michael@cisofy.com>2015-08-19 16:31:24 +0300
commitc1533442406ad788c5b55bde4f312b04becd0888 (patch)
tree415151ddbe38dcb1bc4776399e2f6c2bc48a87a5 /include/data_upload
parent0379bab6c19ecef2ca2a5a1257ec25a8b2d4448b (diff)
Capture self-signed certificates during upload with cURL
Diffstat (limited to 'include/data_upload')
-rw-r--r--include/data_upload21
1 files changed, 14 insertions, 7 deletions
diff --git a/include/data_upload b/include/data_upload
index 821deaa9..e5fad676 100644
--- a/include/data_upload
+++ b/include/data_upload
@@ -119,13 +119,20 @@ output "Settings file: ${SETTINGS_FILE}"
# Try to connect
output "Uploading data.."
logtext "Command used: ${CURLBINARY} ${CURL_OPTIONS} -s -S --data-urlencode \"data@${REPORTFILE}\" --data-urlencode \"licensekey=${LICENSE_KEY}\" --data-urlencode \"hostid=${HOSTID}\" ${UPLOAD_URL}"
- UPLOAD=`${CURLBINARY} ${CURL_OPTIONS} -s -S --data-urlencode "data@${REPORTFILE}" --data-urlencode "licensekey=${LICENSE_KEY}" --data-urlencode "hostid=${HOSTID}" ${UPLOAD_URL}`
- if [ $? -gt 0 ]; then
- #UPLOAD_CODE=`echo ${UPLOAD} | head -n 1 | awk '{ print $2 }'`
- #output "Output code from upload: ${UPLOAD_CODE}"
- output "${RED}Error occurred, please check documentation for code ${UPLOAD_CODE}.${NORMAL}"
- output "Debug:"
- output ${UPLOAD}
+ UPLOAD=`${CURLBINARY} ${CURL_OPTIONS} -s -S --data-urlencode "data@${REPORTFILE}" --data-urlencode "licensekey=${LICENSE_KEY}" --data-urlencode "hostid=${HOSTID}" ${UPLOAD_URL} 2> /dev/null`
+ EXITCODE=$?
+ if [ ${EXITCODE} -gt 0 ]; then
+ if [ ${EXITCODE} -eq 60 ]; then
+ output "${RED}Self-signed certificate used on Lynis Enterprise node${NORMAL}"
+ output "If you want to accept a self-signed certificate, use the -k option in the profile."
+ output "Example: ${WHITE}config:upload_options:-k:${NORMAL}"
+ else
+ #UPLOAD_CODE=`echo ${UPLOAD} | head -n 1 | awk '{ print $2 }'`
+ #output "Output code from upload: ${UPLOAD_CODE}"
+ output "${RED}Error occurred, please check documentation for code ${UPLOAD_CODE}.${NORMAL}"
+ output "Debug:"
+ output ${UPLOAD}
+ fi
# Quit
ExitClean
fi