public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/zabbix/, net-analyzer/zabbix/files/
@ 2020-07-30  8:25 Miroslav Šulc
  0 siblings, 0 replies; 5+ messages in thread
From: Miroslav Šulc @ 2020-07-30  8:25 UTC (permalink / raw
  To: gentoo-commits

commit:     43e5d720ddda22f747772ffe6cfab9b2362ed0f6
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 30 08:24:38 2020 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Thu Jul 30 08:25:00 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43e5d720

net-analyzer/zabbix: fixed CVE-2020-15803 in 3.0.31-r1

Bug: https://bugs.gentoo.org/733118
Package-Manager: Portage-3.0.1, Repoman-2.3.23
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../files/zabbix-3.0.31-fix-cve-2020-15803.patch   |  83 +++++
 net-analyzer/zabbix/zabbix-3.0.31-r1.ebuild        | 351 +++++++++++++++++++++
 2 files changed, 434 insertions(+)

diff --git a/net-analyzer/zabbix/files/zabbix-3.0.31-fix-cve-2020-15803.patch b/net-analyzer/zabbix/files/zabbix-3.0.31-fix-cve-2020-15803.patch
new file mode 100644
index 00000000000..0cca6031558
--- /dev/null
+++ b/net-analyzer/zabbix/files/zabbix-3.0.31-fix-cve-2020-15803.patch
@@ -0,0 +1,83 @@
+diff --git a/frontends/php/include/classes/screens/CScreenUrl.php b/frontends/php/include/classes/screens/CScreenUrl.php
+index e35c5f1..1df396e 100644
+--- a/frontends/php/include/classes/screens/CScreenUrl.php
++++ b/frontends/php/include/classes/screens/CScreenUrl.php
+@@ -29,18 +29,10 @@ class CScreenUrl extends CScreenBase {
+ 	public function get() {
+ 		// prevent from resolving macros in configuration page
+ 		if ($this->mode != SCREEN_MODE_PREVIEW && $this->mode != SCREEN_MODE_SLIDESHOW) {
+-			return $this->getOutput(
+-				CHtmlUrlValidator::validate($this->screenitem['url'], false)
+-					? new CIFrame($this->screenitem['url'], $this->screenitem['width'], $this->screenitem['height'],
+-							'auto')
+-					: makeMessageBox(false, [[
+-								'type' => 'error',
+-								'message' => _s('Provided URL "%1$s" is invalid.', $this->screenitem['url'])
+-							]]
+-						)
+-			);
++			return $this->getOutput($this->prepareElement());
+ 		}
+-		elseif ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && $this->hostid == 0) {
++
++		if ($this->screenitem['dynamic'] == SCREEN_DYNAMIC_ITEM && $this->hostid == 0) {
+ 			return $this->getOutput((new CTableInfo())->setNoDataMessage(_('No host selected.')));
+ 		}
+ 
+@@ -54,14 +46,28 @@ class CScreenUrl extends CScreenBase {
+ 
+ 		$this->screenitem['url'] = $url ? $url : $this->screenitem['url'];
+ 
+-		return $this->getOutput(
+-			CHtmlUrlValidator::validate($this->screenitem['url'], false)
+-				? new CIFrame($this->screenitem['url'], $this->screenitem['width'], $this->screenitem['height'], 'auto')
+-				: makeMessageBox(false, [[
+-							'type' => 'error',
+-							'message' => _s('Provided URL "%1$s" is invalid.', $this->screenitem['url'])
+-						]]
+-					)
+-		);
++		return $this->getOutput($this->prepareElement());
++	}
++
++	/**
++	 * @return CTag
++	 */
++	public function prepareElement() {
++		if (CHtmlUrlValidator::validate($this->screenitem['url'], false)) {
++			$item = new CIFrame($this->screenitem['url'], $this->screenitem['width'], $this->screenitem['height'],
++				'auto'
++			);
++
++			if (ZBX_IFRAME_SANDBOX !== false) {
++				$item->setAttribute('sandbox', ZBX_IFRAME_SANDBOX);
++			}
++
++			return $item;
++		}
++
++		return makeMessageBox(false, [[
++			'type' => 'error',
++			'message' => _s('Provided URL "%1$s" is invalid.', $this->screenitem['url'])
++		]]);
+ 	}
+ }
+diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php
+index a67a625..c6a437c 100644
+--- a/frontends/php/include/defines.inc.php
++++ b/frontends/php/include/defines.inc.php
+@@ -1284,6 +1284,14 @@ if (function_exists('bcscale')) {
+ 	bcscale(7);
+ }
+ 
++/**
++ * The sandbox attribute enables an extra set of restrictions for the content in the iframe. Default is set to empty
++ * string, which means all restrictions are applied. To disable, set to FALSE. To set a specific set of restrictions,
++ * write a custom string.
++ * https://www.w3.org/TR/2010/WD-html5-20100624/the-iframe-element.html#attr-iframe-sandbox
++ */
++define('ZBX_IFRAME_SANDBOX', '');
++
+ // HTTP headers
+ /*
+  * Value of HTTP X-Frame-options header.

diff --git a/net-analyzer/zabbix/zabbix-3.0.31-r1.ebuild b/net-analyzer/zabbix/zabbix-3.0.31-r1.ebuild
new file mode 100644
index 00000000000..e501abc50b2
--- /dev/null
+++ b/net-analyzer/zabbix/zabbix-3.0.31-r1.ebuild
@@ -0,0 +1,351 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# needed to make webapp-config dep optional
+WEBAPP_OPTIONAL="yes"
+inherit flag-o-matic webapp java-pkg-opt-2 user systemd toolchain-funcs
+
+DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
+HOMEPAGE="https://www.zabbix.com/"
+MY_P=${P/_/}
+MY_PV=${PV/_/}
+SRC_URI="https://cdn.zabbix.com/stable/${PV}/${P}.tar.gz"
+LICENSE="GPL-2"
+SLOT="0"
+WEBAPP_MANUAL_SLOT="yes"
+KEYWORDS="~amd64 ~x86"
+IUSE="+agent java curl frontend ipv6 xmpp ldap libxml2 mysql openipmi oracle +postgres proxy server ssh ssl snmp sqlite odbc static"
+REQUIRED_USE="|| ( agent frontend proxy server )
+	proxy? ( ^^ ( mysql oracle postgres sqlite odbc ) )
+	server? ( ^^ ( mysql oracle postgres odbc ) )
+	static? ( !oracle !snmp )"
+
+COMMON_DEPEND="
+	curl? ( net-misc/curl )
+	java? ( >=virtual/jdk-1.8:* )
+	ldap? (
+		=dev-libs/cyrus-sasl-2*
+		net-libs/gnutls
+		net-nds/openldap
+	)
+	libxml2? ( dev-libs/libxml2 )
+	mysql? ( dev-db/mysql-connector-c )
+	odbc? ( dev-db/unixODBC )
+	openipmi? ( sys-libs/openipmi )
+	oracle? ( dev-db/oracle-instantclient-basic )
+	postgres? ( dev-db/postgresql:* )
+	proxy?  ( sys-libs/zlib )
+	server? (
+		dev-libs/libevent
+		sys-libs/zlib
+	)
+	snmp? ( net-analyzer/net-snmp )
+	sqlite? ( dev-db/sqlite )
+	ssh? ( net-libs/libssh2 )
+	ssl? ( dev-libs/openssl:=[-bindist] )
+	xmpp? ( dev-libs/iksemel )
+"
+
+RDEPEND="${COMMON_DEPEND}
+	java? ( >=virtual/jre-1.8:* )
+	mysql? ( virtual/mysql )
+	proxy? ( net-analyzer/fping[suid] )
+	server? (
+		app-admin/webapp-config
+		dev-libs/libevent
+		dev-libs/libpcre
+		net-analyzer/fping[suid]
+	)
+	frontend? (
+		app-admin/webapp-config
+		dev-lang/php:*[bcmath,ctype,sockets,gd,truetype,xml,session,xmlreader,xmlwriter,nls,sysvipc,unicode]
+		media-libs/gd[png]
+		virtual/httpd-php:*
+		mysql? ( dev-lang/php[mysqli] )
+		odbc? ( dev-lang/php[odbc] )
+		oracle? ( dev-lang/php[oci8-instant-client] )
+		postgres? ( dev-lang/php[postgres] )
+		sqlite? ( dev-lang/php[sqlite] )
+	)
+"
+DEPEND="${COMMON_DEPEND}
+	static? (
+		curl? ( net-misc/curl[static-libs] )
+		ldap? (
+			=dev-libs/cyrus-sasl-2*[static-libs]
+			net-libs/gnutls[static-libs]
+			net-nds/openldap[static-libs]
+		)
+		libxml2? ( dev-libs/libxml2[static-libs] )
+		mysql? ( dev-db/mysql-connector-c[static-libs] )
+		odbc? ( dev-db/unixODBC[static-libs] )
+		postgres? ( dev-db/postgresql:*[static-libs] )
+		sqlite? ( dev-db/sqlite[static-libs] )
+		ssh? ( net-libs/libssh2 )
+	)
+"
+BDEPEND="
+	virtual/pkgconfig
+"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
+	"${FILESDIR}/${PN}-3.0.30-mysql8.patch"
+	"${FILESDIR}/${P}-fix-cve-2020-15803.patch"
+)
+
+S=${WORKDIR}/${MY_P}
+
+ZABBIXJAVA_BASE="opt/zabbix_java"
+
+pkg_setup() {
+	if use oracle; then
+		if [ -z "${ORACLE_HOME}" ]; then
+			eerror
+			eerror "The environment variable ORACLE_HOME must be set"
+			eerror "and point to the correct location."
+			eerror "It looks like you don't have Oracle installed."
+			eerror
+			die "Environment variable ORACLE_HOME is not set"
+		fi
+		if has_version 'dev-db/oracle-instantclient-basic'; then
+			ewarn
+			ewarn "Please ensure you have a full install of the Oracle client."
+			ewarn "dev-db/oracle-instantclient* is NOT sufficient."
+			ewarn
+		fi
+	fi
+
+	if use frontend; then
+		webapp_pkg_setup
+	fi
+
+	enewgroup zabbix
+	enewuser zabbix -1 -1 /var/lib/zabbix/home zabbix
+
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+}
+
+src_configure() {
+	econf \
+		$(use_enable agent) \
+		$(use_enable ipv6) \
+		$(use_enable java) \
+		$(use_enable proxy) \
+		$(use_enable server) \
+		$(use_enable static) \
+		$(use_with curl libcurl) \
+		$(use_with ldap) \
+		$(use_with libxml2) \
+		$(use_with mysql) \
+		$(use_with odbc unixodbc) \
+		$(use_with openipmi openipmi) \
+		$(use_with oracle) \
+		$(use_with postgres postgresql) \
+		$(use_with snmp net-snmp) \
+		$(use_with sqlite sqlite3) \
+		$(use_with ssh ssh2) \
+		$(use_with ssl openssl) \
+		$(use_with xmpp jabber)
+}
+
+src_compile() {
+	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
+		emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
+	fi
+}
+
+src_install() {
+	local dirs=(
+		/etc/zabbix
+		/var/lib/zabbix
+		/var/lib/zabbix/home
+		/var/lib/zabbix/scripts
+		/var/lib/zabbix/alertscripts
+		/var/lib/zabbix/externalscripts
+		/var/log/zabbix
+	)
+
+	for dir in "${dirs[@]}"; do
+		dodir "${dir}"
+		keepdir "${dir}"
+	done
+
+	if use server; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_server.conf
+		fperms 0640 /etc/zabbix/zabbix_server.conf
+		fowners root:zabbix /etc/zabbix/zabbix_server.conf
+
+		newinitd "${FILESDIR}"/zabbix-server.init zabbix-server
+
+		dosbin src/zabbix_server/zabbix_server
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-server.service
+		systemd_newtmpfilesd "${FILESDIR}"/zabbix-server.tmpfiles zabbix-server.conf
+	fi
+
+	if use proxy; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_proxy.conf
+		fperms 0640 /etc/zabbix/zabbix_proxy.conf
+		fowners root:zabbix /etc/zabbix/zabbix_proxy.conf
+
+		newinitd "${FILESDIR}"/zabbix-proxy.init zabbix-proxy
+
+		dosbin src/zabbix_proxy/zabbix_proxy
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-proxy.service
+		systemd_newtmpfilesd "${FILESDIR}"/zabbix-proxy.tmpfiles zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_agentd.conf
+		fperms 0640 /etc/zabbix/zabbix_agentd.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agentd.conf
+
+		newinitd "${FILESDIR}"/zabbix-agentd.init zabbix-agentd
+
+		dosbin src/zabbix_agent/zabbix_agentd
+		dobin \
+			src/zabbix_sender/zabbix_sender \
+			src/zabbix_get/zabbix_get
+
+		systemd_dounit "${FILESDIR}"/zabbix-agentd.service
+		systemd_newtmpfilesd "${FILESDIR}"/zabbix-agentd.tmpfiles zabbix-agentd.conf
+	fi
+
+	fowners root:zabbix /etc/zabbix
+	fowners zabbix:zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+	fperms 0750 \
+		/etc/zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+
+	dodoc README INSTALL NEWS ChangeLog \
+		conf/zabbix_agentd.conf \
+		conf/zabbix_proxy.conf \
+		conf/zabbix_agentd/userparameter_examples.conf \
+		conf/zabbix_agentd/userparameter_mysql.conf \
+		conf/zabbix_server.conf
+
+	if use frontend; then
+		webapp_src_preinst
+		cp -R frontends/php/* "${D}/${MY_HTDOCSDIR}"
+		webapp_configfile \
+			"${MY_HTDOCSDIR}"/include/db.inc.php \
+			"${MY_HTDOCSDIR}"/include/config.inc.php
+		webapp_src_install
+	fi
+
+	if use java; then
+		dodir \
+			/${ZABBIXJAVA_BASE} \
+			/${ZABBIXJAVA_BASE}/bin \
+			/${ZABBIXJAVA_BASE}/lib
+		keepdir /${ZABBIXJAVA_BASE}
+		exeinto /${ZABBIXJAVA_BASE}/bin
+		doexe src/zabbix_java/bin/zabbix-java-gateway-${MY_PV}.jar
+		exeinto /${ZABBIXJAVA_BASE}/lib
+		doexe \
+			src/zabbix_java/lib/logback-classic-0.9.27.jar \
+			src/zabbix_java/lib/logback-console.xml \
+			src/zabbix_java/lib/logback-core-0.9.27.jar \
+			src/zabbix_java/lib/logback.xml \
+			src/zabbix_java/lib/android-json-4.3_r3.1.jar \
+			src/zabbix_java/lib/slf4j-api-1.6.1.jar
+		newinitd "${FILESDIR}"/zabbix-jmx-proxy.init zabbix-jmx-proxy
+		newconfd "${FILESDIR}"/zabbix-jmx-proxy.conf zabbix-jmx-proxy
+	fi
+}
+
+pkg_postinst() {
+	if use server || use proxy ; then
+		elog
+		elog "You may need to configure your database for Zabbix"
+		elog "if you have not already done so."
+		elog
+
+		zabbix_homedir=$(egethome zabbix)
+		if [ -n "${zabbix_homedir}" ] && \
+		   [ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
+			ewarn
+			ewarn "The user 'zabbix' should have his homedir changed"
+			ewarn "to /var/lib/zabbix/home if you want to use"
+			ewarn "custom alert scripts."
+			ewarn
+			ewarn "A real homedir might be needed for configfiles"
+			ewarn "for custom alert scripts (e.g. ~/.sendxmpprc when"
+			ewarn "using sendxmpp for Jabber alerts)."
+			ewarn
+			ewarn "To change the homedir use:"
+			ewarn "  usermod -d /var/lib/zabbix/home zabbix"
+			ewarn
+		fi
+	fi
+
+	if use server; then
+		elog
+		elog "For distributed monitoring you have to run:"
+		elog
+		elog "zabbix_server -n <nodeid>"
+		elog
+		elog "This will convert database data for use with Node ID"
+		elog "and also adds a local node."
+		elog
+	fi
+
+	elog "--"
+	elog
+	elog "You may need to add these lines to /etc/services:"
+	elog
+	elog "zabbix-agent     10050/tcp Zabbix Agent"
+	elog "zabbix-agent     10050/udp Zabbix Agent"
+	elog "zabbix-trapper   10051/tcp Zabbix Trapper"
+	elog "zabbix-trapper   10051/udp Zabbix Trapper"
+	elog
+
+	if use server || use proxy ; then
+		# check for fping
+		fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
+		case "${fping_perms}" in
+			4[157][157][157])
+				;;
+			*)
+				ewarn
+				ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
+				ewarn "you have to make /usr/sbin/fping setuid root and executable"
+				ewarn "by everyone. Run the following command to fix it:"
+				ewarn
+				ewarn "  chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
+				ewarn
+				ewarn "Please be aware that this might impose a security risk,"
+				ewarn "depending on the code quality of fping."
+				ewarn
+				;;
+		esac
+	fi
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/zabbix/, net-analyzer/zabbix/files/
@ 2021-11-17  8:08 Florian Schmaus
  0 siblings, 0 replies; 5+ messages in thread
From: Florian Schmaus @ 2021-11-17  8:08 UTC (permalink / raw
  To: gentoo-commits

commit:     9534f7c3279f6b8808c3e002e5f205217e66f535
Author:     Belhassen Dahmen <belhassen.dahmen <AT> adjust <DOT> com>
AuthorDate: Tue Apr 20 15:40:34 2021 +0000
Commit:     Florian Schmaus <flow <AT> gentoo <DOT> org>
CommitDate: Wed Nov 17 08:08:29 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9534f7c3

net-analyzer/zabbix add reload() to zabbix-server init script

As zabbix-server process supports configuration reload in runtime, it
would be great to support with through the openrc commandline utility.

Bug: https://bugs.gentoo.org/824138
Signed-off-by: Belhassen Dahmen <zegeek94 <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/20473
Signed-off-by: Florian Schmaus <flow <AT> gentoo.org>

 net-analyzer/zabbix/files/zabbix-server-r1.init    | 25 ++++++++++++++++++++++
 ...{zabbix-5.4.7.ebuild => zabbix-5.4.7-r1.ebuild} |  2 +-
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/net-analyzer/zabbix/files/zabbix-server-r1.init b/net-analyzer/zabbix/files/zabbix-server-r1.init
new file mode 100644
index 000000000000..1652ba782fa8
--- /dev/null
+++ b/net-analyzer/zabbix/files/zabbix-server-r1.init
@@ -0,0 +1,25 @@
+#!/sbin/openrc-run
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+command="/usr/sbin/zabbix_server"
+command_args="--foreground --config /etc/zabbix/zabbix_server.conf"
+command_background="true"
+command_user="zabbix:zabbix"
+pidfile="/run/${RC_SVCNAME}.pid"
+
+depend() {
+    need net
+    use mysql postgresql
+}
+
+start_pre() {
+	checkpath -q -d -m 0750 -o root:zabbix /etc/zabbix
+	checkpath -q -f -m 0640 -o root:zabbix /etc/zabbix/*.conf
+}
+
+reload() {
+	/usr/sbin/zabbix_server \
+		-c /etc/zabbix/zabbix_server.conf \
+		-R config_cache_reload
+}

diff --git a/net-analyzer/zabbix/zabbix-5.4.7.ebuild b/net-analyzer/zabbix/zabbix-5.4.7-r1.ebuild
similarity index 99%
rename from net-analyzer/zabbix/zabbix-5.4.7.ebuild
rename to net-analyzer/zabbix/zabbix-5.4.7-r1.ebuild
index f1795467d2f7..014d630c3a5c 100644
--- a/net-analyzer/zabbix/zabbix-5.4.7.ebuild
+++ b/net-analyzer/zabbix/zabbix-5.4.7-r1.ebuild
@@ -432,7 +432,7 @@ src_install() {
 		fperms 0640 /etc/zabbix/zabbix_server.conf
 		fowners root:zabbix /etc/zabbix/zabbix_server.conf
 
-		newinitd "${FILESDIR}"/zabbix-server.init zabbix-server
+		newinitd "${FILESDIR}"/zabbix-server-r1.init zabbix-server
 
 		dosbin src/zabbix_server/zabbix_server
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/zabbix/, net-analyzer/zabbix/files/
@ 2022-04-06  9:30 Miroslav Šulc
  0 siblings, 0 replies; 5+ messages in thread
From: Miroslav Šulc @ 2022-04-06  9:30 UTC (permalink / raw
  To: gentoo-commits

commit:     de5fb9656d66789562cb74d8b93102c7c44fc726
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Wed Apr  6 09:29:38 2022 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Wed Apr  6 09:30:23 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=de5fb965

net-analyzer/zabbix: bump to 6.0.3, 5.4.12 & 5.0.22

migrated from EGO_SUM to go deps tarball
added gentoo specific patch from
https://support.zabbix.com/browse/ZBXNEXT-7569 by alexxy

Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 net-analyzer/zabbix/Manifest                       |   6 +
 .../files/zabbix-5.0.22-system.sw.packages.patch   |  35 ++
 .../files/zabbix-5.4.12-system.sw.packages.patch   |  35 ++
 .../files/zabbix-6.0.3-system.sw.packages.patch    |  35 ++
 net-analyzer/zabbix/zabbix-5.0.22.ebuild           | 388 ++++++++++++++++++++
 net-analyzer/zabbix/zabbix-5.4.12.ebuild           | 387 ++++++++++++++++++++
 net-analyzer/zabbix/zabbix-6.0.3.ebuild            | 404 +++++++++++++++++++++
 7 files changed, 1290 insertions(+)

diff --git a/net-analyzer/zabbix/Manifest b/net-analyzer/zabbix/Manifest
index 5a540fa7a366..d6b314ad8f34 100644
--- a/net-analyzer/zabbix/Manifest
+++ b/net-analyzer/zabbix/Manifest
@@ -250,5 +250,11 @@ DIST gopkg.in%2Fyaml.v2%2F@v%2Fv2.2.8.zip 80666 BLAKE2B ff3645b71cedd41b9fef6e5d
 DIST honnef.co%2Fgo%2Ftools%2F@v%2Fv0.0.1-2019.2.3.mod 300 BLAKE2B 3e3f5a2be0918cbaacd5e43e59fcc6c7c6999645f0c9214cd5a522c31d34b6d3dad61e3ddae8ccdb2f3f0d90b406c047802ee3d9d54dc40fe6eff9cd35620792 SHA512 0c8aa788d0c03d6d049f0dd7468d0f81ce2131ccedd5a5a3a18362b7d30eef7ef325277844eefe4b707b1ad71c6f83a44e110b7af7b98e05406d347237a7bafb
 DIST zabbix-4.0.38.tar.gz 17558387 BLAKE2B 1ddf27d76734128ddd197eb9dffeb59018282464a7322973dc4102992c0ade003d4d0291194f5b5a487d83a702917d6f0036636e56acc424bd7a7d6beb3f787c SHA512 0d38a74336c9e46b3f9985aca3508312dd5b15affeadee3497ebf8d5e59b4fa7b99ff28819b01878cbc5c9c304c1992a6a91d73f35bf1a333ae2ee561e0d7e1f
 DIST zabbix-5.0.20.tar.gz 21434290 BLAKE2B 8203d9f8831c081af05fa306ce3363ea3d1afd72587459a941e2a20de27e97dce21e34b59e21884f87f6238469c2293dad9e6e5436a9ef82c0139a18a4b0c206 SHA512 af625ee69926b1f0860d4e5e5f4348b3630c642027f5f08f876207cf705d46741c21aacbdde1367b8014c705508236281ba8556700de43c1ccf2b7a9b7f68390
+DIST zabbix-5.0.22-go-deps.tar.xz 34395200 BLAKE2B 3065878d5d61617f52ec48381a248ea13a603c13bb1cc18b6fde4e81f47bfd9dc4bafe34303e4bb46f1d7e9809d0b17acf48b782c11162fdcf04f0de89402f2b SHA512 fc30d33066248fe7c9049fec7538e1d1880d9c23d10516032027ea90e90a7531288990a33a48cbab2722a6ca67f49f79507cce7351d2c026317fc58843d4868e
+DIST zabbix-5.0.22.tar.gz 21245241 BLAKE2B d2343fc5dbc4112ef77c75bd00b8344a363a8e2acc6623a009ebd24d7116377a66d2ca94f22dee386fbee1fa9822ce7e08287cb1336fe939bd2b621fe57b5b1f SHA512 d326ed5dd81b44adf80e8cc01d32b3b7ebed0b8ffddc2870e76ffcd010513f2b2bbe4586681e5c5ab5202f88c7861078efad537bb852ee52d5c00b7712cc2aab
 DIST zabbix-5.4.10.tar.gz 24510838 BLAKE2B 37e8561e031b9267dbfeb786da7d88487142262c3f9063e83b2faafeabd88baa1a0f2e7ffa333d2e29c1b11e09ca995f42442aa60b0b994617b276152d46590c SHA512 452513c56db1778d49a32543814ed83836b480047ebc747e588b5cea8f9b199650824b9ea2042695c5551a81f1f3b2e8d98d0f658003f483bf8edf8ed5427c48
+DIST zabbix-5.4.12-go-deps.tar.xz 35810488 BLAKE2B 26a7995bbe6b40a1912f90e1ea572a0de96f9182928d2401054fc1935c9ecac25ee90cb44c7b1b0f71a8c56e4477752b2bffebca7a331fbdc341a7a9ca1eca6c SHA512 bd5882b1bfc4d75c2b42170bbab5cca5e8795f3ff001b62444faf5d1601c5ef54da0198c83253fefd5c2c465f78a9ddb2a4aa13699d198337af935a80756c991
+DIST zabbix-5.4.12.tar.gz 24513065 BLAKE2B fe289b58384c9b956fcbada940220c5288022457b7eb5b0a7ce2f86df777e2d84a45fc4d4f17f43aecac4466dc0e9d9941e0070cd00b3688b26821123d2301da SHA512 5f4862540e15f88efa52002b9ec6d7251a35e94f8e5f6f8b6090f5827a574411c813732a88a08fbcc3c24033011d678b953a7a78260aef702454269537232c7b
 DIST zabbix-6.0.2.tar.gz 33082787 BLAKE2B 53bd7574683e1166aa223ba5e992d951b5a1f1fc14e6555ebe402eb5e9f4845c3e9edc01c78e230d7120289b0e6c9a5ed87865c0541fa5095f23f6b6916defd5 SHA512 618b1705f4e1689af4d234e877ea4136d52de39bfedf6512f396b79278750bfaf994d132a7876420705690045bee78ebc2c7297ac31ac4ddd92f00d8f781267d
+DIST zabbix-6.0.3-go-deps.tar.xz 35806596 BLAKE2B bf86722b1ee26237e42b4b3b5558415e0eb29dbe675b70585c8bb06c0b1e469ed9887e425778503c1d42ee2bd938b085f544d0696d080e04957dcb5794b7afa4 SHA512 0a5a051561dee2f3e42f18fff9127e3c8a0b5a7cae3a828a880866feac81a21ef71ba83c53f9e5a37fb3eee78475974b2f30ba5398012aeca6adf8d3cea74399
+DIST zabbix-6.0.3.tar.gz 33135282 BLAKE2B d2cb50678710e96737e72ddb4b0b02d4695f872df6cab2edfd50d343ffc0103eec3191bfa02d8421e29c583f6d478598effc22a0f8d3f76b57a9ac3b4e4369fe SHA512 f93a7b4b19d2a1561e42ef67378bfb94a5edaae5b9bba8f2214de3bad1bf9d7efcb32da9f1b3ee820cc6bdc68308286606c4ceb7e1ba0ab42e24045c56f8ce47

diff --git a/net-analyzer/zabbix/files/zabbix-5.0.22-system.sw.packages.patch b/net-analyzer/zabbix/files/zabbix-5.0.22-system.sw.packages.patch
new file mode 100644
index 000000000000..353dac72b876
--- /dev/null
+++ b/net-analyzer/zabbix/files/zabbix-5.0.22-system.sw.packages.patch
@@ -0,0 +1,35 @@
+From 884982a87fc14918b062f09aa2bc3f8d2f777a14 Mon Sep 17 00:00:00 2001
+From: Alexey Shvetsov <alexxy@gentoo.org>
+Date: Mon, 21 Mar 2022 11:23:54 +0300
+Subject: [PATCH] Allow to use system.sw.packages on gentoo linux
+
+Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org>
+---
+ src/go/plugins/system/sw/sw.go       | 1 +
+ src/libs/zbxsysinfo/linux/software.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/go/plugins/system/sw/sw.go b/src/go/plugins/system/sw/sw.go
+index f0e4df0b55c..dda25380f40 100644
+--- a/src/go/plugins/system/sw/sw.go
++++ b/src/go/plugins/system/sw/sw.go
+@@ -164,6 +164,7 @@ func getManagers() []manager {
+ 		{"pkgtools", "[ -d /var/log/packages ] && echo true", "ls /var/log/packages", parseRegex},
+ 		{"rpm", "rpm --version 2> /dev/null", "rpm -qa", parseRegex},
+ 		{"pacman", "pacman --version 2> /dev/null", "pacman -Q", parseRegex},
++		{"portage", "emerge --version 2> /dev/null", "qlist -IRCv", parseRegex},
+ 	}
+ }
+ 
+diff --git a/src/libs/zbxsysinfo/linux/software.c b/src/libs/zbxsysinfo/linux/software.c
+index 2ee885ac14a..c950e65d607 100644
+--- a/src/libs/zbxsysinfo/linux/software.c
++++ b/src/libs/zbxsysinfo/linux/software.c
+@@ -176,6 +176,7 @@ static ZBX_PACKAGE_MANAGER	package_managers[] =
+ 	{"pkgtools",	"[ -d /var/log/packages ] && echo true",	"ls /var/log/packages",		NULL},
+ 	{"rpm",		"rpm --version 2> /dev/null",			"rpm -qa",			NULL},
+ 	{"pacman",	"pacman --version 2> /dev/null",		"pacman -Q",			NULL},
++	{"portage",     "emerge --version 2> /dev/null",                "qlist -IRCv",                  NULL},
+ 	{NULL}
+ };
+ 

diff --git a/net-analyzer/zabbix/files/zabbix-5.4.12-system.sw.packages.patch b/net-analyzer/zabbix/files/zabbix-5.4.12-system.sw.packages.patch
new file mode 100644
index 000000000000..54a5299ee791
--- /dev/null
+++ b/net-analyzer/zabbix/files/zabbix-5.4.12-system.sw.packages.patch
@@ -0,0 +1,35 @@
+From ee5ed14f0f858eb0f776f5b8c4c1a1e740787bfa Mon Sep 17 00:00:00 2001
+From: Alexey Shvetsov <alexxy@gentoo.org>
+Date: Mon, 21 Mar 2022 11:23:54 +0300
+Subject: [PATCH] Allow to use system.sw.packages on gentoo linux
+
+Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org>
+---
+ src/go/plugins/system/sw/sw.go       | 1 +
+ src/libs/zbxsysinfo/linux/software.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/go/plugins/system/sw/sw.go b/src/go/plugins/system/sw/sw.go
+index 6ff354fd711..db9a4b763f7 100644
+--- a/src/go/plugins/system/sw/sw.go
++++ b/src/go/plugins/system/sw/sw.go
+@@ -163,6 +163,7 @@ func getManagers() []manager {
+ 		{"pkgtools", "[ -d /var/log/packages ] && echo true", "ls /var/log/packages", parseRegex},
+ 		{"rpm", "rpm --version 2> /dev/null", "rpm -qa", parseRegex},
+ 		{"pacman", "pacman --version 2> /dev/null", "pacman -Q", parseRegex},
++		{"portage", "emerge --version 2> /dev/null", "qlist -IRCv", parseRegex},
+ 	}
+ }
+ 
+diff --git a/src/libs/zbxsysinfo/linux/software.c b/src/libs/zbxsysinfo/linux/software.c
+index 24f8e93eed8..8dcf01a3e47 100644
+--- a/src/libs/zbxsysinfo/linux/software.c
++++ b/src/libs/zbxsysinfo/linux/software.c
+@@ -176,6 +176,7 @@ static ZBX_PACKAGE_MANAGER	package_managers[] =
+ 	{"pkgtools",	"[ -d /var/log/packages ] && echo true",	"ls /var/log/packages",		NULL},
+ 	{"rpm",		"rpm --version 2> /dev/null",			"rpm -qa",			NULL},
+ 	{"pacman",	"pacman --version 2> /dev/null",		"pacman -Q",			NULL},
++	{"portage",     "emerge --version 2> /dev/null",                "qlist -IRCv",                  NULL},
+ 	{NULL}
+ };
+ 

diff --git a/net-analyzer/zabbix/files/zabbix-6.0.3-system.sw.packages.patch b/net-analyzer/zabbix/files/zabbix-6.0.3-system.sw.packages.patch
new file mode 100644
index 000000000000..2649e118151e
--- /dev/null
+++ b/net-analyzer/zabbix/files/zabbix-6.0.3-system.sw.packages.patch
@@ -0,0 +1,35 @@
+From 1869f67549ea9491377269ef11a99ed5fc38e3cc Mon Sep 17 00:00:00 2001
+From: Alexey Shvetsov <alexxy@gentoo.org>
+Date: Mon, 21 Mar 2022 11:23:54 +0300
+Subject: [PATCH] Allow to use system.sw.packages on gentoo linux
+
+Signed-off-by: Alexey Shvetsov <alexxy@gentoo.org>
+---
+ src/go/plugins/system/sw/sw.go       | 1 +
+ src/libs/zbxsysinfo/linux/software.c | 1 +
+ 2 files changed, 2 insertions(+)
+
+diff --git a/src/go/plugins/system/sw/sw.go b/src/go/plugins/system/sw/sw.go
+index 0abaf05fb3b..1d8a94b5924 100644
+--- a/src/go/plugins/system/sw/sw.go
++++ b/src/go/plugins/system/sw/sw.go
+@@ -165,6 +165,7 @@ func getManagers() []manager {
+ 		{"pkgtools", "[ -d /var/log/packages ] && echo true", "ls /var/log/packages", parseRegex},
+ 		{"rpm", "rpm --version 2> /dev/null", "rpm -qa", parseRegex},
+ 		{"pacman", "pacman --version 2> /dev/null", "pacman -Q", parseRegex},
++		{"portage", "emerge --version 2> /dev/null", "qlist -IRCv", parseRegex},
+ 	}
+ }
+ 
+diff --git a/src/libs/zbxsysinfo/linux/software.c b/src/libs/zbxsysinfo/linux/software.c
+index 749deaa9258..3a6ee97ec4c 100644
+--- a/src/libs/zbxsysinfo/linux/software.c
++++ b/src/libs/zbxsysinfo/linux/software.c
+@@ -177,6 +177,7 @@ static ZBX_PACKAGE_MANAGER	package_managers[] =
+ 	{"pkgtools",	"[ -d /var/log/packages ] && echo true",	"ls /var/log/packages",		NULL},
+ 	{"rpm",		"rpm --version 2> /dev/null",			"rpm -qa",			NULL},
+ 	{"pacman",	"pacman --version 2> /dev/null",		"pacman -Q",			NULL},
++	{"portage",     "emerge --version 2> /dev/null",                "qlist -IRCv",                  NULL},
+ 	{NULL}
+ };
+ 

diff --git a/net-analyzer/zabbix/zabbix-5.0.22.ebuild b/net-analyzer/zabbix/zabbix-5.0.22.ebuild
new file mode 100644
index 000000000000..f9b28fd08a09
--- /dev/null
+++ b/net-analyzer/zabbix/zabbix-5.0.22.ebuild
@@ -0,0 +1,388 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+GO_OPTIONAL="yes"
+# needed to make webapp-config dep optional
+WEBAPP_OPTIONAL="yes"
+inherit webapp java-pkg-opt-2 systemd tmpfiles toolchain-funcs go-module user-info
+
+DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
+HOMEPAGE="https://www.zabbix.com/"
+MY_P=${P/_/}
+MY_PV=${PV/_/}
+SRC_URI="https://cdn.zabbix.com/${PN}/sources/stable/$(ver_cut 1-2)/${P}.tar.gz
+	agent2? ( https://dev.gentoo.org/~fordfrog/distfiles/${P}-go-deps.tar.xz )
+"
+
+LICENSE="GPL-2"
+SLOT="0/$(ver_cut 1-2)"
+WEBAPP_MANUAL_SLOT="yes"
+KEYWORDS="~amd64 ~x86"
+IUSE="+agent +agent2 curl frontend gnutls ipv6 java ldap libxml2 mysql odbc openipmi +openssl oracle +postgres proxy server snmp sqlite ssh static"
+REQUIRED_USE="|| ( agent agent2 frontend proxy server )
+	?? ( gnutls openssl )
+	proxy? ( ^^ ( mysql oracle postgres sqlite ) )
+	server? ( ^^ ( mysql oracle postgres ) !sqlite )
+	static? ( !oracle !snmp )"
+
+COMMON_DEPEND="
+	curl? ( net-misc/curl )
+	gnutls? ( net-libs/gnutls:0= )
+	java? ( >=virtual/jdk-1.8:* )
+	ldap? (
+		=dev-libs/cyrus-sasl-2*
+		net-libs/gnutls:=
+		net-nds/openldap:=
+	)
+	libxml2? ( dev-libs/libxml2 )
+	mysql? ( dev-db/mysql-connector-c:= )
+	odbc? ( dev-db/unixODBC )
+	openipmi? ( sys-libs/openipmi )
+	openssl? ( dev-libs/openssl:=[-bindist(-)] )
+	oracle? ( dev-db/oracle-instantclient[odbc,sdk] )
+	postgres? ( dev-db/postgresql:* )
+	proxy?  ( sys-libs/zlib )
+	server? (
+		dev-libs/libevent:=
+		sys-libs/zlib
+	)
+	snmp? ( net-analyzer/net-snmp:= )
+	sqlite? ( dev-db/sqlite )
+	ssh? ( net-libs/libssh2 )
+"
+
+RDEPEND="${COMMON_DEPEND}
+	acct-group/zabbix
+	acct-user/zabbix
+	java? ( >=virtual/jre-1.8:* )
+	mysql? ( virtual/mysql )
+	proxy? ( net-analyzer/fping[suid] )
+	server? (
+		app-admin/webapp-config
+		dev-libs/libevent
+		dev-libs/libpcre
+		net-analyzer/fping[suid]
+	)
+	frontend? (
+		app-admin/webapp-config
+		dev-lang/php:*[bcmath,ctype,sockets,gd,truetype,xml,session,xmlreader,xmlwriter,nls,sysvipc,unicode]
+		media-libs/gd[png]
+		virtual/httpd-php:*
+		mysql? ( dev-lang/php[mysqli] )
+		odbc? ( dev-lang/php[odbc] )
+		oracle? ( dev-lang/php[oci8-instant-client] )
+		postgres? ( dev-lang/php[postgres] )
+		sqlite? ( dev-lang/php[sqlite] )
+	)
+"
+DEPEND="${COMMON_DEPEND}
+	static? (
+		curl? ( net-misc/curl[static-libs] )
+		ldap? (
+			=dev-libs/cyrus-sasl-2*[static-libs]
+			net-libs/gnutls[static-libs]
+			net-nds/openldap[static-libs]
+		)
+		libxml2? ( dev-libs/libxml2[static-libs] )
+		mysql? ( dev-db/mysql-connector-c[static-libs] )
+		odbc? ( dev-db/unixODBC[static-libs] )
+		postgres? ( dev-db/postgresql:*[static-libs] )
+		sqlite? ( dev-db/sqlite[static-libs] )
+		ssh? ( net-libs/libssh2 )
+	)
+"
+BDEPEND="
+	virtual/pkgconfig
+	agent2? (
+		>=dev-lang/go-1.12
+		app-arch/unzip
+	)
+"
+
+# upstream tests fail for agent2
+RESTRICT="test"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
+	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
+	"${FILESDIR}/${PN}-5.0.22-system.sw.packages.patch"
+)
+
+S=${WORKDIR}/${MY_P}
+
+ZABBIXJAVA_BASE="opt/zabbix_java"
+
+pkg_setup() {
+	if use oracle; then
+		if [ -z "${ORACLE_HOME}" ]; then
+			eerror
+			eerror "The environment variable ORACLE_HOME must be set"
+			eerror "and point to the correct location."
+			eerror "It looks like you don't have Oracle installed."
+			eerror
+			die "Environment variable ORACLE_HOME is not set"
+		fi
+	fi
+
+	if use frontend; then
+		webapp_pkg_setup
+	fi
+
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+}
+
+src_configure() {
+	econf \
+		$(use_enable agent) \
+		$(use_enable agent2) \
+		$(use_enable ipv6) \
+		$(use_enable java) \
+		$(use_enable proxy) \
+		$(use_enable server) \
+		$(use_enable static) \
+		$(use_with curl libcurl) \
+		$(use_with gnutls) \
+		$(use_with ldap) \
+		$(use_with libxml2) \
+		$(use_with mysql) \
+		$(use_with odbc unixodbc) \
+		$(use_with openipmi openipmi) \
+		$(use_with openssl) \
+		$(use_with oracle) \
+		$(use_with postgres postgresql) \
+		$(use_with snmp net-snmp) \
+		$(use_with sqlite sqlite3) \
+		$(use_with ssh ssh2)
+}
+
+src_compile() {
+	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
+		emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
+	fi
+}
+
+src_install() {
+	local dirs=(
+		/etc/zabbix
+		/var/lib/zabbix
+		/var/lib/zabbix/home
+		/var/lib/zabbix/scripts
+		/var/lib/zabbix/alertscripts
+		/var/lib/zabbix/externalscripts
+		/var/log/zabbix
+	)
+
+	for dir in "${dirs[@]}"; do
+		dodir "${dir}"
+		keepdir "${dir}"
+	done
+
+	if use server; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_server.conf
+		fperms 0640 /etc/zabbix/zabbix_server.conf
+		fowners root:zabbix /etc/zabbix/zabbix_server.conf
+
+		newinitd "${FILESDIR}"/zabbix-server-r1.init zabbix-server
+
+		dosbin src/zabbix_server/zabbix_server
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-server.service
+		newtmpfiles "${FILESDIR}"/zabbix-server.tmpfiles zabbix-server.conf
+	fi
+
+	if use proxy; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_proxy.conf
+		fperms 0640 /etc/zabbix/zabbix_proxy.conf
+		fowners root:zabbix /etc/zabbix/zabbix_proxy.conf
+
+		newinitd "${FILESDIR}"/zabbix-proxy.init zabbix-proxy
+
+		dosbin src/zabbix_proxy/zabbix_proxy
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-proxy.service
+		newtmpfiles "${FILESDIR}"/zabbix-proxy.tmpfiles zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_agentd.conf
+		fperms 0640 /etc/zabbix/zabbix_agentd.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agentd.conf
+
+		newinitd "${FILESDIR}"/zabbix-agentd.init zabbix-agentd
+
+		dosbin src/zabbix_agent/zabbix_agentd
+		dobin \
+			src/zabbix_sender/zabbix_sender \
+			src/zabbix_get/zabbix_get
+
+		systemd_dounit "${FILESDIR}"/zabbix-agentd.service
+		newtmpfiles "${FILESDIR}"/zabbix-agentd.tmpfiles zabbix-agentd.conf
+	fi
+
+	if use agent2; then
+		insinto /etc/zabbix
+		doins "${S}"/src/go/conf/zabbix_agent2.conf
+		fperms 0640 /etc/zabbix/zabbix_agent2.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agent2.conf
+
+		newinitd "${FILESDIR}"/zabbix-agent2.init zabbix-agent2
+
+		dosbin src/go/bin/zabbix_agent2
+
+		systemd_dounit "${FILESDIR}"/zabbix-agent2.service
+		newtmpfiles "${FILESDIR}"/zabbix-agent2.tmpfiles zabbix-agent2.conf
+	fi
+
+	fowners root:zabbix /etc/zabbix
+	fowners zabbix:zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+	fperms 0750 \
+		/etc/zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+
+	dodoc README INSTALL NEWS ChangeLog \
+		conf/zabbix_agentd.conf \
+		conf/zabbix_proxy.conf \
+		conf/zabbix_agentd/userparameter_examples.conf \
+		conf/zabbix_agentd/userparameter_mysql.conf \
+		conf/zabbix_server.conf
+
+	if use frontend; then
+		webapp_src_preinst
+		cp -R ui/* "${D}/${MY_HTDOCSDIR}"
+		webapp_configfile \
+			"${MY_HTDOCSDIR}"/include/db.inc.php \
+			"${MY_HTDOCSDIR}"/include/config.inc.php
+		webapp_src_install
+	fi
+
+	if use java; then
+		dodir \
+			/${ZABBIXJAVA_BASE} \
+			/${ZABBIXJAVA_BASE}/bin \
+			/${ZABBIXJAVA_BASE}/lib
+		keepdir /${ZABBIXJAVA_BASE}
+		exeinto /${ZABBIXJAVA_BASE}/bin
+		doexe src/zabbix_java/bin/zabbix-java-gateway-${MY_PV}.jar
+		exeinto /${ZABBIXJAVA_BASE}/lib
+		doexe \
+			src/zabbix_java/lib/logback-classic-1.2.9.jar \
+			src/zabbix_java/lib/logback-console.xml \
+			src/zabbix_java/lib/logback-core-1.2.9.jar \
+			src/zabbix_java/lib/logback.xml \
+			src/zabbix_java/lib/android-json-4.3_r3.1.jar \
+			src/zabbix_java/lib/slf4j-api-1.7.32.jar
+		newinitd "${FILESDIR}"/zabbix-jmx-proxy.init zabbix-jmx-proxy
+		newconfd "${FILESDIR}"/zabbix-jmx-proxy.conf zabbix-jmx-proxy
+	fi
+}
+
+pkg_postinst() {
+	if use server || use proxy ; then
+		elog
+		elog "You may need to configure your database for Zabbix"
+		elog "if you have not already done so."
+		elog
+
+		zabbix_homedir=$(egethome zabbix)
+		if [ -n "${zabbix_homedir}" ] && \
+		   [ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
+			ewarn
+			ewarn "The user 'zabbix' should have his homedir changed"
+			ewarn "to /var/lib/zabbix/home if you want to use"
+			ewarn "custom alert scripts."
+			ewarn
+			ewarn "A real homedir might be needed for configfiles"
+			ewarn "for custom alert scripts."
+			ewarn
+			ewarn "To change the homedir use:"
+			ewarn "  usermod -d /var/lib/zabbix/home zabbix"
+			ewarn
+		fi
+	fi
+
+	if use server; then
+		tmpfiles_process zabbix-server.conf
+
+		elog
+		elog "For distributed monitoring you have to run:"
+		elog
+		elog "zabbix_server -n <nodeid>"
+		elog
+		elog "This will convert database data for use with Node ID"
+		elog "and also adds a local node."
+		elog
+	fi
+
+	if use proxy; then
+		tmpfiles_process zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		tmpfiles_process zabbix-agentd.conf
+	fi
+
+	if use agent2; then
+		tmpfiles_process zabbix-agent2.conf
+	fi
+
+	elog "--"
+	elog
+	elog "You may need to add these lines to /etc/services:"
+	elog
+	elog "zabbix-agent     10050/tcp Zabbix Agent"
+	elog "zabbix-agent     10050/udp Zabbix Agent"
+	elog "zabbix-trapper   10051/tcp Zabbix Trapper"
+	elog "zabbix-trapper   10051/udp Zabbix Trapper"
+	elog
+
+	if use server || use proxy ; then
+		# check for fping
+		fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
+		case "${fping_perms}" in
+			4[157][157][157])
+				;;
+			*)
+				ewarn
+				ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
+				ewarn "you have to make /usr/sbin/fping setuid root and executable"
+				ewarn "by everyone. Run the following command to fix it:"
+				ewarn
+				ewarn "  chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
+				ewarn
+				ewarn "Please be aware that this might impose a security risk,"
+				ewarn "depending on the code quality of fping."
+				ewarn
+				;;
+		esac
+	fi
+}
+
+pkg_prerm() {
+	(use frontend || use server) && webapp_pkg_prerm
+}

diff --git a/net-analyzer/zabbix/zabbix-5.4.12.ebuild b/net-analyzer/zabbix/zabbix-5.4.12.ebuild
new file mode 100644
index 000000000000..9596c2fd9618
--- /dev/null
+++ b/net-analyzer/zabbix/zabbix-5.4.12.ebuild
@@ -0,0 +1,387 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+GO_OPTIONAL="yes"
+# needed to make webapp-config dep optional
+WEBAPP_OPTIONAL="yes"
+inherit webapp java-pkg-opt-2 systemd tmpfiles toolchain-funcs go-module user-info
+
+DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
+HOMEPAGE="https://www.zabbix.com/"
+MY_P=${P/_/}
+MY_PV=${PV/_/}
+SRC_URI="https://cdn.zabbix.com/${PN}/sources/stable/$(ver_cut 1-2)/${P}.tar.gz
+	agent2? ( https://dev.gentoo.org/~fordfrog/distfiles/${P}-go-deps.tar.xz )
+"
+
+LICENSE="GPL-2"
+SLOT="0/$(ver_cut 1-2)"
+WEBAPP_MANUAL_SLOT="yes"
+KEYWORDS="~amd64 ~x86"
+IUSE="+agent +agent2 curl frontend gnutls ipv6 java ldap libxml2 mysql odbc openipmi +openssl oracle +postgres proxy server snmp sqlite ssh static"
+REQUIRED_USE="|| ( agent agent2 frontend proxy server )
+	?? ( gnutls openssl )
+	proxy? ( ^^ ( mysql oracle postgres sqlite ) )
+	server? ( ^^ ( mysql oracle postgres ) !sqlite )
+	static? ( !oracle !snmp )"
+
+COMMON_DEPEND="
+	curl? ( net-misc/curl )
+	gnutls? ( net-libs/gnutls:0= )
+	java? ( >=virtual/jdk-1.8:* )
+	ldap? (
+		=dev-libs/cyrus-sasl-2*
+		net-libs/gnutls:=
+		net-nds/openldap:=
+	)
+	libxml2? ( dev-libs/libxml2 )
+	mysql? ( dev-db/mysql-connector-c:= )
+	odbc? ( dev-db/unixODBC )
+	openipmi? ( sys-libs/openipmi )
+	openssl? ( dev-libs/openssl:=[-bindist(-)] )
+	oracle? ( dev-db/oracle-instantclient[odbc,sdk] )
+	postgres? ( dev-db/postgresql:* )
+	proxy?  ( sys-libs/zlib )
+	server? (
+		dev-libs/libevent:=
+		sys-libs/zlib
+	)
+	snmp? ( net-analyzer/net-snmp:= )
+	sqlite? ( dev-db/sqlite )
+	ssh? ( net-libs/libssh2 )
+"
+
+RDEPEND="${COMMON_DEPEND}
+	acct-group/zabbix
+	acct-user/zabbix
+	java? ( >=virtual/jre-1.8:* )
+	mysql? ( virtual/mysql )
+	proxy? ( net-analyzer/fping[suid] )
+	server? (
+		app-admin/webapp-config
+		dev-libs/libevent
+		dev-libs/libpcre
+		net-analyzer/fping[suid]
+	)
+	frontend? (
+		app-admin/webapp-config
+		dev-lang/php:*[bcmath,ctype,sockets,gd,truetype,xml,session,xmlreader,xmlwriter,nls,sysvipc,unicode]
+		media-libs/gd[png]
+		virtual/httpd-php:*
+		mysql? ( dev-lang/php[mysqli] )
+		odbc? ( dev-lang/php[odbc] )
+		oracle? ( dev-lang/php[oci8-instant-client] )
+		postgres? ( dev-lang/php[postgres] )
+		sqlite? ( dev-lang/php[sqlite] )
+	)
+"
+DEPEND="${COMMON_DEPEND}
+	static? (
+		curl? ( net-misc/curl[static-libs] )
+		ldap? (
+			=dev-libs/cyrus-sasl-2*[static-libs]
+			net-libs/gnutls[static-libs]
+			net-nds/openldap[static-libs]
+		)
+		libxml2? ( dev-libs/libxml2[static-libs] )
+		mysql? ( dev-db/mysql-connector-c[static-libs] )
+		odbc? ( dev-db/unixODBC[static-libs] )
+		postgres? ( dev-db/postgresql:*[static-libs] )
+		sqlite? ( dev-db/sqlite[static-libs] )
+		ssh? ( net-libs/libssh2 )
+	)
+"
+BDEPEND="
+	virtual/pkgconfig
+	agent2? (
+		>=dev-lang/go-1.12
+		app-arch/unzip
+	)
+"
+
+# upstream tests fail for agent2
+RESTRICT="test"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
+	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
+	"${FILESDIR}/${PN}-5.4.12-system.sw.packages.patch"
+)
+
+S=${WORKDIR}/${MY_P}
+
+ZABBIXJAVA_BASE="opt/zabbix_java"
+
+pkg_setup() {
+	if use oracle; then
+		if [ -z "${ORACLE_HOME}" ]; then
+			eerror
+			eerror "The environment variable ORACLE_HOME must be set"
+			eerror "and point to the correct location."
+			eerror "It looks like you don't have Oracle installed."
+			eerror
+			die "Environment variable ORACLE_HOME is not set"
+		fi
+	fi
+
+	if use frontend; then
+		webapp_pkg_setup
+	fi
+
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+}
+
+src_configure() {
+	econf \
+		"$(use_enable agent)" \
+		"$(use_enable agent2)" \
+		"$(use_enable ipv6)" \
+		"$(use_enable java)" \
+		"$(use_enable proxy)" \
+		"$(use_enable server)" \
+		"$(use_enable static)" \
+		"$(use_with curl libcurl)" \
+		"$(use_with gnutls)" \
+		"$(use_with ldap)" \
+		"$(use_with libxml2)" \
+		"$(use_with mysql)" \
+		"$(use_with odbc unixodbc)" \
+		"$(use_with openipmi openipmi)" \
+		"$(use_with openssl)" \
+		"$(use_with oracle)" \
+		"$(use_with postgres postgresql)" \
+		"$(use_with snmp net-snmp)" \
+		"$(use_with sqlite sqlite3)" \
+		"$(use_with ssh ssh2)"
+}
+
+src_compile() {
+	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
+		emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
+	fi
+}
+
+src_install() {
+	local dirs=(
+		/etc/zabbix
+		/var/lib/zabbix
+		/var/lib/zabbix/home
+		/var/lib/zabbix/scripts
+		/var/lib/zabbix/alertscripts
+		/var/lib/zabbix/externalscripts
+		/var/log/zabbix
+	)
+
+	for dir in "${dirs[@]}"; do
+		dodir "${dir}"
+		keepdir "${dir}"
+	done
+
+	if use server; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_server.conf
+		fperms 0640 /etc/zabbix/zabbix_server.conf
+		fowners root:zabbix /etc/zabbix/zabbix_server.conf
+
+		newinitd "${FILESDIR}"/zabbix-server-r1.init zabbix-server
+
+		dosbin src/zabbix_server/zabbix_server
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-server.service
+		newtmpfiles "${FILESDIR}"/zabbix-server.tmpfiles zabbix-server.conf
+	fi
+
+	if use proxy; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_proxy.conf
+		fperms 0640 /etc/zabbix/zabbix_proxy.conf
+		fowners root:zabbix /etc/zabbix/zabbix_proxy.conf
+
+		newinitd "${FILESDIR}"/zabbix-proxy.init zabbix-proxy
+
+		dosbin src/zabbix_proxy/zabbix_proxy
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-proxy.service
+		newtmpfiles "${FILESDIR}"/zabbix-proxy.tmpfiles zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_agentd.conf
+		fperms 0640 /etc/zabbix/zabbix_agentd.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agentd.conf
+
+		newinitd "${FILESDIR}"/zabbix-agentd.init zabbix-agentd
+
+		dosbin src/zabbix_agent/zabbix_agentd
+		dobin \
+			src/zabbix_sender/zabbix_sender \
+			src/zabbix_get/zabbix_get
+
+		systemd_dounit "${FILESDIR}"/zabbix-agentd.service
+		newtmpfiles "${FILESDIR}"/zabbix-agentd.tmpfiles zabbix-agentd.conf
+	fi
+	if use agent2; then
+		insinto /etc/zabbix
+		doins "${S}"/src/go/conf/zabbix_agent2.conf
+		fperms 0640 /etc/zabbix/zabbix_agent2.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agent2.conf
+
+		newinitd "${FILESDIR}"/zabbix-agent2.init zabbix-agent2
+
+		dosbin src/go/bin/zabbix_agent2
+
+		systemd_dounit "${FILESDIR}"/zabbix-agent2.service
+		newtmpfiles "${FILESDIR}"/zabbix-agent2.tmpfiles zabbix-agent2.conf
+	fi
+
+	fowners root:zabbix /etc/zabbix
+	fowners zabbix:zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+	fperms 0750 \
+		/etc/zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+
+	dodoc README INSTALL NEWS ChangeLog \
+		conf/zabbix_agentd.conf \
+		conf/zabbix_proxy.conf \
+		conf/zabbix_agentd/userparameter_examples.conf \
+		conf/zabbix_agentd/userparameter_mysql.conf \
+		conf/zabbix_server.conf
+
+	if use frontend; then
+		webapp_src_preinst
+		cp -R ui/* "${D}/${MY_HTDOCSDIR}"
+		webapp_configfile \
+			"${MY_HTDOCSDIR}"/include/db.inc.php \
+			"${MY_HTDOCSDIR}"/include/config.inc.php
+		webapp_src_install
+	fi
+
+	if use java; then
+		dodir \
+			/${ZABBIXJAVA_BASE} \
+			/${ZABBIXJAVA_BASE}/bin \
+			/${ZABBIXJAVA_BASE}/lib
+		keepdir /${ZABBIXJAVA_BASE}
+		exeinto /${ZABBIXJAVA_BASE}/bin
+		doexe src/zabbix_java/bin/zabbix-java-gateway-"${MY_PV}".jar
+		exeinto /${ZABBIXJAVA_BASE}/lib
+		doexe \
+			src/zabbix_java/lib/logback-classic-1.2.9.jar \
+			src/zabbix_java/lib/logback-console.xml \
+			src/zabbix_java/lib/logback-core-1.2.9.jar \
+			src/zabbix_java/lib/logback.xml \
+			src/zabbix_java/lib/android-json-4.3_r3.1.jar \
+			src/zabbix_java/lib/slf4j-api-1.7.32.jar
+		newinitd "${FILESDIR}"/zabbix-jmx-proxy.init zabbix-jmx-proxy
+		newconfd "${FILESDIR}"/zabbix-jmx-proxy.conf zabbix-jmx-proxy
+	fi
+}
+
+pkg_postinst() {
+	if use server || use proxy ; then
+		elog
+		elog "You may need to configure your database for Zabbix"
+		elog "if you have not already done so."
+		elog
+
+		zabbix_homedir=$(egethome zabbix)
+		if [ -n "${zabbix_homedir}" ] && \
+			[ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
+			ewarn
+			ewarn "The user 'zabbix' should have his homedir changed"
+			ewarn "to /var/lib/zabbix/home if you want to use"
+			ewarn "custom alert scripts."
+			ewarn
+			ewarn "A real homedir might be needed for configfiles"
+			ewarn "for custom alert scripts."
+			ewarn
+			ewarn "To change the homedir use:"
+			ewarn "  usermod -d /var/lib/zabbix/home zabbix"
+			ewarn
+		fi
+	fi
+
+	if use server; then
+		tmpfiles_process zabbix-server.conf
+
+		elog
+		elog "For distributed monitoring you have to run:"
+		elog
+		elog "zabbix_server -n <nodeid>"
+		elog
+		elog "This will convert database data for use with Node ID"
+		elog "and also adds a local node."
+		elog
+	fi
+
+	if use proxy; then
+		tmpfiles_process zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		tmpfiles_process zabbix-agentd.conf
+	fi
+
+	if use agent2; then
+		tmpfiles_process zabbix-agent2.conf
+	fi
+
+	elog "--"
+	elog
+	elog "You may need to add these lines to /etc/services:"
+	elog
+	elog "zabbix-agent     10050/tcp Zabbix Agent"
+	elog "zabbix-agent     10050/udp Zabbix Agent"
+	elog "zabbix-trapper   10051/tcp Zabbix Trapper"
+	elog "zabbix-trapper   10051/udp Zabbix Trapper"
+	elog
+
+	if use server || use proxy ; then
+		# check for fping
+		fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
+		case "${fping_perms}" in
+			4[157][157][157])
+				;;
+			*)
+				ewarn
+				ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
+				ewarn "you have to make /usr/sbin/fping setuid root and executable"
+				ewarn "by everyone. Run the following command to fix it:"
+				ewarn
+				ewarn "  chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
+				ewarn
+				ewarn "Please be aware that this might impose a security risk,"
+				ewarn "depending on the code quality of fping."
+				ewarn
+				;;
+		esac
+	fi
+}
+
+pkg_prerm() {
+	(use frontend || use server) && webapp_pkg_prerm
+}

diff --git a/net-analyzer/zabbix/zabbix-6.0.3.ebuild b/net-analyzer/zabbix/zabbix-6.0.3.ebuild
new file mode 100644
index 000000000000..39e9e4e7959c
--- /dev/null
+++ b/net-analyzer/zabbix/zabbix-6.0.3.ebuild
@@ -0,0 +1,404 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+GO_OPTIONAL="yes"
+# needed to make webapp-config dep optional
+WEBAPP_OPTIONAL="yes"
+inherit webapp java-pkg-opt-2 systemd tmpfiles toolchain-funcs go-module user-info
+
+DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
+HOMEPAGE="https://www.zabbix.com/"
+MY_P=${P/_/}
+MY_PV=${PV/_/}
+SRC_URI="https://cdn.zabbix.com/${PN}/sources/stable/$(ver_cut 1-2)/${P}.tar.gz
+	agent2? ( https://dev.gentoo.org/~fordfrog/distfiles/${P}-go-deps.tar.xz )
+"
+
+LICENSE="GPL-2"
+SLOT="0/$(ver_cut 1-2)"
+WEBAPP_MANUAL_SLOT="yes"
+KEYWORDS="~amd64 ~x86"
+IUSE="agent +agent2 curl frontend gnutls ipv6 java ldap libxml2 mysql odbc openipmi +openssl oracle +pcre2 +postgres proxy server snmp sqlite ssh static"
+REQUIRED_USE="|| ( agent agent2 frontend proxy server )
+	?? ( gnutls openssl )
+	proxy? ( ^^ ( mysql oracle postgres sqlite ) )
+	server? ( ^^ ( mysql oracle postgres ) !sqlite )
+	static? ( !oracle !snmp )"
+
+COMMON_DEPEND="
+	curl? ( net-misc/curl )
+	gnutls? ( net-libs/gnutls:0= )
+	java? ( >=virtual/jdk-1.8:* )
+	ldap? (
+		=dev-libs/cyrus-sasl-2*
+		net-libs/gnutls:=
+		net-nds/openldap:=
+	)
+	libxml2? ( dev-libs/libxml2 )
+	mysql? ( dev-db/mysql-connector-c:= )
+	odbc? ( dev-db/unixODBC )
+	openipmi? ( sys-libs/openipmi )
+	openssl? ( dev-libs/openssl:=[-bindist(-)] )
+	oracle? ( dev-db/oracle-instantclient[odbc,sdk] )
+	postgres? ( dev-db/postgresql:* )
+	proxy?  ( sys-libs/zlib )
+	server? (
+		dev-libs/libevent:=
+		sys-libs/zlib
+	)
+	snmp? ( net-analyzer/net-snmp:= )
+	sqlite? ( dev-db/sqlite )
+	ssh? ( net-libs/libssh2 )
+"
+
+RDEPEND="${COMMON_DEPEND}
+	acct-group/zabbix
+	acct-user/zabbix
+	java? ( >=virtual/jre-1.8:* )
+	mysql? ( virtual/mysql )
+	proxy? ( net-analyzer/fping[suid] )
+	server? (
+		app-admin/webapp-config
+		dev-libs/libevent
+		!pcre2? ( dev-libs/libpcre )
+		pcre2? ( dev-libs/libpcre2:= )
+		net-analyzer/fping[suid]
+	)
+	frontend? (
+		app-admin/webapp-config
+		dev-lang/php:*[bcmath,ctype,sockets,gd,truetype,xml,session,xmlreader,xmlwriter,nls,sysvipc,unicode]
+		media-libs/gd[png]
+		virtual/httpd-php:*
+		mysql? ( dev-lang/php[mysqli] )
+		odbc? ( dev-lang/php[odbc] )
+		oracle? ( dev-lang/php[oci8-instant-client] )
+		postgres? ( dev-lang/php[postgres] )
+		sqlite? ( dev-lang/php[sqlite] )
+	)
+"
+DEPEND="${COMMON_DEPEND}
+	static? (
+		curl? ( net-misc/curl[static-libs] )
+		ldap? (
+			=dev-libs/cyrus-sasl-2*[static-libs]
+			net-libs/gnutls[static-libs]
+			net-nds/openldap[static-libs]
+		)
+		libxml2? ( dev-libs/libxml2[static-libs] )
+		mysql? ( dev-db/mysql-connector-c[static-libs] )
+		odbc? ( dev-db/unixODBC[static-libs] )
+		postgres? ( dev-db/postgresql:*[static-libs] )
+		sqlite? ( dev-db/sqlite[static-libs] )
+		ssh? ( net-libs/libssh2 )
+	)
+"
+BDEPEND="
+	virtual/pkgconfig
+	agent2? (
+		>=dev-lang/go-1.12
+		app-arch/unzip
+	)
+"
+
+# upstream tests fail for agent2
+RESTRICT="test"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
+	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
+	"${FILESDIR}/${PN}-6.0.3-system.sw.packages.patch"
+)
+
+S=${WORKDIR}/${MY_P}
+
+ZABBIXJAVA_BASE="opt/zabbix_java"
+
+pkg_setup() {
+	if use oracle; then
+		if [ -z "${ORACLE_HOME}" ]; then
+			eerror
+			eerror "The environment variable ORACLE_HOME must be set"
+			eerror "and point to the correct location."
+			eerror "It looks like you don't have Oracle installed."
+			eerror
+			die "Environment variable ORACLE_HOME is not set"
+		fi
+	fi
+
+	if use frontend; then
+		webapp_pkg_setup
+	fi
+
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+}
+
+src_configure() {
+	local econf_args=(
+		"$(use_enable agent)"
+		"$(use_enable agent2)"
+		"$(use_enable ipv6)"
+		"$(use_enable java)"
+		"$(use_enable proxy)"
+		"$(use_enable server)"
+		"$(use_enable static)"
+		"$(use_with curl libcurl)"
+		"$(use_with gnutls)"
+		"$(use_with ldap)"
+		"$(use_with libxml2)"
+		"$(use_with mysql)"
+		"$(use_with odbc unixodbc)"
+		"$(use_with openipmi openipmi)"
+		"$(use_with openssl)"
+		"$(use_with oracle)"
+		"$(use_with postgres postgresql)"
+		"$(use_with snmp net-snmp)"
+		"$(use_with sqlite sqlite3)"
+		"$(use_with ssh ssh2)"
+	)
+
+	if use pcre2; then
+		econf_args+=( --with-libpcre2 )
+	else
+		# If pcre2 is not enabled, then use the old pcre library.
+		econf_args+=( --with-libpcre )
+	fi
+
+	econf ${econf_args[@]}
+}
+
+src_compile() {
+	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
+		emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
+	fi
+}
+
+src_install() {
+	local dirs=(
+		/etc/zabbix
+		/var/lib/zabbix
+		/var/lib/zabbix/home
+		/var/lib/zabbix/scripts
+		/var/lib/zabbix/alertscripts
+		/var/lib/zabbix/externalscripts
+		/var/log/zabbix
+	)
+
+	for dir in "${dirs[@]}"; do
+		dodir "${dir}"
+		keepdir "${dir}"
+	done
+
+	if use server; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_server.conf
+		fperms 0640 /etc/zabbix/zabbix_server.conf
+		fowners root:zabbix /etc/zabbix/zabbix_server.conf
+
+		newinitd "${FILESDIR}"/zabbix-server-r1.init zabbix-server
+
+		dosbin src/zabbix_server/zabbix_server
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-server.service
+		newtmpfiles "${FILESDIR}"/zabbix-server.tmpfiles zabbix-server.conf
+	fi
+
+	if use proxy; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_proxy.conf
+		fperms 0640 /etc/zabbix/zabbix_proxy.conf
+		fowners root:zabbix /etc/zabbix/zabbix_proxy.conf
+
+		newinitd "${FILESDIR}"/zabbix-proxy.init zabbix-proxy
+
+		dosbin src/zabbix_proxy/zabbix_proxy
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-proxy.service
+		newtmpfiles "${FILESDIR}"/zabbix-proxy.tmpfiles zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_agentd.conf
+		fperms 0640 /etc/zabbix/zabbix_agentd.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agentd.conf
+
+		newinitd "${FILESDIR}"/zabbix-agentd.init zabbix-agentd
+
+		dosbin src/zabbix_agent/zabbix_agentd
+		dobin \
+			src/zabbix_sender/zabbix_sender \
+			src/zabbix_get/zabbix_get
+
+		systemd_dounit "${FILESDIR}"/zabbix-agentd.service
+		newtmpfiles "${FILESDIR}"/zabbix-agentd.tmpfiles zabbix-agentd.conf
+	fi
+	if use agent2; then
+		insinto /etc/zabbix
+		doins "${S}"/src/go/conf/zabbix_agent2.conf
+		fperms 0640 /etc/zabbix/zabbix_agent2.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agent2.conf
+
+		newinitd "${FILESDIR}"/zabbix-agent2.init zabbix-agent2
+
+		dosbin src/go/bin/zabbix_agent2
+
+		systemd_dounit "${FILESDIR}"/zabbix-agent2.service
+		newtmpfiles "${FILESDIR}"/zabbix-agent2.tmpfiles zabbix-agent2.conf
+	fi
+
+	fowners root:zabbix /etc/zabbix
+	fowners zabbix:zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+	fperms 0750 \
+		/etc/zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+
+	dodoc README INSTALL NEWS ChangeLog \
+		conf/zabbix_agentd.conf \
+		conf/zabbix_proxy.conf \
+		conf/zabbix_agentd/userparameter_examples.conf \
+		conf/zabbix_agentd/userparameter_mysql.conf \
+		conf/zabbix_server.conf
+
+	if use frontend; then
+		webapp_src_preinst
+		cp -R ui/* "${D}/${MY_HTDOCSDIR}"
+		webapp_configfile \
+			"${MY_HTDOCSDIR}"/include/db.inc.php \
+			"${MY_HTDOCSDIR}"/include/config.inc.php
+		webapp_src_install
+	fi
+
+	if use java; then
+		dodir \
+			/${ZABBIXJAVA_BASE} \
+			/${ZABBIXJAVA_BASE}/bin \
+			/${ZABBIXJAVA_BASE}/lib
+		keepdir /${ZABBIXJAVA_BASE}
+		exeinto /${ZABBIXJAVA_BASE}/bin
+		doexe src/zabbix_java/bin/zabbix-java-gateway-"${MY_PV}".jar
+		exeinto /${ZABBIXJAVA_BASE}/lib
+		doexe \
+			src/zabbix_java/lib/logback-classic-1.2.9.jar \
+			src/zabbix_java/lib/logback-console.xml \
+			src/zabbix_java/lib/logback-core-1.2.9.jar \
+			src/zabbix_java/lib/logback.xml \
+			src/zabbix_java/lib/android-json-4.3_r3.1.jar \
+			src/zabbix_java/lib/slf4j-api-1.7.32.jar
+		newinitd "${FILESDIR}"/zabbix-jmx-proxy.init zabbix-jmx-proxy
+		newconfd "${FILESDIR}"/zabbix-jmx-proxy.conf zabbix-jmx-proxy
+	fi
+}
+
+pkg_postinst() {
+	if use server || use proxy ; then
+		elog
+		elog "You may need to configure your database for Zabbix"
+		elog "if you have not already done so."
+		elog
+
+		zabbix_homedir=$(egethome zabbix)
+		if [ -n "${zabbix_homedir}" ] && \
+			[ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
+			ewarn
+			ewarn "The user 'zabbix' should have his homedir changed"
+			ewarn "to /var/lib/zabbix/home if you want to use"
+			ewarn "custom alert scripts."
+			ewarn
+			ewarn "A real homedir might be needed for configfiles"
+			ewarn "for custom alert scripts."
+			ewarn
+			ewarn "To change the homedir use:"
+			ewarn "  usermod -d /var/lib/zabbix/home zabbix"
+			ewarn
+		fi
+	fi
+
+	if use server; then
+		tmpfiles_process zabbix-server.conf
+
+		elog
+		elog "For distributed monitoring you have to run:"
+		elog
+		elog "zabbix_server -n <nodeid>"
+		elog
+		elog "This will convert database data for use with Node ID"
+		elog "and also adds a local node."
+		elog
+
+		if ! use pcre2; then
+			ewarn "You are using zabbix with dev-libs/libpcre which is deprecated."
+			ewarn "Consider switching to dev-libs/libpcre2 (USE=pcre2) as soon as possible."
+			ewarn "See https://www.zabbix.com/documentation/6.0/en/manual/installation/upgrade_notes_600#pcre2-support"
+		fi
+	fi
+
+	if use proxy; then
+		tmpfiles_process zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		tmpfiles_process zabbix-agentd.conf
+	fi
+
+	if use agent2; then
+		tmpfiles_process zabbix-agent2.conf
+	fi
+
+	elog "--"
+	elog
+	elog "You may need to add these lines to /etc/services:"
+	elog
+	elog "zabbix-agent     10050/tcp Zabbix Agent"
+	elog "zabbix-agent     10050/udp Zabbix Agent"
+	elog "zabbix-trapper   10051/tcp Zabbix Trapper"
+	elog "zabbix-trapper   10051/udp Zabbix Trapper"
+	elog
+
+	if use server || use proxy ; then
+		# check for fping
+		fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
+		case "${fping_perms}" in
+			4[157][157][157])
+				;;
+			*)
+				ewarn
+				ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
+				ewarn "you have to make /usr/sbin/fping setuid root and executable"
+				ewarn "by everyone. Run the following command to fix it:"
+				ewarn
+				ewarn "  chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
+				ewarn
+				ewarn "Please be aware that this might impose a security risk,"
+				ewarn "depending on the code quality of fping."
+				ewarn
+				;;
+		esac
+	fi
+}
+
+pkg_prerm() {
+	(use frontend || use server) && webapp_pkg_prerm
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/zabbix/, net-analyzer/zabbix/files/
@ 2023-04-27  6:43 Miroslav Šulc
  0 siblings, 0 replies; 5+ messages in thread
From: Miroslav Šulc @ 2023-04-27  6:43 UTC (permalink / raw
  To: gentoo-commits

commit:     ee4bbb47f64acc7873009fb99895d40c568a311b
Author:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
AuthorDate: Thu Apr 27 06:42:59 2023 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Thu Apr 27 06:43:06 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee4bbb47

net-analyzer/zabbix: fixed patches not being applied in 6.4.x + added configure patch

Bug: https://bugs.gentoo.org/900046
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../zabbix/files/zabbix-6.4.0-configure-sscanf.patch         | 12 ++++++++++++
 .../zabbix/{zabbix-6.4.0.ebuild => zabbix-6.4.0-r1.ebuild}   |  6 +++++-
 .../zabbix/{zabbix-6.4.1.ebuild => zabbix-6.4.1-r1.ebuild}   |  6 +++++-
 .../zabbix/{zabbix-6.4.2.ebuild => zabbix-6.4.2-r1.ebuild}   |  6 +++++-
 4 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/net-analyzer/zabbix/files/zabbix-6.4.0-configure-sscanf.patch b/net-analyzer/zabbix/files/zabbix-6.4.0-configure-sscanf.patch
new file mode 100644
index 000000000000..0a95780c4505
--- /dev/null
+++ b/net-analyzer/zabbix/files/zabbix-6.4.0-configure-sscanf.patch
@@ -0,0 +1,12 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -952,8 +952,9 @@ dnl Check for %qu format (FreeBSD 4.x)
+ dnl FreeBSD 4.x does not support %llu
+ AC_MSG_CHECKING(for long long format)
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[
++#include <stdio.h>
+ #include <sys/types.h>
+-int main()
++int main(void)
+ {
+         uint64_t i;

diff --git a/net-analyzer/zabbix/zabbix-6.4.0.ebuild b/net-analyzer/zabbix/zabbix-6.4.0-r1.ebuild
similarity index 99%
rename from net-analyzer/zabbix/zabbix-6.4.0.ebuild
rename to net-analyzer/zabbix/zabbix-6.4.0-r1.ebuild
index 21333f63c79d..0c7469cad01a 100644
--- a/net-analyzer/zabbix/zabbix-6.4.0.ebuild
+++ b/net-analyzer/zabbix/zabbix-6.4.0-r1.ebuild
@@ -117,7 +117,7 @@ RESTRICT="test"
 PATCHES=(
 	"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
 	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
-	"${FILESDIR}/${PN}-6.0.3-system.sw.packages.patch"
+	"${FILESDIR}/${PN}-6.4.0-configure-sscanf.patch"
 )
 
 S=${WORKDIR}/${MY_P}
@@ -143,6 +143,10 @@ pkg_setup() {
 	java-pkg-opt-2_pkg_setup
 }
 
+src_prepare() {
+	default
+}
+
 src_configure() {
 	local econf_args=(
 		--with-libpcre2

diff --git a/net-analyzer/zabbix/zabbix-6.4.1.ebuild b/net-analyzer/zabbix/zabbix-6.4.1-r1.ebuild
similarity index 99%
rename from net-analyzer/zabbix/zabbix-6.4.1.ebuild
rename to net-analyzer/zabbix/zabbix-6.4.1-r1.ebuild
index f3edadcff0ce..e43f9f4d55ac 100644
--- a/net-analyzer/zabbix/zabbix-6.4.1.ebuild
+++ b/net-analyzer/zabbix/zabbix-6.4.1-r1.ebuild
@@ -117,7 +117,7 @@ RESTRICT="test"
 PATCHES=(
 	"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
 	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
-	"${FILESDIR}/${PN}-6.0.3-system.sw.packages.patch"
+	"${FILESDIR}/${PN}-6.4.0-configure-sscanf.patch"
 )
 
 S=${WORKDIR}/${MY_P}
@@ -143,6 +143,10 @@ pkg_setup() {
 	java-pkg-opt-2_pkg_setup
 }
 
+src_prepare() {
+	default
+}
+
 src_configure() {
 	local econf_args=(
 		--with-libpcre2

diff --git a/net-analyzer/zabbix/zabbix-6.4.2.ebuild b/net-analyzer/zabbix/zabbix-6.4.2-r1.ebuild
similarity index 99%
rename from net-analyzer/zabbix/zabbix-6.4.2.ebuild
rename to net-analyzer/zabbix/zabbix-6.4.2-r1.ebuild
index f3edadcff0ce..e43f9f4d55ac 100644
--- a/net-analyzer/zabbix/zabbix-6.4.2.ebuild
+++ b/net-analyzer/zabbix/zabbix-6.4.2-r1.ebuild
@@ -117,7 +117,7 @@ RESTRICT="test"
 PATCHES=(
 	"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
 	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
-	"${FILESDIR}/${PN}-6.0.3-system.sw.packages.patch"
+	"${FILESDIR}/${PN}-6.4.0-configure-sscanf.patch"
 )
 
 S=${WORKDIR}/${MY_P}
@@ -143,6 +143,10 @@ pkg_setup() {
 	java-pkg-opt-2_pkg_setup
 }
 
+src_prepare() {
+	default
+}
+
 src_configure() {
 	local econf_args=(
 		--with-libpcre2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [gentoo-commits] repo/gentoo:master commit in: net-analyzer/zabbix/, net-analyzer/zabbix/files/
@ 2023-09-25  7:29 Miroslav Šulc
  0 siblings, 0 replies; 5+ messages in thread
From: Miroslav Šulc @ 2023-09-25  7:29 UTC (permalink / raw
  To: gentoo-commits

commit:     095512a057165aeccbcb6dc405c571cd7d71e209
Author:     Brahmajit Das <brahmajit.xyz <AT> gmail <DOT> com>
AuthorDate: Sun Sep 24 15:00:31 2023 +0000
Commit:     Miroslav Šulc <fordfrog <AT> gentoo <DOT> org>
CommitDate: Mon Sep 25 07:29:04 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=095512a0

net-analyzer/zabbix: Fix incompatible pointer to integer conversion

Closes: https://bugs.gentoo.org/897840
Signed-off-by: Brahmajit Das <brahmajit.xyz <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/33033
Signed-off-by: Miroslav Šulc <fordfrog <AT> gentoo.org>

 .../files/zabbix-6.4.6-clang16-build-fix.patch     |  58 +++
 net-analyzer/zabbix/zabbix-6.4.6-r1.ebuild         | 404 +++++++++++++++++++++
 2 files changed, 462 insertions(+)

diff --git a/net-analyzer/zabbix/files/zabbix-6.4.6-clang16-build-fix.patch b/net-analyzer/zabbix/files/zabbix-6.4.6-clang16-build-fix.patch
new file mode 100644
index 000000000000..4160a42ee6eb
--- /dev/null
+++ b/net-analyzer/zabbix/files/zabbix-6.4.6-clang16-build-fix.patch
@@ -0,0 +1,58 @@
+https://github.com/zabbix/zabbix/pull/110
+From: Brahmajit Das <brahmajit.xyz@gmail.com>
+Date: Sun, 24 Sep 2023 14:40:05 +0000
+Subject: [PATCH] Fix incompatible pointer to integer conversion initializing
+
+Makes struct members explicit.
+
+First found on Gentoo linux, with MUSL LLVM profile. Most probably due
+to newer compilers (like Clang 16 and GCC 14) have turned various errors
+on by default and we get build errors such as:
+
+```
+net.c:115:79: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion]
+        struct msghdr           s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0};
+                                                                                              ^~~~
+/usr/include/unistd.h:25:14: note: expanded from macro 'NULL'
+             ^~~~~~~~~~
+net.c:121:79: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion]
+        struct msghdr           r_msg = { (void *)&r_sa, sizeof(struct sockaddr_nl), r_io, 1, NULL, 0, 0};
+                                                                                              ^~~~
+/usr/include/unistd.h:25:14: note: expanded from macro 'NULL'
+```
+
+Bug: https://bugs.gentoo.org/897840
+Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
+--- a/src/libs/zbxsysinfo/linux/net.c
++++ b/src/libs/zbxsysinfo/linux/net.c
+@@ -112,13 +112,25 @@ static int	find_tcp_port_by_state_nl(unsigned short port, int state, int *found)
+ 
+ 	struct sockaddr_nl	s_sa = { AF_NETLINK, 0, 0, 0 };
+ 	struct iovec		s_io[1] = { { &request, sizeof(request) } };
+-	struct msghdr		s_msg = { (void *)&s_sa, sizeof(struct sockaddr_nl), s_io, 1, NULL, 0, 0};
++	struct msghdr		s_msg = { .msg_name = (void *)&s_sa,
++								.msg_namelen = sizeof(struct sockaddr_nl),
++								.msg_iov = s_io,
++								.msg_iovlen = 1,
++								.msg_control = NULL,
++								.msg_controllen = 0,
++								.msg_flags = 0};
+ 
+ 	char			buffer[BUFSIZ] = { 0 };
+ 
+ 	struct sockaddr_nl	r_sa = { AF_NETLINK, 0, 0, 0 };
+ 	struct iovec		r_io[1] = { { buffer, BUFSIZ } };
+-	struct msghdr		r_msg = { (void *)&r_sa, sizeof(struct sockaddr_nl), r_io, 1, NULL, 0, 0};
++	struct msghdr		r_msg = { .msg_name = (void *)&r_sa,
++								.msg_namelen = sizeof(struct sockaddr_nl),
++								.msg_iov = r_io,
++								.msg_iovlen = 1,
++								.msg_control = NULL,
++								.msg_controllen = 0,
++								.msg_flags = 0};
+ 
+ 	struct nlmsghdr		*r_hdr;
+ 
+-- 
+2.42.0
+

diff --git a/net-analyzer/zabbix/zabbix-6.4.6-r1.ebuild b/net-analyzer/zabbix/zabbix-6.4.6-r1.ebuild
new file mode 100644
index 000000000000..30c139d2d3c5
--- /dev/null
+++ b/net-analyzer/zabbix/zabbix-6.4.6-r1.ebuild
@@ -0,0 +1,404 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+# To create the go modules tarball:
+#   cd src/go
+#   GOMODCACHE="${PWD}"/go-mod go mod download -modcacherw
+#   tar -acf zabbix-${PV}-go-deps.tar.xz go-mod
+
+EAPI=8
+
+GO_OPTIONAL="yes"
+# needed to make webapp-config dep optional
+WEBAPP_OPTIONAL="yes"
+inherit webapp java-pkg-opt-2 systemd tmpfiles toolchain-funcs go-module user-info
+
+DESCRIPTION="ZABBIX is software for monitoring of your applications, network and servers"
+HOMEPAGE="https://www.zabbix.com/"
+MY_P=${P/_/}
+MY_PV=${PV/_/}
+SRC_URI="https://cdn.zabbix.com/${PN}/sources/stable/$(ver_cut 1-2)/${P}.tar.gz
+	agent2? ( https://dev.gentoo.org/~fordfrog/distfiles/${P}-go-deps.tar.xz )
+"
+
+LICENSE="GPL-2"
+SLOT="0/$(ver_cut 1-2)"
+WEBAPP_MANUAL_SLOT="yes"
+KEYWORDS="~amd64 ~x86"
+IUSE="agent +agent2 curl frontend gnutls ipv6 java ldap libxml2 mysql odbc openipmi +openssl oracle +postgres proxy selinux server snmp sqlite ssh static"
+REQUIRED_USE="|| ( agent agent2 frontend proxy server )
+	?? ( gnutls openssl )
+	agent2? ( !gnutls )
+	proxy? ( ^^ ( mysql oracle postgres sqlite ) )
+	server? ( ^^ ( mysql oracle postgres ) !sqlite )
+	static? ( !oracle !snmp )"
+
+COMMON_DEPEND="
+	curl? ( net-misc/curl )
+	gnutls? ( net-libs/gnutls:0= )
+	java? ( >=virtual/jdk-1.8:* )
+	ldap? (
+		=dev-libs/cyrus-sasl-2*
+		net-libs/gnutls:=
+		net-nds/openldap:=
+	)
+	libxml2? ( dev-libs/libxml2 )
+	mysql? ( dev-db/mysql-connector-c:= )
+	odbc? ( dev-db/unixODBC )
+	openipmi? ( sys-libs/openipmi )
+	openssl? ( dev-libs/openssl:=[-bindist(-)] )
+	oracle? ( dev-db/oracle-instantclient[odbc,sdk] )
+	postgres? ( dev-db/postgresql:* )
+	proxy?  (
+		dev-libs/libevent:=
+		sys-libs/zlib
+	)
+	server? (
+		dev-libs/libevent:=
+		sys-libs/zlib
+	)
+	snmp? ( net-analyzer/net-snmp:= )
+	sqlite? ( dev-db/sqlite )
+	ssh? ( net-libs/libssh2 )
+"
+
+RDEPEND="${COMMON_DEPEND}
+	acct-group/zabbix
+	acct-user/zabbix
+	java? ( >=virtual/jre-1.8:* )
+	mysql? ( virtual/mysql )
+	proxy? (
+		dev-libs/libpcre2:=
+		net-analyzer/fping[suid]
+	)
+	selinux? ( sec-policy/selinux-zabbix )
+	server? (
+		app-admin/webapp-config
+		dev-libs/libpcre2:=
+		net-analyzer/fping[suid]
+	)
+	frontend? (
+		app-admin/webapp-config
+		dev-lang/php:*[bcmath,ctype,sockets,gd,truetype,xml,session,xmlreader,xmlwriter,nls,sysvipc,unicode]
+		media-libs/gd[png]
+		virtual/httpd-php:*
+		mysql? ( dev-lang/php[mysqli] )
+		odbc? ( dev-lang/php[odbc] )
+		oracle? ( dev-lang/php[oci8-instant-client] )
+		postgres? ( dev-lang/php[postgres] )
+		sqlite? ( dev-lang/php[sqlite] )
+	)
+"
+DEPEND="${COMMON_DEPEND}
+	static? (
+		curl? ( net-misc/curl[static-libs] )
+		ldap? (
+			=dev-libs/cyrus-sasl-2*[static-libs]
+			net-libs/gnutls[static-libs]
+			net-nds/openldap[static-libs]
+		)
+		libxml2? ( dev-libs/libxml2[static-libs] )
+		mysql? ( dev-db/mysql-connector-c[static-libs] )
+		odbc? ( dev-db/unixODBC[static-libs] )
+		postgres? ( dev-db/postgresql:*[static-libs] )
+		sqlite? ( dev-db/sqlite[static-libs] )
+		ssh? ( net-libs/libssh2 )
+	)
+"
+BDEPEND="
+	virtual/pkgconfig
+	agent2? (
+		>=dev-lang/go-1.12
+		app-arch/unzip
+	)
+"
+
+# upstream tests fail for agent2
+RESTRICT="test"
+
+PATCHES=(
+	"${FILESDIR}/${PN}-4.0.18-modulepathfix.patch"
+	"${FILESDIR}/${PN}-3.0.30-security-disable-PidFile.patch"
+	"${FILESDIR}/${PN}-6.4.0-configure-sscanf.patch"
+	"${FILESDIR}/${PN}-6.4.6-clang16-build-fix.patch"
+)
+
+S=${WORKDIR}/${MY_P}
+
+ZABBIXJAVA_BASE="opt/zabbix_java"
+
+pkg_setup() {
+	if use oracle; then
+		if [ -z "${ORACLE_HOME}" ]; then
+			eerror
+			eerror "The environment variable ORACLE_HOME must be set"
+			eerror "and point to the correct location."
+			eerror "It looks like you don't have Oracle installed."
+			eerror
+			die "Environment variable ORACLE_HOME is not set"
+		fi
+	fi
+
+	if use frontend; then
+		webapp_pkg_setup
+	fi
+
+	java-pkg-opt-2_pkg_setup
+}
+
+src_prepare() {
+	default
+}
+
+src_configure() {
+	local econf_args=(
+		--with-libpcre2
+		"$(use_enable agent)"
+		"$(use_enable agent2)"
+		"$(use_enable ipv6)"
+		"$(use_enable java)"
+		"$(use_enable proxy)"
+		"$(use_enable server)"
+		"$(use_enable static)"
+		"$(use_with curl libcurl)"
+		"$(use_with gnutls)"
+		"$(use_with ldap)"
+		"$(use_with libxml2)"
+		"$(use_with mysql)"
+		"$(use_with odbc unixodbc)"
+		"$(use_with openipmi openipmi)"
+		"$(use_with openssl)"
+		"$(use_with oracle)"
+		"$(use_with postgres postgresql)"
+		"$(use_with snmp net-snmp)"
+		"$(use_with sqlite sqlite3)"
+		"$(use_with ssh ssh2)"
+	)
+
+	econf ${econf_args[@]}
+}
+
+src_compile() {
+	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
+		emake AR="$(tc-getAR)" RANLIB="$(tc-getRANLIB)"
+	fi
+}
+
+src_install() {
+	local dirs=(
+		/etc/zabbix
+		/var/lib/zabbix
+		/var/lib/zabbix/home
+		/var/lib/zabbix/scripts
+		/var/lib/zabbix/alertscripts
+		/var/lib/zabbix/externalscripts
+		/var/log/zabbix
+	)
+
+	for dir in "${dirs[@]}"; do
+		keepdir "${dir}"
+	done
+
+	if use server; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_server.conf
+		fperms 0640 /etc/zabbix/zabbix_server.conf
+		fowners root:zabbix /etc/zabbix/zabbix_server.conf
+
+		newinitd "${FILESDIR}"/zabbix-server-r1.init zabbix-server
+
+		dosbin src/zabbix_server/zabbix_server
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-server.service
+		newtmpfiles "${FILESDIR}"/zabbix-server.tmpfiles zabbix-server.conf
+	fi
+
+	if use proxy; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_proxy.conf
+		fperms 0640 /etc/zabbix/zabbix_proxy.conf
+		fowners root:zabbix /etc/zabbix/zabbix_proxy.conf
+
+		newinitd "${FILESDIR}"/zabbix-proxy.init zabbix-proxy
+
+		dosbin src/zabbix_proxy/zabbix_proxy
+
+		insinto /usr/share/zabbix
+		doins -r "${S}"/database/
+
+		systemd_dounit "${FILESDIR}"/zabbix-proxy.service
+		newtmpfiles "${FILESDIR}"/zabbix-proxy.tmpfiles zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		insinto /etc/zabbix
+		doins "${S}"/conf/zabbix_agentd.conf
+		fperms 0640 /etc/zabbix/zabbix_agentd.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agentd.conf
+
+		newinitd "${FILESDIR}"/zabbix-agentd.init zabbix-agentd
+
+		dosbin src/zabbix_agent/zabbix_agentd
+		dobin \
+			src/zabbix_sender/zabbix_sender \
+			src/zabbix_get/zabbix_get
+
+		systemd_dounit "${FILESDIR}"/zabbix-agentd.service
+		newtmpfiles "${FILESDIR}"/zabbix-agentd.tmpfiles zabbix-agentd.conf
+	fi
+	if use agent2; then
+		insinto /etc/zabbix
+		doins "${S}"/src/go/conf/zabbix_agent2.conf
+		fperms 0640 /etc/zabbix/zabbix_agent2.conf
+		fowners root:zabbix /etc/zabbix/zabbix_agent2.conf
+		keepdir /etc/zabbix/zabbix_agent2.d/plugins.d
+
+		newinitd "${FILESDIR}"/zabbix-agent2.init zabbix-agent2
+
+		dosbin src/go/bin/zabbix_agent2
+
+		systemd_dounit "${FILESDIR}"/zabbix-agent2.service
+		newtmpfiles "${FILESDIR}"/zabbix-agent2.tmpfiles zabbix-agent2.conf
+	fi
+
+	fowners root:zabbix /etc/zabbix
+	fowners zabbix:zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+	fperms 0750 \
+		/etc/zabbix \
+		/var/lib/zabbix \
+		/var/lib/zabbix/home \
+		/var/lib/zabbix/scripts \
+		/var/lib/zabbix/alertscripts \
+		/var/lib/zabbix/externalscripts \
+		/var/log/zabbix
+
+	dodoc README INSTALL NEWS ChangeLog \
+		conf/zabbix_agentd.conf \
+		conf/zabbix_proxy.conf \
+		conf/zabbix_agentd/userparameter_examples.conf \
+		conf/zabbix_agentd/userparameter_mysql.conf \
+		conf/zabbix_server.conf
+
+	if use frontend; then
+		webapp_src_preinst
+		cp -R ui/* "${D}/${MY_HTDOCSDIR}"
+		webapp_configfile \
+			"${MY_HTDOCSDIR}"/include/db.inc.php \
+			"${MY_HTDOCSDIR}"/include/config.inc.php
+		webapp_src_install
+	fi
+
+	if use java; then
+		dodir \
+			/${ZABBIXJAVA_BASE} \
+			/${ZABBIXJAVA_BASE}/bin \
+			/${ZABBIXJAVA_BASE}/lib
+		keepdir /${ZABBIXJAVA_BASE}
+		exeinto /${ZABBIXJAVA_BASE}/bin
+		doexe src/zabbix_java/bin/zabbix-java-gateway-"${MY_PV}".jar
+		exeinto /${ZABBIXJAVA_BASE}/lib
+		doexe \
+			src/zabbix_java/lib/logback-classic-1.2.9.jar \
+			src/zabbix_java/lib/logback-console.xml \
+			src/zabbix_java/lib/logback-core-1.2.9.jar \
+			src/zabbix_java/lib/logback.xml \
+			src/zabbix_java/lib/android-json-4.3_r3.1.jar \
+			src/zabbix_java/lib/slf4j-api-1.7.32.jar
+		newinitd "${FILESDIR}"/zabbix-jmx-proxy.init zabbix-jmx-proxy
+		newconfd "${FILESDIR}"/zabbix-jmx-proxy.conf zabbix-jmx-proxy
+	fi
+}
+
+pkg_postinst() {
+	if use server || use proxy ; then
+		elog
+		elog "You may need to configure your database for Zabbix"
+		elog "if you have not already done so."
+		elog
+
+		zabbix_homedir=$(egethome zabbix)
+		if [ -n "${zabbix_homedir}" ] && \
+			[ "${zabbix_homedir}" != "/var/lib/zabbix/home" ]; then
+			ewarn
+			ewarn "The user 'zabbix' should have his homedir changed"
+			ewarn "to /var/lib/zabbix/home if you want to use"
+			ewarn "custom alert scripts."
+			ewarn
+			ewarn "A real homedir might be needed for configfiles"
+			ewarn "for custom alert scripts."
+			ewarn
+			ewarn "To change the homedir use:"
+			ewarn "  usermod -d /var/lib/zabbix/home zabbix"
+			ewarn
+		fi
+	fi
+
+	if use server; then
+		tmpfiles_process zabbix-server.conf
+
+		elog
+		elog "For distributed monitoring you have to run:"
+		elog
+		elog "zabbix_server -n <nodeid>"
+		elog
+		elog "This will convert database data for use with Node ID"
+		elog "and also adds a local node."
+		elog
+	fi
+
+	if use proxy; then
+		tmpfiles_process zabbix-proxy.conf
+	fi
+
+	if use agent; then
+		tmpfiles_process zabbix-agentd.conf
+	fi
+
+	if use agent2; then
+		tmpfiles_process zabbix-agent2.conf
+	fi
+
+	elog "--"
+	elog
+	elog "You may need to add these lines to /etc/services:"
+	elog
+	elog "zabbix-agent     10050/tcp Zabbix Agent"
+	elog "zabbix-agent     10050/udp Zabbix Agent"
+	elog "zabbix-trapper   10051/tcp Zabbix Trapper"
+	elog "zabbix-trapper   10051/udp Zabbix Trapper"
+	elog
+
+	if use server || use proxy ; then
+		# check for fping
+		fping_perms=$(stat -c %a /usr/sbin/fping 2>/dev/null)
+		case "${fping_perms}" in
+			4[157][157][157])
+				;;
+			*)
+				ewarn
+				ewarn "If you want to use the checks 'icmpping' and 'icmppingsec',"
+				ewarn "you have to make /usr/sbin/fping setuid root and executable"
+				ewarn "by everyone. Run the following command to fix it:"
+				ewarn
+				ewarn "  chmod u=rwsx,g=rx,o=rx /usr/sbin/fping"
+				ewarn
+				ewarn "Please be aware that this might impose a security risk,"
+				ewarn "depending on the code quality of fping."
+				ewarn
+				;;
+		esac
+	fi
+}
+
+pkg_prerm() {
+	(use frontend || use server) && webapp_pkg_prerm
+}


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-25  7:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-30  8:25 [gentoo-commits] repo/gentoo:master commit in: net-analyzer/zabbix/, net-analyzer/zabbix/files/ Miroslav Šulc
  -- strict thread matches above, loose matches on Subject: below --
2021-11-17  8:08 Florian Schmaus
2022-04-06  9:30 Miroslav Šulc
2023-04-27  6:43 Miroslav Šulc
2023-09-25  7:29 Miroslav Šulc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox