aboutsummaryrefslogtreecommitdiffstats
path: root/community/openvas
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2019-10-21 16:32:35 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2019-10-21 20:01:23 +0000
commit70c3390d501495201a01fac9f671f389afbc78aa (patch)
treebe4b96103d5bf1a53f36a3295c1e1b9ccbf175cb /community/openvas
parent359d30ae8a1c64704634045f8bc27ef4b348a143 (diff)
downloadaports-70c3390d501495201a01fac9f671f389afbc78aa.tar.bz2
aports-70c3390d501495201a01fac9f671f389afbc78aa.tar.xz
community/openvas: renamed from openvas-scanner
Diffstat (limited to 'community/openvas')
-rw-r--r--community/openvas/APKBUILD65
-rw-r--r--community/openvas/execinfo-musl-fix.patch40
-rw-r--r--community/openvas/greenbone-nvt-sync.cron5
-rw-r--r--community/openvas/malloc-trim.patch24
-rw-r--r--community/openvas/openvas-sysctl.conf2
-rwxr-xr-xcommunity/openvas/openvas.post-install4
6 files changed, 140 insertions, 0 deletions
diff --git a/community/openvas/APKBUILD b/community/openvas/APKBUILD
new file mode 100644
index 0000000000..33375afda0
--- /dev/null
+++ b/community/openvas/APKBUILD
@@ -0,0 +1,65 @@
+# Contributor: Francesco Colista <fcolista@alpinelinux.org>
+# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
+pkgname=openvas
+pkgver=7.0.0
+pkgrel=1
+pkgdesc="Open Vulnerability Assessment Scanner"
+url="http://www.openvas.org/"
+arch="all"
+license="GPL-2.0"
+depends="redis nmap coreutils openssl util-linux"
+install="$pkgname.post-install"
+pkgusers="gvm"
+checkdepends="cppcheck"
+makedepends="cmake bison gvm-libs-dev glib-dev libgcrypt-dev
+ doxygen xmltoman graphviz libpcap-dev gpgme-dev
+ clang-dev libssh-dev libksba-dev net-snmp-dev"
+subpackages="$pkgname-doc $pkgname-config"
+source="$pkgname-$pkgver.tar.gz::https://github.com/greenbone/$pkgname/archive/v$pkgver.tar.gz
+ greenbone-nvt-sync.cron
+ execinfo-musl-fix.patch
+ malloc-trim.patch
+ openvas-sysctl.conf"
+
+prepare() {
+ default_prepare
+ mkdir build
+}
+
+build() {
+ cd $builddir/build
+ cmake -DCMAKE_BUILD_TYPE=Release \
+ -DSBINDIR=/usr/bin \
+ -DCMAKE_INSTALL_PREFIX=/usr \
+ -DSYSCONFDIR=/etc \
+ -DLOCALSTATEDIR=/var \
+ ..
+ make
+}
+
+check() {
+ cd $builddir/build
+ make check
+}
+
+package() {
+ cd $builddir/build
+ make DESTDIR="$pkgdir" install
+ chown $pkgusers "$pkgdir"/etc/openvas
+ chown $pkgusers "$pkgdir"/var/log/gvm
+ chown $pkgusers "$pkgdir"/var/lib/openvas/plugins
+}
+
+config() {
+ pkgdesc="Configuration files and scripts for openvas"
+ install -Dm744 "$srcdir"/greenbone-nvt-sync.cron \
+ "$subpkgdir"/etc/periodic/daily/greenbone-nvt-sync
+ install -Dm644 "$builddir"/config/redis-openvas.conf "$subpkgdir"/etc/redis-openvas.conf
+ install -Dm644 "$srcdir"/openvas-sysctl.conf "$subpkgdir"/etc/sysctl.d/02-openvas.conf
+}
+
+sha512sums="ce3e78ce5e1575c5c37b6c2aa77ec8955754029832bafb3fcedd75b48dff309906a97bac052d206f6e93e9e72b8461a131558e849f70b3afce6280a7b06924d1 openvas-7.0.0.tar.gz
+da53e5c5e3ab70749249c2bf6c4fe0e0d17a2afb39d4519eb7fdf873c3fedf925183db050ab5395a3fe7f1ce79d95bf4f55c69611205d00dc519ce15418bd915 greenbone-nvt-sync.cron
+ffb2b6798eec54f39727e71ddc8e709c06b4dc8be37f05a87676233be3f0dd6701bdea6f61367af56b9d4342ec5e80489830d611ebe85861d7dda625941e785b execinfo-musl-fix.patch
+ae4f35ba0705eb16e98765f370a3225bbca6de4bcffeff20cde1d6d1a3487036ff5f683d9e38f0df3308770656876e240fc75c62ba9e2bb1d2e4998ac80e6395 malloc-trim.patch
+1b85a5511e73a79bc2c9e11e773fee4d641a2f55760eb8e3f4a41cc0d73007e2f6300832c35dd2408838eb42efef54ba6e238a0ed551e34d21becc2aef499991 openvas-sysctl.conf"
diff --git a/community/openvas/execinfo-musl-fix.patch b/community/openvas/execinfo-musl-fix.patch
new file mode 100644
index 0000000000..a992f60a16
--- /dev/null
+++ b/community/openvas/execinfo-musl-fix.patch
@@ -0,0 +1,40 @@
+diff --git a/src/sighand.c b/src/sighand.c
+index c82e7e3..4d7001e 100644
+--- a/src/sighand.c
++++ b/src/sighand.c
+@@ -22,8 +22,9 @@
+ * @file sighand.c
+ * @brief Provides signal handling functions.
+ */
+-
++#ifdef HAVE_EXECINFO_H
+ #include <execinfo.h> /* for backtrace() */
++#endif
+ #include <glib.h> /* for G_LOG_DOMAIN, for g_critical() */
+ #include <signal.h> /* for kill() */
+ #include <sys/wait.h> /* for waitpid() */
+@@ -106,7 +107,7 @@ sighand_chld (pid_t pid)
+
+ waitpid (pid, &status, WNOHANG);
+ }
+-
++#ifdef HAVE_EXECINFO_H
+ static void
+ print_trace ()
+ {
+@@ -125,12 +126,15 @@ print_trace ()
+
+ g_free (strings);
+ }
++#endif
+
+ void
+ sighand_segv (int given_signal)
+ {
+ signal (SIGSEGV, _exit);
++#ifdef HAVE_EXECINFO_H
+ print_trace ();
++#endif
+ make_em_die (SIGTERM);
+ /* Raise signal again, to exit with the correct return value,
+ * and to enable core dumping. */
diff --git a/community/openvas/greenbone-nvt-sync.cron b/community/openvas/greenbone-nvt-sync.cron
new file mode 100644
index 0000000000..e3a5c40a03
--- /dev/null
+++ b/community/openvas/greenbone-nvt-sync.cron
@@ -0,0 +1,5 @@
+#!/bin/sh
+/usr/bin/greenbone-nvt-sync >& /dev/null
+/usr/bin/greenbone-scapdata-sync >& /dev/null
+/usr/bin/greenbone-certdata-sync >& /dev/null
+
diff --git a/community/openvas/malloc-trim.patch b/community/openvas/malloc-trim.patch
new file mode 100644
index 0000000000..367f9c2871
--- /dev/null
+++ b/community/openvas/malloc-trim.patch
@@ -0,0 +1,24 @@
+diff --git a/src/pluginscheduler.c b/src/pluginscheduler.c
+index 069b110..8e0f1f7 100644
+--- a/src/pluginscheduler.c
++++ b/src/pluginscheduler.c
+@@ -305,7 +305,9 @@ plugins_scheduler_init (const char *plugins_list, int autoload,
+ plugins_scheduler_free (ret);
+ return NULL;
+ }
++#ifdef __GLIBC__
+ malloc_trim (0);
++#endif
+ return ret;
+ }
+
+@@ -407,7 +409,9 @@ scheduler_phase_cleanup (plugins_scheduler_t sched, int start, int end)
+ element = element->next;
+ }
+ }
++#ifdef __GLIBC__
+ malloc_trim (0);
++#endif
+ }
+
+ struct scheduler_plugin *
diff --git a/community/openvas/openvas-sysctl.conf b/community/openvas/openvas-sysctl.conf
new file mode 100644
index 0000000000..28dab9aeda
--- /dev/null
+++ b/community/openvas/openvas-sysctl.conf
@@ -0,0 +1,2 @@
+net.core.somaxconn=1024
+vm.overcommit_memory=1
diff --git a/community/openvas/openvas.post-install b/community/openvas/openvas.post-install
new file mode 100755
index 0000000000..277549d54c
--- /dev/null
+++ b/community/openvas/openvas.post-install
@@ -0,0 +1,4 @@
+#!/bin/sh
+echo 'cfgfile="/etc/redis-openvas.conf"' >> /etc/conf.d/redis
+echo 'db_address = /run/redis-openvas/redis.sock' > /etc/openvas/openvas.conf
+exit 0