summaryrefslogtreecommitdiff
path: root/system/cve-check-tool
diff options
context:
space:
mode:
authorSerg Bormant <bormant@mail.ru>2017-07-15 15:01:37 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2017-07-22 06:55:57 +0700
commitc48e73413788beffeeb47f852eed6afabe2b074c (patch)
tree246cdd3a3536dd93975904e509a52678d5c0d0fb /system/cve-check-tool
parent3c19a2c32e8d63e95b0075f1694cfad3299109d2 (diff)
downloadslackbuilds-c48e73413788beffeeb47f852eed6afabe2b074c.tar.gz
system/cve-check-tool: Added (tool for checking known public CVEs).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'system/cve-check-tool')
-rw-r--r--system/cve-check-tool/README20
-rw-r--r--system/cve-check-tool/cve-check-tool.SlackBuild105
-rw-r--r--system/cve-check-tool/cve-check-tool.info10
-rw-r--r--system/cve-check-tool/slack-desc19
-rw-r--r--system/cve-check-tool/update-fmt.diff11
5 files changed, 165 insertions, 0 deletions
diff --git a/system/cve-check-tool/README b/system/cve-check-tool/README
new file mode 100644
index 0000000000..a86ae9575c
--- /dev/null
+++ b/system/cve-check-tool/README
@@ -0,0 +1,20 @@
+cve-check-tool is a tool for checking known (public) CVEs. The tool will
+identify potentially vunlnerable software packages within Linux
+distributions through version matching.
+
+CVEs are only ever potential - due to the various policies of various
+distributions, and indeed semantics in versioning within various
+projects, it is expected that the tool may generate false positives.
+
+The tool is designed to integrate with a locally cached copy of the
+National Vulnerability Database. cve-check-tool downloads the NVD in its
+entirety, from 2002 until the current moment. The decompressed XML
+database is in excess of 550MB, so this should be taken into account
+before running the tool.
+
+Make package list from package database:
+ ( cd /var/log/packages/ ; ls | rev | cut -d- -f3- | \
+ sed -e s/-/,/ -e s/^/,,/ | rev > /var/log/pkgs.csv )
+
+Check packages via CVEs database:
+ cve-check-tool -uNc /var/log/pkgs.csv
diff --git a/system/cve-check-tool/cve-check-tool.SlackBuild b/system/cve-check-tool/cve-check-tool.SlackBuild
new file mode 100644
index 0000000000..2713f2b4cc
--- /dev/null
+++ b/system/cve-check-tool/cve-check-tool.SlackBuild
@@ -0,0 +1,105 @@
+#!/bin/sh
+
+# Slackware build script for cve-check-tool
+
+# Copyright 2017 Serg Bormant
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+PRGNAM=cve-check-tool
+VERSION=${VERSION:-5.6.4}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+# Patch for new database format
+patch -p1 --verbose < $CWD/update-fmt.diff
+
+CFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --build=$ARCH-slackware-linux
+
+make
+make install DESTDIR=$PKG
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+find $PKG/usr/man -type f -exec gzip -9 {} \;
+for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ LICENSE AUTHORS TODO README.md \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-txz}
diff --git a/system/cve-check-tool/cve-check-tool.info b/system/cve-check-tool/cve-check-tool.info
new file mode 100644
index 0000000000..2c544ab022
--- /dev/null
+++ b/system/cve-check-tool/cve-check-tool.info
@@ -0,0 +1,10 @@
+PRGNAM="cve-check-tool"
+VERSION="5.6.4"
+HOMEPAGE="https://github.com/clearlinux/cve-check-tool"
+DOWNLOAD="https://github.com/clearlinux/cve-check-tool/releases/download/v5.6.4/cve-check-tool-5.6.4.tar.xz"
+MD5SUM="c5f4247140fc9be3bf41491d31a34155"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="Serg Bormant"
+EMAIL="bormant@mail.ru"
diff --git a/system/cve-check-tool/slack-desc b/system/cve-check-tool/slack-desc
new file mode 100644
index 0000000000..2cd389f0f7
--- /dev/null
+++ b/system/cve-check-tool/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+cve-check-tool: cve-check-tool (Automated tool for checking known public CVEs)
+cve-check-tool:
+cve-check-tool: cve-check-tool is a tool for checking known (public) CVEs.
+cve-check-tool: The tool will identify potentially vunlnerable software packages
+cve-check-tool: within Linux distributions through version matching. Where possible
+cve-check-tool: it will also seek to determine (through a distribution implemention)
+cve-check-tool: if a vulnerability has been addressed by way of a patch.
+cve-check-tool:
+cve-check-tool: Homepage: https://github.com/clearlinux/cve-check-tool
+cve-check-tool:
+cve-check-tool:
diff --git a/system/cve-check-tool/update-fmt.diff b/system/cve-check-tool/update-fmt.diff
new file mode 100644
index 0000000000..9c75a9b587
--- /dev/null
+++ b/system/cve-check-tool/update-fmt.diff
@@ -0,0 +1,11 @@
+--- a/src/update.c 2017-07-15 11:15:33.823135795 +0300
++++ b/src/update.c 2017-07-15 11:16:16.063133913 +0300
+@@ -188,7 +188,7 @@ static bool nvdcve_data_ok(const char *m
+ snprintf(&csum_data[idx], len, "%02hhx", digest[i]);
+ }
+
+- ret = streq(csum_meta, csum_data);
++ ret = !strcasecmp(csum_meta, csum_data);
+
+ err_unmap:
+ munmap(buffer, length);