From 23376feb624809d748c7ba36b8097ebbc31c51ae Mon Sep 17 00:00:00 2001 From: Frank Brendel Date: Fri, 5 May 2017 11:27:50 +0200 Subject: [PATCH] Monit: import sender address and fix validation regexp (cherry picked from commit eb8ace13e71aaf720b6edbce63da7235a0828432) (cherry picked from commit 52b09ea0ccb0de101cb84cd85fe50f6d1d80212a) --- sysutils/monit/Makefile | 2 +- .../opnsense/mvc/app/models/OPNsense/Monit/Monit.xml | 12 ++++++------ .../opnsense/scripts/OPNsense/Monit/post-install.php | 3 +++ 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/sysutils/monit/Makefile b/sysutils/monit/Makefile index f4c825342..6ffa5b491 100644 --- a/sysutils/monit/Makefile +++ b/sysutils/monit/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME= monit -PLUGIN_VERSION= 1.0 +PLUGIN_VERSION= 1.1 PLUGIN_COMMENT= Proactive system monitoring PLUGIN_MAINTAINER= frank.brendel@eurolog.com PLUGIN_DEPENDS= monit diff --git a/sysutils/monit/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.xml b/sysutils/monit/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.xml index 49af87c54..8f6bfebf3 100644 --- a/sysutils/monit/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.xml +++ b/sysutils/monit/src/opnsense/mvc/app/models/OPNsense/Monit/Monit.xml @@ -95,7 +95,7 @@ N - /^([ 0-9a-zA-Z.,_\x{00A0}-\x{FFFF}]){1,255}$/u + /^.{1,255}$/u Message format should be a string between 1 and 255 characters. @@ -107,7 +107,7 @@ N - /^([\t\n\v\f\r 0-9a-zA-Z.,_\x{00A0}-\x{FFFF}]){1,255}$/u + /^.{1,255}$/u Enter a description. @@ -118,7 +118,7 @@ Y - /^([0-9a-zA-Z\._-]){1,255}$/u + /^([0-9a-zA-Z\._\-]){1,255}$/u Should be a string between 1 and 255 characters. Allowed characters are letters and numbers as well as underscore, minus and dot. @@ -187,12 +187,12 @@ Y - /^([0-9a-zA-Z._ ]){1,255}$/u - Should be a string between 1 and 255 characters. + /^([0-9a-zA-Z\._\- ]){1,255}$/u + Should be a string between 1 and 255 characters. Allowed characters are letters and numbers as well as underscore, minus, dot and space. Y - /^([\t\n\v\f\r 0-9a-zA-Z.:\-,_()%\x{00A0}-\x{FFFF}]){1,255}$/u + /^.{1,255}$/u Should be a string between 1 and 255 characters. diff --git a/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php b/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php index c448c622b..7ee2100b9 100755 --- a/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php +++ b/sysutils/monit/src/opnsense/scripts/OPNsense/Monit/post-install.php @@ -81,6 +81,9 @@ $alertSettings = array(); if (!empty($cfgObj->notifications->smtp->notifyemailaddress)) { $alertSettings['recipient'] = $cfgObj->notifications->smtp->notifyemailaddress; } +if (!empty($cfgObj->notifications->smtp->fromaddress)) { + $alertSettings['format'] = 'from: ' . $cfgObj->notifications->smtp->fromaddress; +} // define some tests $defaultTests = array(