diff --git a/plugins/debian/debsecan b/plugins/debian/debsecan deleted file mode 100755 index 66bb0b4e..00000000 --- a/plugins/debian/debsecan +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/sh - -: << =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 - env.remote_warn 1 - env.remote_critical 10 - -=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 - if [ -x /usr/bin/debsecan ]; then - echo yes - else - echo 'no (/usr/bin/debsecan not found)' - fi - exit 0 -fi - -# Fail if we don't have debsecan -if [ ! -x /usr/bin/debsecan ]; then - echo 'error: /usr/bin/debsecan not found' >&2 - 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} -REMOTEWARN=${remote_warning:-1} -REMOTECRIT=${remote_critical:-10} - -if [ "$1" = "config" ] ; then - cat < /dev/null) -REMOTE=$(echo "$ALL" | grep 'remotely') -NONREMOTE=$(echo "$ALL" | grep -v 'remotely') - -HIGH=$(echo "${NONREMOTE}" | grep 'high urgency') -MEDIUM=$(echo "${NONREMOTE}" | grep 'medium urgency') -LOW=$(echo "${NONREMOTE}" | grep 'low urgency') -OTHER=$(echo "${NONREMOTE}" | grep -v 'urgency') -FIXED=$(echo "${ALL}" | grep '(fixed') - -remote_count=$(echo "${REMOTE}" | wc -l) -high_count=$(echo "${HIGH}" | wc -l) -medium_count=$(echo "${MEDIUM}" | wc -l) -low_count=$(echo "${LOW}" | wc -l) -other_count=$(echo "${OTHER}" | wc -l) -fixed_count=$(echo "${FIXED}" | wc -l) - -CVECOUNTRE="s/^ *\([0-9]\+\) \+\([^ ]\+\)/\2 (\1)/" - -# shellcheck disable=SC2005 disable=SC2046 -# The nested $(echo ...)s are needed to yet the newlines -cat < 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 + if [ -x /usr/bin/debsecan ]; then + echo yes + else + echo 'no (/usr/bin/debsecan not found)' + fi + exit 0 +fi + +# Fail if we don't have debsecan +if [ ! -x /usr/bin/debsecan ]; then + echo 'error: /usr/bin/debsecan not found' >&2 + exit 1 +fi + +SUITE=${suite:-sid} +FIXEDWARN=${fixed_warning:-1} +FIXEDCRIT=${fixed_critical:-1000} +REMOTEWARN=${remote_warning:-1} +REMOTECRIT=${remote_critical:-10} + +MODE=$(echo "$0" | sed 's/.*_//') +case "${MODE}" in + 'cve') + TITLE_ADD="unique " + CUT_FIELD=1 + ;; + 'pkg' | *) + TITLE_ADD="package " + CUT_FIELD=2 + ;; +esac + +if [ "$1" = "config" ] ; then + cat < /dev/null) +REMOTE=$(echo "$ALL" | grep 'remotely') +NONREMOTE=$(echo "$ALL" | grep -v 'remotely') + +HIGH=$(echo "${NONREMOTE}" | grep 'high urgency') +MEDIUM=$(echo "${NONREMOTE}" | grep 'medium urgency') +LOW=$(echo "${NONREMOTE}" | grep 'low urgency') +OTHER=$(echo "${NONREMOTE}" | grep -v 'urgency') +FIXED=$(echo "${ALL}" | grep '(fixed') + +case "${MODE}" in + 'cve') + remote_count=$(echo "${REMOTE}" | cut -f "${CUT_FIELD}" -d " "| sort | uniq | wc -l) + high_count=$(echo "${HIGH}" | cut -f "${CUT_FIELD}" -d " "| sort | uniq | wc -l) + medium_count=$(echo "${MEDIUM}" | cut -f "${CUT_FIELD}" -d " "| sort | uniq | wc -l) + low_count=$(echo "${LOW}" | cut -f "${CUT_FIELD}" -d " "| sort | uniq | wc -l) + other_count=$(echo "${OTHER}" | cut -f "${CUT_FIELD}" -d " "| sort | uniq | wc -l) + fixed_count=$(echo "${FIXED}" | cut -f "${CUT_FIELD}" -d " "| sort | uniq | wc -l) + ;; + 'pkg' | *) + remote_count=$(echo "${REMOTE}" | wc -l) + high_count=$(echo "${HIGH}" | wc -l) + medium_count=$(echo "${MEDIUM}" | wc -l) + low_count=$(echo "${LOW}" | wc -l) + other_count=$(echo "${OTHER}" | wc -l) + fixed_count=$(echo "${FIXED}" | wc -l) + ;; +esac + +# Reformat the output of the cut|sort|uniq... to a more human-friendly "item (count)" format +CVECOUNTRE="s/^ *\([0-9]\+\) \+\([^ ]\+\)/\2 (\1)/" + +# shellcheck disable=SC2005 disable=SC2046 +# The nested $(echo ...)s are needed to yet the newlines +cat <