mirror of
https://github.com/CISOfy/lynis.git
synced 2025-07-27 15:54:09 +02:00
Added new parameters to ReportSuggestion and ReportWarning functions
This commit is contained in:
parent
84821a4ed0
commit
8b5b8b4a01
@ -1240,26 +1240,49 @@
|
|||||||
ReportSuggestion()
|
ReportSuggestion()
|
||||||
{
|
{
|
||||||
TOTAL_SUGGESTIONS=`expr ${TOTAL_SUGGESTIONS} + 1`
|
TOTAL_SUGGESTIONS=`expr ${TOTAL_SUGGESTIONS} + 1`
|
||||||
# 2 parameters
|
# 4 parameters
|
||||||
# <ID> <suggestion text>
|
# <ID> <Suggestion> <Details> <Solution>
|
||||||
report "suggestion[]=$1|$2|"
|
# <ID> Lynis ID (use CUST-.... for your own tests)
|
||||||
logtext "Suggestion: $2 [$1]"
|
# <Suggestion> Suggestion text to be displayed
|
||||||
|
# <Details> Specific item or details
|
||||||
|
# <Solution> Optional link for additional information:
|
||||||
|
# * url:http://site/link
|
||||||
|
# * text:Additional explanation
|
||||||
|
# * - for none
|
||||||
|
if [ "$1" = "" ]; then TEST="UNKNOWN"; else TEST="$1"; fi
|
||||||
|
if [ "$2" = "" ]; then MESSAGE="UNKNOWN"; else MESSAGE="$2"; fi
|
||||||
|
if [ "$3" = "" ]; then DETAILS="-"; else DETAILS="$3"; fi
|
||||||
|
if [ "$4" = "" ]; then SOLUTION="-"; else SOLUTION="$4"; fi
|
||||||
|
report "suggestion[]=${TEST}|${MESSAGE}|${DETAILS}|${SOLUTION}|"
|
||||||
|
logtext "Suggestion: ${MESSAGE} [test:$1] [details:${DETAILS}] [solution:${SOLUTION}]"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Log warning to report file
|
# Log warning to report file
|
||||||
ReportWarning()
|
ReportWarning()
|
||||||
{
|
{
|
||||||
TOTAL_WARNINGS=`expr ${TOTAL_WARNINGS} + 1`
|
TOTAL_WARNINGS=`expr ${TOTAL_WARNINGS} + 1`
|
||||||
# 3 parameters
|
# Old style
|
||||||
# <ID> <priority/impact> <warning text>
|
# <ID> <priority/impact> <warning text>
|
||||||
if [ "$2" = "L" -o "$2" = "M" -o "$2" = "H" ]; then
|
if [ "$2" = "L" -o "$2" = "M" -o "$2" = "H" ]; then
|
||||||
# old style warning
|
|
||||||
report "warning[]=$1|$3|"
|
report "warning[]=$1|$3|"
|
||||||
logtext "Warning: $3 [$1]"
|
logtext "Warning: $3 [$1]"
|
||||||
else
|
else
|
||||||
# new style warning
|
# New style warning format:
|
||||||
report "warning[]=$1|$2|"
|
# <ID> <Warning> <Details> <Solution>
|
||||||
logtext "Warning: $2 [test:$1]"
|
#
|
||||||
|
# <ID> Lynis ID (use CUST-.... for your own tests)
|
||||||
|
# <Warning> Warning text to be displayed
|
||||||
|
# <Details> Specific item or details
|
||||||
|
# <Solution> Optional link for additional information:
|
||||||
|
# * url:http://site/link
|
||||||
|
# * text:Additional explanation
|
||||||
|
# * - for none
|
||||||
|
if [ "$1" = "" ]; then TEST="UNKNOWN"; else TEST="$1"; fi
|
||||||
|
if [ "$2" = "" ]; then MESSAGE="UNKNOWN"; else MESSAGE="$2"; fi
|
||||||
|
if [ "$3" = "" ]; then DETAILS="-"; else DETAILS="$3"; fi
|
||||||
|
if [ "$4" = "" ]; then SOLUTION="-"; else SOLUTION="$4"; fi
|
||||||
|
report "warning[]=${TEST}|${MESSAGE}|${DETAILS}|${SOLUTION}|"
|
||||||
|
logtext "Warning: ${MESSAGE} [test:$1] [details:${DETAILS}] [solution:${SOLUTION}]"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user