From 189673244b571ad4b9fb121fbffded0e4568d31b Mon Sep 17 00:00:00 2001 From: Mariano Lopez Date: Wed, 24 Aug 2016 18:58:34 +0000 Subject: cve-check-tool: Add recipe cve-check-tool is a program for public CVEs checking. This tool also seek to determine if a vulnerability has been addressed by a patch. The recipe also includes the do_populate_cve_db task that will populate the database used by the tool. [YOCTO #7515] (From OE-Core rev: 5deadfe634638b99420342950bc544547f7121dc) Signed-off-by: Mariano Lopez Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- .../cve-check-tool/cve-check-tool_5.6.4.bb | 59 ++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb (limited to 'meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb') diff --git a/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb b/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb new file mode 100644 index 0000000000..116555962c --- /dev/null +++ b/meta/recipes-devtools/cve-check-tool/cve-check-tool_5.6.4.bb @@ -0,0 +1,59 @@ +SUMMARY = "cve-check-tool" +DESCRIPTION = "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." +HOMEPAGE = "https://github.com/ikeydoherty/cve-check-tool" +SECTION = "Development/Tools" +LICENSE = "GPL-2.0+" +LIC_FILES_CHKSUM = "file://LICENSE;md5=e8c1458438ead3c34974bc0be3a03ed6" + +SRC_URI = "https://github.com/ikeydoherty/${BPN}/releases/download/v${PV}/${BP}.tar.xz \ + file://check-for-malloc_trim-before-using-it.patch \ + " + +SRC_URI[md5sum] = "c5f4247140fc9be3bf41491d31a34155" +SRC_URI[sha256sum] = "b8f283be718af8d31232ac1bfc10a0378fb958aaaa49af39168f8acf501e6a5b" + +DEPENDS = "libcheck glib-2.0 json-glib curl libxml2 sqlite3 openssl ca-certificates" + +RDEPENDS_${PN} = "ca-certificates" + +inherit pkgconfig autotools + +EXTRA_OECONF = "--disable-coverage" +CFLAGS_append = " -Wno-error=pedantic" + +python do_populate_cve_db () { + import subprocess + import time + + if d.getVar("BB_NO_NETWORK", True) == "1": + bb.error("BB_NO_NETWORK is set; Can't update cve-check-tool database, " + "CVEs won't be checked") + return + + bb.utils.export_proxies(d) + # In case we don't inherit cve-check class, use default values defined in the class. + cve_dir = d.getVar("CVE_CHECK_DB_DIR", True) or d.expand("${DL_DIR}/CVE_CHECK") + cve_file = d.getVar("CVE_CHECK_TMP_FILE", True) or d.expand("${TMPDIR}/cve_check") + cve_cmd = "cve-check-update" + cmd = [cve_cmd, "-d", cve_dir] + bb.debug(1, "Updating cve-check-tool database located in %s" % cve_dir) + try: + output = subprocess.check_output(cmd, stderr=subprocess.STDOUT) + bb.debug(2, "Command '%s' returned:\n%s" % ("\n".join(cmd), output)) + time_utc = time.gmtime(time.time()) + time_format = "%Y-%m-%d %H:%M:%S" + with open(cve_file, "w") as f: + f.write("CVE database was updated on %s UTC\n\n" + % time.strftime(time_format, time_utc)) + + except subprocess.CalledProcessError as e: + bb.warn("Error in executing cve-check-update: %s (output %s)" % (e, e.output)) + if bb.data.inherits_class('cve-check', d): + bb.warn("Failed to update cve-check-tool database, CVEs won't be checked") +} + +addtask populate_cve_db after do_populate_sysroot +do_populate_cve_db[nostamp] = "1" + +BBCLASSEXTEND = "native nativesdk" -- cgit v1.2.3-54-g00ecf