Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 1 | SUMMARY = "cve-check-tool" |
| 2 | DESCRIPTION = "cve-check-tool is a tool for checking known (public) CVEs.\ |
| 3 | The tool will identify potentially vunlnerable software packages within Linux distributions through version matching." |
| 4 | HOMEPAGE = "https://github.com/ikeydoherty/cve-check-tool" |
| 5 | SECTION = "Development/Tools" |
| 6 | LICENSE = "GPL-2.0+" |
| 7 | LIC_FILES_CHKSUM = "file://LICENSE;md5=e8c1458438ead3c34974bc0be3a03ed6" |
| 8 | |
| 9 | SRC_URI = "https://github.com/ikeydoherty/${BPN}/releases/download/v${PV}/${BP}.tar.xz \ |
| 10 | file://check-for-malloc_trim-before-using-it.patch \ |
| 11 | file://0001-print-progress-in-percent-when-downloading-CVE-db.patch \ |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 12 | file://0001-curl-allow-overriding-default-CA-certificate-file.patch \ |
| 13 | file://0001-update-Compare-computed-vs-expected-sha256-digit-str.patch \ |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 14 | file://0001-Fix-freeing-memory-allocated-by-sqlite.patch \ |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 15 | " |
| 16 | |
| 17 | SRC_URI[md5sum] = "c5f4247140fc9be3bf41491d31a34155" |
| 18 | SRC_URI[sha256sum] = "b8f283be718af8d31232ac1bfc10a0378fb958aaaa49af39168f8acf501e6a5b" |
| 19 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 20 | UPSTREAM_CHECK_URI = "https://github.com/ikeydoherty/cve-check-tool/releases" |
| 21 | |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 22 | DEPENDS = "libcheck glib-2.0 json-glib curl libxml2 sqlite3 openssl ca-certificates" |
| 23 | |
| 24 | RDEPENDS_${PN} = "ca-certificates" |
| 25 | |
| 26 | inherit pkgconfig autotools |
| 27 | |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 28 | EXTRA_OECONF = "--disable-coverage --enable-relative-plugins" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 29 | CFLAGS_append = " -Wno-error=pedantic" |
| 30 | |
| 31 | do_populate_cve_db() { |
| 32 | if [ "${BB_NO_NETWORK}" = "1" ] ; then |
Brad Bishop | d7bf8c1 | 2018-02-25 22:55:05 -0500 | [diff] [blame] | 33 | bbwarn "BB_NO_NETWORK is set; Can't update cve-check-tool database, new CVEs won't be detected" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 34 | return |
| 35 | fi |
| 36 | |
| 37 | # In case we don't inherit cve-check class, use default values defined in the class. |
| 38 | cve_dir="${CVE_CHECK_DB_DIR}" |
| 39 | cve_file="${CVE_CHECK_TMP_FILE}" |
| 40 | |
| 41 | [ -z "${cve_dir}" ] && cve_dir="${DL_DIR}/CVE_CHECK" |
| 42 | [ -z "${cve_file}" ] && cve_file="${TMPDIR}/cve_check" |
| 43 | |
Brad Bishop | 316dfdd | 2018-06-25 12:45:53 -0400 | [diff] [blame] | 44 | unused="${@bb.utils.export_proxies(d)}" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 45 | bbdebug 2 "Updating cve-check-tool database located in $cve_dir" |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 46 | # --cacert works around curl-native not finding the CA bundle |
| 47 | if cve-check-update --cacert ${sysconfdir}/ssl/certs/ca-certificates.crt -d "$cve_dir" ; then |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 48 | printf "CVE database was updated on %s UTC\n\n" "$(LANG=C date --utc +'%F %T')" > "$cve_file" |
| 49 | else |
| 50 | bbwarn "Error in executing cve-check-update" |
| 51 | if [ "${@'1' if bb.data.inherits_class('cve-check', d) else '0'}" -ne 0 ] ; then |
| 52 | bbwarn "Failed to update cve-check-tool database, CVEs won't be checked" |
| 53 | fi |
| 54 | fi |
| 55 | } |
| 56 | |
| 57 | addtask populate_cve_db after do_populate_sysroot |
Brad Bishop | 6e60e8b | 2018-02-01 10:27:11 -0500 | [diff] [blame] | 58 | do_populate_cve_db[depends] = "cve-check-tool-native:do_populate_sysroot" |
Patrick Williams | c0f7c04 | 2017-02-23 20:41:17 -0600 | [diff] [blame] | 59 | do_populate_cve_db[nostamp] = "1" |
| 60 | do_populate_cve_db[progress] = "percent" |
| 61 | |
| 62 | BBCLASSEXTEND = "native nativesdk" |