diff --git a/plugins/system/debsecan b/plugins/system/debsecan index a4f7940f..5f63e679 100755 --- a/plugins/system/debsecan +++ b/plugins/system/debsecan @@ -1,16 +1,34 @@ #!/bin/sh -# -# Plugin to monitor the number of CVE vulnerabilities present on a Debian -# system (using debsecan). Might work on other distib, who knows... -# -# Inspiration of the moment 10/10/2007 -# -# Nicolas BOUTHORS http://nbi.fr/ -# -# Licence : Public Domain -# -#%# family=auto -#%# capabilities=autoconf + +: << =cut + +=head1 NAME + +debsecan - Plugin to monitor the number of CVE vulnerabilities present on a Debian +system (using debsecan). Might work on other distib, who knows... + +=head1 CONFIGURATION + + [debsecan] + env.suite jessie + env.fixed_warn 1 + env.fixed_critical 1000 + +=head1 AUTHORS + +* Nicolas BOUTHORS http://nbi.fr/, Inspiration of the moment 10/10/2007 +* Olivier Mehani , 2016 + +=head1 LICENSE + +Public Domain + +=head1 MAGIC MARKERS + +%# family=auto +%# capabilities=autoconf + +=cut # Auto enable if we have debsecan only if [ "$1" = "autoconf" ] ; then @@ -27,9 +45,19 @@ if [ ! -x /usr/bin/debsecan ]; then exit 1 fi +# Determine suite from filename... +SUITE=`echo $0 | sed 's/.*_//'` +if [ ${SUITE} = ${0} ]; then + # ...or fall back onto configuration in environment + SUITE=${suite:-sid} +fi +FIXEDWARN=${fixed_warning:-1} +FIXEDCRIT=${fixed_critical:-1000} + +CVERE="\(\(CVE\|TMP\)[-0-9A-Fa-f]\+\)" if [ "$1" = "config" ] ; then cat < /dev/null > ${OUT} +FIXED=`mktemp -t debsecan.XXXXXX` +debsecan --suite ${SUITE} 2> /dev/null > ${OUT} grep 'high urgency' ${OUT} > ${HIGH} grep 'medium urgency' ${OUT} > ${MEDIUM} grep 'low urgency)' ${OUT} > ${LOW} -grep -v '\(low\|medium\|high\) urgency' ${OUT} > ${OTHER} +grep '(fixed' ${OUT} > ${FIXED} high=`cat ${HIGH} | wc -l` medium=`cat ${MEDIUM} | wc -l` low=`cat ${LOW} | wc -l` other=`cat ${OTHER} | wc -l` +fixed=`cat ${FIXED} | wc -l` cat <