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-09-24 21:26:32 +0300
committermboelen <michael@cisofy.com>2015-09-24 21:26:32 +0300
commit8b5b8b4a0129b0b317ba8a476566dcc55e4e025f (patch)
tree77ba7b8e42dd6bca6f67e32714ac6acfdf373433
parent84821a4ed0a065113867946ba44062737a0990b8 (diff)
Added new parameters to ReportSuggestion and ReportWarning functions
-rw-r--r--include/functions41
1 files changed, 32 insertions, 9 deletions
diff --git a/include/functions b/include/functions
index dac54cc2..a2cc73d8 100644
--- a/include/functions
+++ b/include/functions
@@ -1240,26 +1240,49 @@
ReportSuggestion()
{
TOTAL_SUGGESTIONS=`expr ${TOTAL_SUGGESTIONS} + 1`
- # 2 parameters
- # <ID> <suggestion text>
- report "suggestion[]=$1|$2|"
- logtext "Suggestion: $2 [$1]"
+ # 4 parameters
+ # <ID> <Suggestion> <Details> <Solution>
+ # <ID> Lynis ID (use CUST-.... for your own tests)
+ # <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
ReportWarning()
{
TOTAL_WARNINGS=`expr ${TOTAL_WARNINGS} + 1`
- # 3 parameters
+ # Old style
# <ID> <priority/impact> <warning text>
if [ "$2" = "L" -o "$2" = "M" -o "$2" = "H" ]; then
- # old style warning
report "warning[]=$1|$3|"
logtext "Warning: $3 [$1]"
else
- # new style warning
- report "warning[]=$1|$2|"
- logtext "Warning: $2 [test:$1]"
+ # New style warning format:
+ # <ID> <Warning> <Details> <Solution>
+ #
+ # <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
}