From patchwork Sun Aug 1 15:45:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthias Fischer X-Patchwork-Id: 4587 Return-Path: Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by web04.haj.ipfire.org (Postfix) with ESMTPS id 4Gd57P3ssvz3xGN for ; Sun, 1 Aug 2021 15:45:21 +0000 (UTC) Received: from mail02.haj.ipfire.org (mail02.haj.ipfire.org [172.28.1.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail02.haj.ipfire.org", Issuer "R3" (verified OK)) by mail01.ipfire.org (Postfix) with ESMTPS id 4Gd57M6DpSzl6; Sun, 1 Aug 2021 15:45:19 +0000 (UTC) Received: from mail02.haj.ipfire.org (localhost [127.0.0.1]) by mail02.haj.ipfire.org (Postfix) with ESMTP id 4Gd57M4mg3z2xlZ; Sun, 1 Aug 2021 15:45:19 +0000 (UTC) Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384 client-signature ECDSA (P-384) client-digest SHA384) (Client CN "mail01.haj.ipfire.org", Issuer "R3" (verified OK)) by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4Gd57L1qcLz2xJj for ; Sun, 1 Aug 2021 15:45:18 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by mail01.ipfire.org (Postfix) with ESMTPSA id 4Gd57K216DzBX for ; Sun, 1 Aug 2021 15:45:17 +0000 (UTC) DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003ed25519; t=1627832717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=1xcVML4mLitY/B1ia/VKe27fD/joF1L7bwYSYhQ2+hU=; b=r7/3sWetMilUqCLh7LwWKI3f5HVgqsPR5AwoQzIDdUZql0K6ODu3926KncnAgdy2JgsTiG mdm5s6q9/HdnJZBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa; t=1627832717; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=1xcVML4mLitY/B1ia/VKe27fD/joF1L7bwYSYhQ2+hU=; b=pZr4eCjoQknncW06x3lCyradcy35Pk46lk3VoxLPRxejSZ67pkLAppMoGrHSqE+N80pj8N ltkLt16kBOCSsV5riPygzpXDJu3667VhsImQ1DVd8ltYaUz+mReTpNA8EQQSEj6lpNJaTO X4T9UWHDzjnmJ/Q/97l7GER417FojsEKNhwun275gHo1iOgtYdoP/MKK7Sl1BerG0qvfwD 4ScAxHBKT046qp8T4KIJOUqPE6KWf7zcmEbffr0EpJF9RE6y02fTLACyPnLSUvd+zheRi0 Pt/PQWthWM3APqa20kGFIybowd0T0vYWI7gLdEnjHgpkKsgbPYoubu2XtJB6pQ== From: Matthias Fischer To: development@lists.ipfire.org Subject: [PATCH] monit: Modified default install/uninstall script Date: Sun, 1 Aug 2021 17:45:12 +0200 Message-Id: <20210801154512.1692-1-matthias.fischer@ipfire.org> X-BeenThere: development@lists.ipfire.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: IPFire development talk List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: development-bounces@lists.ipfire.org Sender: "Development" This is a proposed patch, altering the install and uninstall script for 'monit'. It alters '/srv/web/ipfire/cgi-bin/logs.cgi/log.dat', so that all 'monit' log entries can be seen through the web gui under "System Logs". Perhaps a bit rough, if someone has a better/easier solution, feel free to jump in. Signed-off-by: Matthias Fischer --- src/paks/monit/install.sh | 32 ++++++++++++++++++++++++++++++++ src/paks/monit/uninstall.sh | 31 +++++++++++++++++++++++++++++++ src/paks/monit/update.sh | 27 +++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 src/paks/monit/install.sh create mode 100644 src/paks/monit/uninstall.sh create mode 100644 src/paks/monit/update.sh diff --git a/src/paks/monit/install.sh b/src/paks/monit/install.sh new file mode 100644 index 000000000..8a2823ba5 --- /dev/null +++ b/src/paks/monit/install.sh @@ -0,0 +1,32 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007 IPFire-Team . # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +extract_files +restore_backup ${NAME} + +# Patch '/srv/web/ipfire/cgi-bin/logs.cgi/log.dat' to show monit entries +sed -i "/.*'kernel' => '(kernel: (?!DROP_))',/a \ 'monit' => '(monit\[.*\]: )'," /srv/web/ipfire/cgi-bin/logs.cgi/log.dat +sed -i "/.*'kernel' => \"\$Lang::tr{'kernel'}\",/a \ 'monit' => 'Monit'," /srv/web/ipfire/cgi-bin/logs.cgi/log.dat + +start_service --background ${NAME} diff --git a/src/paks/monit/uninstall.sh b/src/paks/monit/uninstall.sh new file mode 100644 index 000000000..8431d4a39 --- /dev/null +++ b/src/paks/monit/uninstall.sh @@ -0,0 +1,31 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007 IPFire-Team . # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +stop_service ${NAME} +make_backup ${NAME} + +# Remove monit entries from '/srv/web/ipfire/cgi-bin/logs.cgi/log.dat' +sed -i "/'monit'/d" /srv/web/ipfire/cgi-bin/logs.cgi/log.dat + +remove_files diff --git a/src/paks/monit/update.sh b/src/paks/monit/update.sh new file mode 100644 index 000000000..99776659c --- /dev/null +++ b/src/paks/monit/update.sh @@ -0,0 +1,27 @@ +#!/bin/bash +############################################################################ +# # +# This file is part of the IPFire Firewall. # +# # +# IPFire is free software; you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation; either version 2 of the License, or # +# (at your option) any later version. # +# # +# IPFire is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with IPFire; if not, write to the Free Software # +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# # +# Copyright (C) 2007-2020 IPFire-Team . # +# # +############################################################################ +# +. /opt/pakfire/lib/functions.sh +extract_backup_includes +./uninstall.sh +./install.sh