mirror of https://github.com/CISOfy/lynis.git
[CRYP-7902] Test certificates with extension crt and pem, only if not part of a package
This commit is contained in:
parent
a70cfd0a70
commit
32b9af0767
|
@ -44,11 +44,13 @@
|
|||
if [ ${CANREAD} -eq 1 ]; then
|
||||
LogText "Result: found directory ${DIR}"
|
||||
# Search for CRT files
|
||||
sFINDCRTS=$(${FINDBINARY} ${DIR} -name "*.crt" -type f -print 2> /dev/null)
|
||||
sFINDCRTS=$(${FINDBINARY} ${DIR} -name "*.crt" -or -name "*.pem" -and -type f -print 2> /dev/null)
|
||||
if [ ! -z "${sFINDCRTS}" ]; then
|
||||
for FILE in ${sFINDCRTS}; do
|
||||
FileIsReadable ${FILE}
|
||||
if [ ${CANREAD} -eq 1 ]; then
|
||||
# Only check the files that are not installed by a package
|
||||
if ! FileInstalledByPackage ${FILE}; then
|
||||
COUNT_DIR=$((COUNT_DIR + 1))
|
||||
LogText "Test: checking certificate ${FILE}"
|
||||
# Check certificate where 'end date' has been expired
|
||||
|
@ -62,6 +64,7 @@
|
|||
FOUNDPROBLEM=1
|
||||
LogText "Result: certificate ${FILE} has been expired"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
LogText "Result: can not read file ${FILE} (no permission)"
|
||||
fi
|
||||
|
@ -72,11 +75,11 @@
|
|||
else
|
||||
LogText "Result: can not read path ${DIR} (no permission)"
|
||||
fi
|
||||
LogText "Result: found ${COUNT_DIR} certificates in ${DIR}"
|
||||
else
|
||||
LogText "Result: SSL path ${DIR} does not exist"
|
||||
fi
|
||||
COUNT_TOTAL=$((COUNT_TOTAL + COUNT_DIR))
|
||||
LogText "Result: found ${COUNT_DIR} certificates in ${DIR}"
|
||||
done
|
||||
Report "certificates=${COUNT_TOTAL}"
|
||||
LogText "Result: found a total of ${COUNT_TOTAL} certificates"
|
||||
|
|
Loading…
Reference in New Issue