summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Schmaus <flow@gentoo.org>2022-05-09 13:50:33 +0200
committerFlorian Schmaus <flow@gentoo.org>2022-05-09 14:07:16 +0200
commit123dc0e869f647b8d0009e5fdd2152a74ec11227 (patch)
treefed6bd93a2bb8e28320ed209aa216167109d695b /net-analyzer
parentnet-analyzer/gvm-libs: fixes, ebuild style (diff)
downloadgentoo-123dc0e869f647b8d0009e5fdd2152a74ec11227.tar.gz
gentoo-123dc0e869f647b8d0009e5fdd2152a74ec11227.tar.bz2
gentoo-123dc0e869f647b8d0009e5fdd2152a74ec11227.zip
net-analyzer/gvmd: fix LICENSE, gvm-sync-all helper, GVM_DEFAULT_DROP_USER
Signed-off-by: Florian Schmaus <flow@gentoo.org>
Diffstat (limited to 'net-analyzer')
-rw-r--r--net-analyzer/gvmd/files/gvm-sync-all31
-rw-r--r--net-analyzer/gvmd/files/gvm-sync-all.service7
-rw-r--r--net-analyzer/gvmd/files/gvm-sync-all.timer9
-rw-r--r--net-analyzer/gvmd/gvmd-21.4.5-r4.ebuild (renamed from net-analyzer/gvmd/gvmd-21.4.5-r3.ebuild)6
4 files changed, 52 insertions, 1 deletions
diff --git a/net-analyzer/gvmd/files/gvm-sync-all b/net-analyzer/gvmd/files/gvm-sync-all
new file mode 100644
index 000000000000..d12b860e7fcb
--- /dev/null
+++ b/net-analyzer/gvmd/files/gvm-sync-all
@@ -0,0 +1,31 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+case ${USER} in
+ root)
+ exec su --shell /bin/bash --command "$0 $@" gvm
+ ;;
+ gvm)
+ ;;
+ *)
+ >&2 echo "Must be run as root or gvm user not ${USER}"
+ exit 1
+ ;;
+esac
+
+while getopts d OPTION "$@"; do
+ case ${OPTION} in
+ d)
+ set -x
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+greenbone-nvt-sync
+# Note that Greenbone recommends to sync CERT *after* SCAP, as the
+# former depends on the later. See
+# https://github.com/greenbone/gvmd/blob/main/INSTALL.md#keeping-the-feeds-up-to-date
+for FEED_TYPE in SCAP CERT GVMD_DATA; do
+ greenbone-feed-sync --type ${FEED_TYPE}
+done
diff --git a/net-analyzer/gvmd/files/gvm-sync-all.service b/net-analyzer/gvmd/files/gvm-sync-all.service
new file mode 100644
index 000000000000..a82e2950f3fd
--- /dev/null
+++ b/net-analyzer/gvmd/files/gvm-sync-all.service
@@ -0,0 +1,7 @@
+[Unit]
+Description=Update all feeds of the Greenbone Vulerability Management (GMV) suite
+After=network-online.target
+
+[Service]
+ExecStart=/usr/sbin/gvm-sync-all
+User=gvm
diff --git a/net-analyzer/gvmd/files/gvm-sync-all.timer b/net-analyzer/gvmd/files/gvm-sync-all.timer
new file mode 100644
index 000000000000..9faf470e013c
--- /dev/null
+++ b/net-analyzer/gvmd/files/gvm-sync-all.timer
@@ -0,0 +1,9 @@
+[Unit]
+Description=Daily update of all feeds of the Greenbone Vulerability Management (GMV) suite
+
+[Timer]
+OnCalendar=daily
+RandomizedDelaySec=2hour
+
+[Install]
+WantedBy=timers.target
diff --git a/net-analyzer/gvmd/gvmd-21.4.5-r3.ebuild b/net-analyzer/gvmd/gvmd-21.4.5-r4.ebuild
index ea09acaeeeb5..5b5e6ab83497 100644
--- a/net-analyzer/gvmd/gvmd-21.4.5-r3.ebuild
+++ b/net-analyzer/gvmd/gvmd-21.4.5-r4.ebuild
@@ -10,7 +10,7 @@ HOMEPAGE="https://www.greenbone.net https://github.com/greenbone/gvmd/"
SRC_URI="https://github.com/greenbone/gvmd/archive/v${PV}.tar.gz -> ${P}.tar.gz"
SLOT="0"
-LICENSE="GPL-2+"
+LICENSE="AGPL-3+"
KEYWORDS="~amd64 ~x86"
IUSE="doc test"
RESTRICT="!test? ( test )"
@@ -87,6 +87,7 @@ src_configure() {
"-DLIBDIR=${EPREFIX}/usr/$(get_libdir)"
"-DSBINDIR=${EPREFIX}/usr/bin"
"-DSYSTEMD_SERVICE_DIR=$(systemd_get_systemunitdir)"
+ "-DGVM_DEFAULT_DROP_USER=gvm"
)
cmake_src_configure
}
@@ -123,4 +124,7 @@ src_install() {
if ! use prefix; then
fowners -R gvm:gvm /var/lib/gvm
fi
+
+ dosbin "${FILESDIR}"/gvm-sync-all
+ systemd_dounit "${FILESDIR}"/gvm-sync-all.{service,timer}
}