From 23ea12524fbace868f5843a3dd4eac1240859512 Mon Sep 17 00:00:00 2001 From: Francesco Colista Date: Mon, 30 Nov 2015 14:13:44 +0000 Subject: testign/openvas-scanner: new aport --- .../openvas-scanner/001-cmakelist-fortify.patch | 21 ++++++ .../openvas-scanner/002-execinfo-musl-fix.patch | 40 ++++++++++ testing/openvas-scanner/APKBUILD | 88 ++++++++++++++++++++++ .../openvas-scanner/openvas-scanner.post-install | 3 + testing/openvas-scanner/openvassd.confd | 5 ++ testing/openvas-scanner/openvassd.initd | 37 +++++++++ testing/openvas-scanner/openvassd.logrotate | 11 +++ 7 files changed, 205 insertions(+) create mode 100644 testing/openvas-scanner/001-cmakelist-fortify.patch create mode 100644 testing/openvas-scanner/002-execinfo-musl-fix.patch create mode 100644 testing/openvas-scanner/APKBUILD create mode 100644 testing/openvas-scanner/openvas-scanner.post-install create mode 100644 testing/openvas-scanner/openvassd.confd create mode 100644 testing/openvas-scanner/openvassd.initd create mode 100644 testing/openvas-scanner/openvassd.logrotate diff --git a/testing/openvas-scanner/001-cmakelist-fortify.patch b/testing/openvas-scanner/001-cmakelist-fortify.patch new file mode 100644 index 0000000000..e77214f945 --- /dev/null +++ b/testing/openvas-scanner/001-cmakelist-fortify.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 588f5d8..a98929f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -34,6 +34,7 @@ if (POLICY CMP0005) + endif (POLICY CMP0005) + + include (FindPkgConfig) ++include(CheckIncludeFile) + + if (NOT PKG_CONFIG_FOUND) + message(FATAL_ERROR "pkg-config executable not found. Aborting.") +@@ -225,7 +226,7 @@ configure_file (tools/greenbone-nvt-sync.in tools/greenbone-nvt-sync @ONLY) + + ## Program + +-set (HARDENING_FLAGS "-Wformat -Wformat-security -O2 -D_FORTIFY_SOURCE=2 -fstack-protector -Wl,-z,relro -Wl,-z,now") ++set (HARDENING_FLAGS "-Wformat -Wformat-security -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fstack-protector -Wl,-z,relro -Wl,-z,now") + + set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${HARDENING_FLAGS} -Wall -D_BSD_SOURCE -D_ISOC99_SOURCE -D_SVID_SOURCE -D_DEFAULT_SOURCE") diff --git a/testing/openvas-scanner/002-execinfo-musl-fix.patch b/testing/openvas-scanner/002-execinfo-musl-fix.patch new file mode 100644 index 0000000000..8fd2164221 --- /dev/null +++ b/testing/openvas-scanner/002-execinfo-musl-fix.patch @@ -0,0 +1,40 @@ +diff --git a/src/sighand.c b/src/sighand.c +index 1ebf206..985e470 100644 +--- a/src/sighand.c ++++ b/src/sighand.c +@@ -30,7 +30,10 @@ + #include /* for errno() */ + #include /* for wait() */ + #include /* for shutdown() */ ++ ++#ifdef HAVE_EXECINFO_H + #include ++#endif + + #include "log.h" + #include "sighand.h" +@@ -112,6 +115,7 @@ sighand_chld (pid_t pid) + waitpid (pid, &status, WNOHANG); + } + ++#ifdef HAVE_EXECINFO_H + static void + print_trace () + { +@@ -126,13 +130,16 @@ print_trace () + log_write ("%s\n", symbols[i]); + g_free (symbols); + } ++#endif + + void + sighand_segv () + { + signal (SIGSEGV, _exit); + log_write ("SIGSEGV occured !"); ++ #ifdef HAVE_EXECINFO_H + print_trace (); ++ #endif + make_em_die (SIGTERM); + log_close (); + _exit (0); diff --git a/testing/openvas-scanner/APKBUILD b/testing/openvas-scanner/APKBUILD new file mode 100644 index 0000000000..32c1349d23 --- /dev/null +++ b/testing/openvas-scanner/APKBUILD @@ -0,0 +1,88 @@ +# Contributor: Francesco Colista +# Maintainer: Francesco Colista +pkgname=openvas-scanner +_pkgname=openvassd +pkgver=5.0.4 +_pkgid=2129 +pkgrel=0 +pkgdesc="The OpenVAS scanning Daemon" +url="http://www.openvas.org/" +arch="all" +license="GPL" +depends="redis nmap" +depends_dev="" +makedepends="$depends_dev cmake openvas-libraries-dev glib-dev + doxygen xmltoman" +install="" +subpackages="$pkgname-doc" +source="http://wald.intevation.org/frs/download.php/$_pkgid/$pkgname-$pkgver.tar.gz + $_pkgname.initd + $_pkgname.confd + $_pkgname.logrotate + 001-cmakelist-fortify.patch + 002-execinfo-musl-fix.patch" + +_builddir="$srcdir"/$pkgname-$pkgver +prepare() { + local i + cd "$_builddir" + for i in $source; do + case $i in + *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;; + esac + done +} + +build() { + cd "$_builddir" + cmake -DCMAKE_BUILD_TYPE=Release \ + -DSBINDIR=/usr/bin \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSYSCONFDIR=/etc \ + -DLOCALSTATEDIR=/var . + make || return 1 +} + +package() { + cd "$_builddir" + make DESTDIR="$pkgdir/" install + install -Dm644 "$srcdir/$_pkgname.logrotate" "$pkgdir/etc/logrotate.d/$_pkgname" + install -m755 -D "$srcdir"/$_pkgname.initd "$pkgdir"/etc/init.d/$_pkgname + install -m755 -D "$srcdir"/$_pkgname.confd "$pkgdir"/etc/conf.d/$_pkgname + mkdir -p "$pkgdir"/usr/share/doc/$_pkgname + cat >"$pkgdir"/usr/share/doc/$_pkgname/README.alpine <