From fd4fc038e176e83ba128efe1cfc30476d027aad1 Mon Sep 17 00:00:00 2001
From: clanto007 <44651109+clanto007@users.noreply.github.com>
Date: Wed, 27 Apr 2022 20:43:13 +0200
Subject: [PATCH] Add Enable Remote Commands to Zabbix Proxy (#2948)
---
net-mgmt/zabbix-proxy/Makefile | 2 +-
net-mgmt/zabbix-proxy/pkg-descr | 4 ++++
.../app/controllers/OPNsense/Zabbixproxy/forms/general.xml | 6 ++++++
.../mvc/app/models/OPNsense/Zabbixproxy/General.xml | 4 ++++
.../templates/OPNsense/Zabbixproxy/zabbix_proxy.conf.in | 5 +++++
5 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/net-mgmt/zabbix-proxy/Makefile b/net-mgmt/zabbix-proxy/Makefile
index 06492f992..0ee78e70b 100644
--- a/net-mgmt/zabbix-proxy/Makefile
+++ b/net-mgmt/zabbix-proxy/Makefile
@@ -1,5 +1,5 @@
PLUGIN_NAME= zabbix-proxy
-PLUGIN_VERSION= 1.7
+PLUGIN_VERSION= 1.8
PLUGIN_COMMENT= Zabbix monitoring proxy
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_VARIANTS= zabbix5 zabbix54 zabbix4
diff --git a/net-mgmt/zabbix-proxy/pkg-descr b/net-mgmt/zabbix-proxy/pkg-descr
index dadafe066..8182875fe 100644
--- a/net-mgmt/zabbix-proxy/pkg-descr
+++ b/net-mgmt/zabbix-proxy/pkg-descr
@@ -12,6 +12,10 @@ WWW: https://www.zabbix.com/
Plugin Changelog
----------------
+1.8
+
+* Add EnableRemoteCommands (#2948)
+
1.7
* Add StatsIP field to allow retrieving statistics (#2697)
diff --git a/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml b/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml
index 8124eaa21..168f981c3 100644
--- a/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml
+++ b/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/controllers/OPNsense/Zabbixproxy/forms/general.xml
@@ -11,6 +11,12 @@
checkbox
Active (default) or passive mode, only switch to passive if you know what you are doing.
+
+ general.remotecommands
+
+ checkbox
+ Enable Remote Commands on Proxy.
+
general.server
diff --git a/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml b/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml
index 6602576a2..ab55fb06c 100644
--- a/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml
+++ b/net-mgmt/zabbix-proxy/src/opnsense/mvc/app/models/OPNsense/Zabbixproxy/General.xml
@@ -11,6 +11,10 @@
0
Y
+
+ 0
+ Y
+
N
diff --git a/net-mgmt/zabbix-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf.in b/net-mgmt/zabbix-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf.in
index 9eace261b..3ee03b5dc 100644
--- a/net-mgmt/zabbix-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf.in
+++ b/net-mgmt/zabbix-proxy/src/opnsense/service/templates/OPNsense/Zabbixproxy/zabbix_proxy.conf.in
@@ -5,6 +5,11 @@ ProxyMode=1
{% else %}
ProxyMode=0
{% endif %}
+{% if helpers.exists('OPNsense.zabbixproxy.general.remotecommands') and OPNsense.zabbixproxy.general.remotecommands == '1' %}
+EnableRemoteCommands=1
+{% else %}
+EnableRemoteCommands=0
+{% endif %}
{% if helpers.exists('OPNsense.zabbixproxy.general.server') and OPNsense.zabbixproxy.general.server != '' %}
Server={{ OPNsense.zabbixproxy.general.server }}
{% endif %}